input
stringlengths
51
42.3k
output
stringlengths
18
55k
How change BO product list to also show wholesale price Prestashop 1.6 <p>Someone who has made this change?</p> <p>Today the BO product list show the end customer price excl and incl vat. I want if possible to show our wholesale price and mour end customer price excl vat instead. This is probably a change in AdminProd...
<p>Open /controllers/admin/AdminProductsController.php from your PrestaShop root directory and in the __construct() function, you will see the following code:</p> <pre><code>$this-&gt;fields_list['price'] = array( 'title' =&gt; $this-&gt;l('Base price'), 'type' =&gt; 'price', 'align' =&gt; 'tex...
OneToMany association in grails domain classes <p>I want one to many association between the <code>Person</code> and <code>Address</code> domain class which will be more like :</p> <pre><code>create table person (id bigint), version bigint not null, primary key (id)) create table address...
<p>You need to do establish <code>one-to-many</code> relationship between the <code>Domain class</code> <code>Person</code> &amp; <code>Address</code> as given below-</p> <p><code>Person</code> Domain class</p> <pre><code>class Person{ static hasMany = [addresses: Address] } </code></pre> <p><code>Address</code> Do...
How do i loop through an ajax response and display it in html <p>I'm a PHP developer and i'm looking for something like a foreach loop for an ajax response</p> <p>I have a card design in html and i would like the response of the ajax request make a new card for each object in the ajax response </p> <p>This is my code...
<p>You can create and append elements inside the <code>.each</code> statement.</p> <p>This is untested, but something like this might work:</p> <pre><code>$.each(mdata, function (index, element) { var div = $('&lt;div /&gt;') // Create the div .addClass('cho-card-title') // Add the class nam...
IntelliJ - debug mode - search text in program memory <p>I'm working with undocumented 3rd party library. I know that there is a certain <em>String</em> stored somewhere in one of the fields deep in the library (dynamic value that I can predict, but I want to get it from the API of the library).</p> <p>Is there a way ...
<p>IntelliJ 2015 and 2016 can <a href="https://www.jetbrains.com/idea/features/#built-in-tools" rel="nofollow">decompile Java classes</a>, so you can get the string from the library <s>without debugging at all</s>. Use Navigate -> Declaration or Navigate -> Implementation(s) to see a decompiled version of the byte code...
How do I deploy to Websphere developer server 8.5 via Eclipse Mars? <p>How does one deploy a web app from Eclipse Mars to a local install of IBM Websphere Application Server Developer 8.5 ?</p> <p>I installed the app server from IBM's Installation Manager, upon completion it says its location is: C:\Program Files (x86...
<p>You have to use "WebSphere Application Server traditional V8.5" and point it to the installation root not the profile root - so to <code>C:\Program Files (x86)\IBM\WebSphere\AppServer</code> in your case.</p> <p>For the future, it is not recommended to install WebSphere in the <code>Program Files (x86)</code> folde...
Migrating Custom Function Jar from 11G to 12C <p>We have custom functions implemented in 11G. We are upgrading our servers to 12C. At this point; my custom functions are not recognized.</p> <p>All custom functions are in a jar file. This jar is in the same directory as the oracle.soa.ext.jar that contains the manifest...
<p>We migrated BPEL services from 10g to 12c, the services contained embedded Java and imported Java libraries. When we launched Maven build, it failed with "not found" error. The issue was that the libraries were not accessible during the build phase.</p> <p>I used a workaround described in <a href="http://www.avioco...
ASP.Net Core 1.0.0-preview2 infinite redirect loop <p>I get infinite redirect loop when I publish application like this:</p> <p><code>/Account/Login?ReturnUrl=%2FLPanel3%2FHome%2FError%3FReturnUrl%3D%252FLPanel3%252FHome%252FError%253FReturnUrl%253D%25252FLPanel3%25252FHome%25252FError%25253FReturnUrl%25253D%2525252FL...
<p>I have fixed it with Creating new Web Site in IIS and setting my Anonymous Authentication User to "Application Pool" instead of specific user "IUSR" and also setting https on my app. </p> <p><a href="https://i.stack.imgur.com/8df8F.png" rel="nofollow"><img src="https://i.stack.imgur.com/8df8F.png" alt="Change Anony...
Test execution in Spring Boot fails due to failed config load <p>I am trying to test my application and running into troubles:</p> <pre><code>@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MainConfiguration.class) public class ProductionDataRestClientTest { @Test public void testGetPr...
<p>There was a very simple way to solve this issue:</p> <pre><code>// To resolve ${} in @Value @Bean public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() { return new PropertySourcesPlaceholderConfigurer(); } </code></pre> <p>This has to be a method of the loaded Configuration-file and helps r...
How to access a variable inside a function in jQuery? <p>I had put some Radio Button for a Price List. I have written this :</p> <pre><code>$(document).ready(function () { $('#windowsRange input').on('change', function () { var windowPrice = $('input[name=windowName]:checked', '#windowsRange').val(); }...
<p>You can simply make it "globally" vars</p> <pre><code>$(document).ready(function () { var windowPrice, profilePrice, tapePrice; $('#windowsRange input').on('change', function () { windowPrice = parseInt($('input[name=windowName]:checked', '#windowsRange').val()); setTotal(); }); $('#...
iOS 10 barTintColor animation <p>I've noticed a change in the way bar tint color animates in ios 10. I've created a sample project outlining the change: <a href="https://github.com/johnryan/ios10BarTintDemo" rel="nofollow">Github: ios10BarTintDemo</a></p> <p>Basically on ios 9 the barTintColor animates smoothly using ...
<p>You can fix this popping issue by adding something similar to this, running it in viewWillDisappear won't work for some reason in iOS10</p> <pre><code>override func willMove(toParentViewController parent: UIViewController?) { self.navigationController?.navigationBar.barTintColor = UIColor.red super.willMove...
rspec - Newly instantiated record is nil according to assigns <p>In my controller:</p> <pre><code>class CategoriesController &lt; ApplicationController before_filter :authenticate_super_admin! def new @thecategory = Category.new @thebrands = Brand.all render "categories/new" end end </code></pre> <...
<p>Turns out I was an idiot, the <code>createLoggedInSuperAdmin</code> call should have been wrapped in <code>before(:each)</code> instead of <code>before(:all)</code>, that was why the authentication was working for the first test but failing on the second one</p>
how to translate words/expressions in JS? <p>I have 60 expressions and single words that i need to translate into English.</p> <p>How can I design a simple (pure) JavaScript function to translate those 60 items? I need just an idea (design) not full code.</p> <p>I wrote the 60 items to translate in English too. I jus...
<p>Put all your expressions in a map and use it to translate</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var languageMap = { "bonjour" : "Hello", "au revoir" : "Go...
Bash equivalent .bash_logout for FISH shell <p>Generally I write my exit scripts for <code>bash</code> shell in <code>.bash_logout</code>. I recently started using <code>fish</code> shell. The <code>.bashrc</code> equivalent of <code>fish</code> is located in <code>~/.config/fish/config.fish</code> but where do I find ...
<p>Instead of sourcing a specific file, you define an event handler that runs when the shell exists.</p> <p>From <a href="http://fishshell.com/docs/current/index.html#initialization" rel="nofollow">http://fishshell.com/docs/current/index.html#initialization</a>:</p> <blockquote> <p>If you want to run a set of comma...
How to test with Espresso a PendingIntent generated by TaskStackBuilder <p>I am developing some cool Push Notification in our app and making some test to cover that when the user clicks on one of the notification then the app launch the correct intent to open the correct Activity.</p> <p>In our application we have a S...
<p>Espresso Intents is a solution for hermetic testing. It lets you test with Espresso when you communicate with other apps via Intents.</p> <p>Since you're staying within your app's boundaries, consider testing your UI by verifying that the correct screen is displayed in each navigation step. How you go from screen t...
Generate and get a string from a file <p>I was wondering how to generate a folder that contains a file(yaml format would be nice) with a text in (that you can customize by editing the file) and after a sysout with the text on the file. I totally don't have any ideas on how do it. Could you help me? Thank you.</p>
<p>You can try the Files class to create folders/files and read/write from a file.</p> <p><a href="https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html" rel="nofollow">https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html</a></p>
How to delete duplicates, but keep the first instance and a blank cell for the duplicates in Pandas? <p>I have a pandas DataFrame, and I'm doing a groupby(['target']).count(). This works fine. However, one of the things I want, for each group, is the number of unique elements in the ID column. </p> <p>What I'd like to...
<p>The <code>DataFrame.duplicated()</code> method is applicable here if you want to do it the way you described. It can return a Series with the first occurrence of an ID being False and the rest being True. You can then use this as a mask to set the duplicated IDs to null. </p> <p>See: <a href="http://pandas.pydata.o...
How does XORing the A register clear the carry bit on the F register in the Z80? <p>I'm reading a book about the Zilog Z80 processor, in which whenever the author wants to clear the carry bit for a possible reason he does any of the following:</p> <pre><code>XOR A AND A OR A </code></pre> <p>How does that affect the...
<p>I think I understand your concern. The flags register gets the result of an operation so it makes sense that AND, OR, XOR all affect the Zero flag, Sign flag and Parity flag. Those are all direct properties of the result. But the operations are not arithmetic so Carry isn't a natural property.</p> <p>I think the...
Ping results in "Host is Down" (but it's not!) error after iOS 10 Update <p>I have an iOS application that is a simple client or "remote" that sends some bytes to a hardware device when the user presses buttons within the application. The hardware device is an Arduino with a <a href="https://www.sparkfun.com/products/r...
<p>I'm using the same hardware and also have the issue with iOS10. There's good news and bad news.</p> <p>Good news: You can solve the problem by going to the wifi settings and forget the wifi network of the RN171 module and rejoin.</p> <p>Bad news: Each time you switch to another network you'll need to forget the RN...
Add posts category in CMB2 options <p>I need to add a specific type of posts in a dropdown option to my CMB2 WordPress plugin. I have found where in my code my fields are generated; however, I see <code>taxonomies</code> being used as filters, but I would need a post <code>post_type</code>.</p> <p><strong>Working, wit...
<p>Its seems your are assigning $teamMembers to options ,and but it not defined and don't have any values assigned. </p> <pre><code>// Get posts in desired category $posts = array(); $args = array( 'post_type' =&gt; 'post_type_i_want', 'orderby' =&gt; 'id', 'posts_per_page' =&gt; -1...
How do I add public youtube videos to a playlist in Youtube using URL? <p>The Youtube Data API doesn't have any option for this procedure. May be because it has got something to do with authentication. But what I'm referring is to add public videos to a playlist. How do I accomplish this using python?</p>
<p>You can use the <a href="https://developers.google.com/youtube/v3/docs/playlistItems/insert" rel="nofollow"><code>PlaylistItems: insert</code></a> to insert a video inside a playlist.</p> <p>Here is the request that I used.</p> <pre><code>POST https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&amp;ke...
Is a for loop in a function completed before performing code after the function? <p>If I run this code:</p> <pre><code> fanoutObj = fanoutPost(followersList.uid, followers: followersSnap, post: post) print(fanoutObj) </code></pre> <p>And the fanoutPost function has a really long for loop in it, then will will all th...
<p>The answer depends on the placement of the <code>for</code> loop:</p> <ul> <li>If the <code>for</code> loop is in the body of the function directly, the answer is "yes", because all statements on the path to the end of the function or to the return statement must complete before the function returns.</li> <li>If th...
Inserting an image into Bootstrap according is breaking collapse function <p>I am attempting to insert an image into a bootstrap accordion and when I do it makes that section (second accordian section) of the accordion remain open - where it should be collapsed initially allowing for someone to click on it to expand it...
<p>You messed up the libraries.</p> <p>Moreover, after the "panel-tile" ... "Add a New Content Object" it's required the</p> <pre><code>&lt;div id="collapseCO0137098_1" class="panel-collapse collapse"&gt; </code></pre> <p>And, before the</p> <pre><code> `&lt;div class="panel-heading"&gt;` </code></pre> <p>it's re...
parellel search with communications between threads <p>Suppose I have an int array, an element <code>num</code> and 4 threads. I'm giving each thread 1/4 of the array to search for <code>num</code>. (The search method is given below)</p> <pre><code>public static boolean contains(int[] array, int minIdx, int maxIdx, in...
<p>You need explicit signaling. You might consider the built-in interruption mechanism, or you may roll your own because it's very simple.</p> <p>One idea: share an <code>AtomicBoolean</code> among all the threads and let each one periodically check it. When a thread finds the answer, it flips the boolean. The best op...
Blank screen after google play-services upgrade <p>My app uses google maps for 2 years on version com.google.android.gms:play-services:5.0.89. When I try to upgrade, the app will show no GUI, just blank screen.</p> <p>Probably the same issue as <a href="http://stackoverflow.com/questions/27386937/app-runs-correctly-on...
<p>After 2 days spent copy-pasting my code piece by piece to new project I found the problem:</p> <ol> <li>my app have 2 map fragments. I used to call getMap() on each in setUpMapIfNeeded(). I have to update to getMapAsync().</li> <li>setUpMapIfNeeded() was called from onCreate() and from onResume(). This was probably...
Pass data to server via POST <p>I am trying to send data on button click with Angular 1.x.</p> <p>Here is the debug from client-side, object seems to be set correctly:</p> <p><a href="http://i.stack.imgur.com/Emjpk.png" rel="nofollow"><img src="http://i.stack.imgur.com/Emjpk.png" alt="enter image description here"></...
<p>You want to convert JavScript value to JSON string using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="nofollow">JSON.stringfy()</a>.</p> <pre><code>$httpost.post("...", JSON.stringify($scope.newItem)) </code></pre>
Error 3: Renaming files in python <p>Newbie Python question. </p> <p>I'm trying to rename files in a directory...</p> <p>the value of path is </p> <pre><code>C:\tempdir\1\0cd3a8asdsdfasfasdsgvsdfc1.pdf </code></pre> <p>while the value newfile is </p> <p><code>C:\tempdir\1\newfilename.pdf</code> </p> <pre><code>or...
<p>Can you try the following instead? You might find that renaming is easier while using a different API.</p> <pre><code>import pathlib parent = pathlib.Path('C:/') / 'tempdir' / '1' old = parent / '0cd3a8asdsdfasfasdsgvsdfc1.pdf' new = parent / 'newfilename.pdf' old.rename(new) </code></pre> <p>Using the <code>pathl...
How to build properly this query? Is this a proper MySql scheme? <p>I have this db:</p> <pre><code>* net_sales account_id (pk) date (pk) amount * refund account_id (pk) date (pk) amount * fees account_id (pk) date (pk) amount * adjustment_3rd_party account_id (pk) date (pk) amount * corporate_charges account_id (p...
<p>This looks like the problem is not in the query, but in your data. </p> <p>If you have two refunds amounts and two fee amounts for one net_sales account_id and date combination, then this query will return four rows with unique combinations for each refund row with each fee row. In other words it can explode in the...
Update a column value in a table from another table in oracle <p>I need to update the column value of old_id in table t1 with new_id column from table t2 where old_id is matching in table t2</p> <p>T1</p> <pre><code>old_id name desc ----------------------- 1 a abc 2 b def 3 c a...
<p>Try to use</p> <pre><code>update t1 set t1.old_id=(select min(t2.new_id) from t2 where t2.old_id=t1.old_id) </code></pre> <p>or</p> <pre><code>update t1 set t1.old_id=(select max(t2.new_id) from t2 where t2.old_id=t1.old_id) </code></pre> <p>To see the changes that will be made using this query</p> <pre><code...
Hiding both textfield and label in Struts2 <p>I have tried to hide both label and field in Struts 2 by using below approaches </p> <h3>Approach #1</h3> <pre><code>&lt;s:textfield style="display:none;" label="test"&gt; </code></pre> <p>It hides only textbox not the label. </p> <h3>Approach #2</h3> <pre><code>&lt;s:...
<p>The <em>Columbus' Egg</em> is: use <code>theme</code> only on the tag, not on the whole form:</p> <pre class="lang-xml prettyprint-override"><code>&lt;s:form&gt; &lt;div style="display:none;" id="test"&gt; &lt;s:label&gt;test&lt;/s:label&gt; &lt;s:textfield theme="simple"&gt; &lt;/div&gt; </...
Ulimit chnage after reboot as no effect <p>I have changed <code>/etc/security/limits.com</code> and rebooted the machine remotely, However, after the boot, the <code>nproc</code> parameter has still the old value.</p> <pre><code>[ost@compute-0-1 ~]$ cat /etc/security/limits.conf * - memlock -1 * - stack ...
<p>Please take a look at a file named <code>/etc/pam.d/sshd</code> . If you can find it, open the file and insert a following line.</p> <pre><code>session required pam_limits.so </code></pre> <p>Then the new value will be effective even after rebooting.</p> <p>PAM is a module which is related to authentication....
Efficient method of multiplying two non-sparse matrices <p>I have two matrices of type float:<br> <code>A</code> whose dimensions are 7000x100000 and<br> <code>B</code> whose dimensions are 100000x20.<br> When I multiply them my code consumes my entire RAM even though the output is small.<br> Is there a way to make t...
<p>You can try and divide into blocks:</p> <p><strong>By rows of <code>A</code>:</strong> </p> <pre><code>row_blk = 1000; C = zeros(size(A,1), size(B,2), class(A)); f = 1; t = row_blk; while t &lt;= size(A,1) C(f:t,:) = A(f,t,:)*B; f = t+1; t = min(size(A,1), f+row_blk-1); end </code></pre> <p><strong>By c...
Convert object to another object using jQuery <p>I am getting a result in my JavaScript file which I want to convert into another object.</p> <p>My original result</p> <pre><code> [ { "SName": "Set1", "Elements": [ { "Id": "3", "Name": "Name1" }, { "Id": "5", ...
<p>You could iterate the array, the <code>Elements</code> and the properties and build a new object and push it to the result set.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override">...
Require in react can't resolve path <p>I'm trying to use tracking-js library in my project I'm using react but I dont know if I'm doing anything wrong but keep showing that the module is not found, I already check my <code>package.json</code> and the module install. So this is how I require the module:</p> <pre><code>...
<p>For node, including node-based build tools, first make sure that the module is present. Keep in mind that <code>require</code> does not care about the <code>package.json</code> of your app, only about the module files being present.</p> <ol> <li>Check if <code>node_modules/tracking</code> is present. </li> <li>Make...
How to pass a string to a function <p>I want to give a string parameter to a function</p> <pre><code>function test(p) { } ...innerHTML = '&lt;div onclick="test(p)"&gt;&lt;div&gt;'; </code></pre> <p>That does not work how to do it?</p>
<p>As was mentioned in the comments, if you have a single quotation marks/ double quotation marks issue you need to use the <code>\'</code> syntax (adding a <code>\</code> sign before a special character, like <code>\'</code> or <code>\"</code>).</p> <p><div class="snippet" data-lang="js" data-hide="false" data-consol...
Execute Python scripts with Selenium via Crontab <p>I have several python scripts that use selenium webdriver on a Debian server. If I run them manually from the terminal (usually as root) everything is ok but every time I tried to run them via crontab I have an exception like this:</p> <pre><code>WebDriverException: ...
<p>Try a hardcoded Firefox binary <a href="https://seleniumhq.github.io/selenium/docs/api/py/webdriver_firefox/selenium.webdriver.firefox.firefox_binary.html" rel="nofollow">https://seleniumhq.github.io/selenium/docs/api/py/webdriver_firefox/selenium.webdriver.firefox.firefox_binary.html</a></p> <pre><code>selenium.we...
100% accuracy in classification with LIBSVM- What could be wrong? <p>I am building a model for classifying malignant breast tumors using LIBSVM. Here is the algorithm I am following:</p> <ol> <li>Use Backward-elimination for feature selection.</li> <li>Calculate C and gamma for each set of features using grid search.<...
<p>Summary: You didn't complain about the other two data sets; the 100% accuracy is reasonably consistent with those. What makes you think you <em>should</em> have a lower accuracy?</p> <p>Let's look at the counts of misclassification:</p> <pre><code>50:50 data set -- 5 / 341 errors 70:30 data set -- 1 / 205 errors ...
AlchemyLanguage Audience Analysis <p>Currently I can determine keywords and concepts of a given text using the Alchemy API. But I'm also interested in the analysis of the text's targeted audience. Specifically, I'd like to know whether the text was targeting male or female audiences; or which age groups were being targ...
<p>You could try using the <a href="https://new-console.ng.bluemix.net/catalog/services/personality-insights/" rel="nofollow">Personality Insights API</a> which analyses personality traits detected in the text. There is also a <a href="https://new-console.ng.bluemix.net/catalog/services/tone-analyzer/" rel="nofollow">T...
How to select random row from MySql after countdown is done? <p>I have a countdown script here</p> <pre><code> &lt;h2 id="countdown"&gt;&lt;/h2&gt; &lt;script&gt; var CountDownTimer; CountDownTimer = function(dt, id) { var _day, _hour, _minute, _second, end, selector, showRemaining, timer; selector = ...
<p>when you generate random number, store in session using two variable, one for storing number and another for expire time.</p> <p>Whenever user will visit your page, in backend it will be checked if value is set in session variable, if not then new value will be saved, else it will fetch number and check time. if ti...
PHP function call stopping page from loading unless it's refreshed <p>I'm running into a problem when calling a PHP function from my HTML code. My PHP code is mainly connecting to my Java server and requesting information about Twitter accounts. I'm requesting to get their profile picture's URL and their Twitter handle...
<p><strong>Both functions will include the <code>client.php</code> file, that's probably your issue.</strong></p> <hr> <p><strong>In the first page load:</strong></p> <p>The function <code>getPFP()</code> will check that <code>$_SESSION['twitterpic']</code> is not set, then include the <code>client.php</code> file.<...
how to test text value (regexp) in a nodelist (div) <p>I need to run a test to check if all my div from a given class are containing a number.</p> <p>the line I am writing in casper is : </p> <pre><code>'document.querySelectorAll(".line-1 .nb-follower")'.should.have.text(/[0-9]+/); </code></pre> <p>the console is re...
<p>You'd have to iterate, for instance</p> <pre><code>var elements = document.querySelectorAll(".line-1 .nb-follower"); var elemArray = [].slice.call(elements); var allNumbers = elemArray.every(function(elem) { return /[0-9]+/.test.elem.textContent; }); </code></pre> <p>would test each elements text, and ret...
Using STL Map & Set for reocurring words <p>I am currently working on a program that will take in files of text and organize every words into it's own value paired with how many times it occurs. I have been playing with this idea for quite some time and cannot get past the basic implementation. I am very new to using M...
<p>Say we have a <code>std::vector&lt;std::string&gt;</code> containing your words data. If we want to create a histogram of the words in this vector then using a single <code>std::map&lt;std::string, unsigned int&gt;</code> is simple and efficient via probing the map instance using the <a href="http://en.cppreference....
Wordpress theme spam links inside posts <p>I'm creating my own theme in Wordpress. Suddenly in my posts i got random links leading to viagra companies.. can't earse them. I already: </p> <ul> <li>Checked on plenty malware website scanners - all clear</li> <li>Turned off all plugins - links still appear</li> <li><stron...
<p>This happens to Drupal sites a lot, I presume the same holds true for Wordpress. </p> <p>Have a look at the root file system where your files are hosted. You'll probably see a file in there with <code>000</code> file permissions. Pretty good chance it'll be called something like page<em>nn</em>-sql.php or something...
"org.openqa.selenium.WebDriverException: Unsupported Marionette protocol version 2" error coming while running my Selenium Script with Gecko Driver <p>I have just started learning <code>Selenium</code> <code>Java</code> . I am running my script with <code>Selenium Beta 3</code> and <code>Mozilla Firefox v43</code>. Her...
<blockquote> <p>"Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver</p> </blockquote> <p>Actually <code>Selenium 3</code> supports to work with <a href="https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver" rel="...
alamofire upload array of images doesn't work <p>I need to upload an array of images with some extra text. I used Alamofire like this:</p> <pre><code> let headers = ["Authorization": "Bearer \(userToken)"] Alamofire.upload(.POST, "url", headers: headers, multipartFormData: { multipartFormData in ...
<p>I forgot to add the index to the filename this is the solution</p> <pre><code> if let pictures = pictures { for (index, image) in pictures.enumerate() { if let imageData = UIImageJPEGRepresentation(image, 1) { multipartFormData.appendBodyPart(data: imageD...
Cant return control from shouldPerformSegue when using UIAlertViewController in Swift <p>I am using below code in <strong>shouldPerformSegue</strong>. I want to stop or continue segue based on whether user selects delete or cancel. </p> <p>I noticed that segue stops due to the alert. If I remove alert then segue works...
<p>I found the answer thanks to comment by <a href="http://stackoverflow.com/users/3418066/paulw11">Paulw11</a> to <a href="http://stackoverflow.com/questions/33466275/how-to-execute-button-press-action-before-prepareforsegue-in-ios">this question</a>.</p> <p>So I deleted unwind segue from Delete bar button and added ...
Better choice than switch case? <p>Plot: I am developing a AI bot in C# which will take the input from user as voice and will perform some activity accordingly.For the recognition of which activity to perform on which audio,i am using keywords which will be stored manually as a Keywords and will act as Grammar. To achi...
<p>Something like this:</p> <pre><code> class Program { static void Main(string[] args) { //The dictionary var wordLookup = new Dictionary&lt;string, Delegate&gt;(); wordLookup.Add("Reservation",new Func&lt;bool&gt;(person_Said_Make_A_Reservation)); wordLookup.Add("Current Tim...
TCL global vs. variable access speed <p>In TCL, roughly, there are the global variables, accessible via the <code>global varname</code>, or namespace variables accessible via the <code>namespace varname</code> command.<br>My very simple checking of access time for the 2 shows a tiny, but consistent runtime access advan...
<p><strong>tl;dr:</strong> There's <em>very</em> little difference in speed between the two, not enough that you should care. Do things in a way that is semantically correct and leave it at that. Being correct <em>for your use case</em> will beat any tinkering with fractions of a percent in terms of timing.</p> <hr> ...
I'm having trouble controlling an animated svg border using CSS <p>I've been trying to animate a svg border, I've gotten as far as this </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-ov...
<p>AFAIK, the starting position of the stroke is always the starting point of the rect which is top left for a <code>rect</code> element.</p> <blockquote> <p>I can't seem to get the starting position of the border to be on the top center and then close center bottom.</p> </blockquote> <p>I think you'll need <strong...
Does Interface java.util.Map overrides hashCode() and equals() from Object class <p>As per the Java-Doc for <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html" rel="nofollow">java.util.Map</a>, the <code>hashCode</code> and <code>equals</code> methods are overridden from the <code>Object</code> class...
<p>The <code>@Override</code> annotation has special consideration for methods inherited from <code>Object</code>:</p> <p>Quoting Java Language Specification, <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.6.4.4">§9.6.4.4 @Override</a>:</p> <blockquote> <p>If a method declaration is an...
Math.Log and round number <pre><code>var result = Math.Log(1000, 10); var diff = result - 3; </code></pre> <p><code>diff</code> is about <code>-4x10^-16</code>.</p> <p>As I understood it, the exact value 3 could be stored in a double:</p> <pre><code>3 (base 10) = 1.1x10^1 (base 2) </code></pre> <p>Am I wrong or doe...
<p>I recommend using <code>Math.Log10</code> in you case</p> <pre><code>var result1 = Math.Log(1000, 10); //result1: 2.9999999999999996 var result2 = Math.Log10(1000); //result2: 3 </code></pre>
bash script to search server for specific /users/ and then delete <p>I am kind of new to bash scripting and know some of the basics. I need help creating a bash script that I can run that will search a server (or multiple servers) for a list of specific <code>/home/users</code> and then if it finds a <code>/user</code>...
<p>you're close:</p> <pre><code>#!/bin/bash while read dir; do # &lt;-- there's a change here if [[ -d $dir ]] then sudo rm -rf $dir # &lt;-- and here echo “Directory $dir found and deleted.” else echo “Directory $dir not found.” fi done &lt; userList </code></pre>
Scalatest in maven: JUnit results <p>I have a continuous integration server set up in Microsoft Visual Studio Team Services. I am able to build my code and run my tests through <strong>scalatest</strong>.</p> <p>However, I cannot figure out how to output the results in a JUnit format. I have seen many results for peop...
<p>I think I was able to figure this out. My problem was with my misunderstanding of VSTS. However, my tests were generating both the JUnit formatted test results, as well as non-JUnit formatted results. So in my build configuration I need to remove the unnecessary test result files. VSTS is not the most intuitive tool...
Cannot see the Publish options in Wordpress 4.6.1 <p>After installing Wordpress 4.6.1 I cannot post to the blog even being the Admin. So I tried creating different user types but the Publish option still remains hidden. </p> <p>I have no plugins running and the blog is on the twentysixteen theme.</p> <p>Attached Imag...
<p>Seems like something may've gone wrong during the upgrade process. Do you happen to have a backup of your site? </p> <p>I found this thread that deals with similar issues: <a href="https://premium.wpmudev.org/forums/topic/custompress-invalid-post-type-errors" rel="nofollow">https://premium.wpmudev.org/forums/topic/...
WPF DataGridCell Style Trigger based on IsSelected only works once <p>I have been trying to make single edit click for a WPF DataGrid and I have looked at a lot of solutions on stackoverflow but have an additional use case that has not been addressed. I need to setup a style trigger but I need it to not just set IsEdi...
<p>Ok. I do not understand why IsSelected doesn't work but I did find a property that does work AND let's me type into the textbox in the cell. The trick was to use IsKeyboardFocusWithin property. Here is the complete solution that works as expected:</p> <pre><code>&lt;DataGrid.CellStyle&gt; &lt;Style TargetType...
Javascript global array .push returns last added element in array <p>I am trying to retrieve en array via alert but after every click I get the same value 1 instead of more 1 after each click. I tried both with loop and without. I tried <code>var seats = new Array();</code> too. </p> <p>What I am doing wrong? </p> ...
<p>I was using <code>&lt;input type="submit"&gt;</code> and it is working after I changed it to <code>&lt;input type="button"&gt;</code> </p>
How to obtain a domNode by searching using classname instead of id? <p>I want to get a result exactly like dom.byId() returns, a domNode. However I cannot use id on my domNode. So my only other option is to search for it by class name instead of by id. </p> <p>I tried </p> <pre><code>query(".classname").first() </c...
<p>Well, If you want to access the nodes using class name.</p> <p>below is the working code -</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>require(["dojo/query", "dojo/N...
Is it possible to filter a generated Maven EAR plugin application.xml with a file filter? <p>I'm trying to filter an <code>application.xml</code> file generated by the <code>maven-ear-plugin</code> using file filters. My project structure is the standard for Maven. </p> <p>Here is my POM file:</p> <pre><code>&lt;?xml...
<p>My guess is that the order in which the plugins run does not work in your favor. </p> <p>The ear plugin creates the application.xml quite early on: <a href="http://maven.apache.org/plugins/maven-ear-plugin/generate-application-xml-mojo.html" rel="nofollow">http://maven.apache.org/plugins/maven-ear-plugin/generate-a...
Connecting to MySQL in C++ <p>I am trying to learn C++ and I am having a bit of nightmare doing a test where I connect to a MySQL database. </p> <p>I've had issues with the MySQL connector not linking properly then was getting issues related to <code>relocation truncated to fitr_x86_64_32 against symbol</code>. </p> ...
<p>You can use mysql++ library to connect to mysql from c++.<br> For that install mysql++,<br> (<strong>Ubuntu</strong>)<br></p> <pre><code>sudo apt-get install mysql-server mysql-client sudo apt-get install libmysqlclient-dev libmysql++-dev libmysqlcppconn-dev </code></pre> <p>(<strong>Mac</strong>)</p> <pre><code>...
How should I load all my javascript files that contain my controllers? <p>I am new to Angular and making a small project.</p> <p>For now, I have one large App.js where I define my route config and controllers and such.</p> <p>In my index.html file, I link to this script file and everything works fine, I have multiple...
<p>If you are worried about the fact that you will add the files manually over and over again, you could try to automate this process using <a href="http://gulpjs.com/" rel="nofollow">Gulp</a> or <a href="http://gruntjs.com/" rel="nofollow">Grunt</a> but it will take a bit of research. What I recommend, though, is usin...
Create XML text nodes in ColdFusion <p>In ColdFusion's XML DOM abstraction, there is a function to create an element, and you can set the text content of an element through a property. But I can't see how to create a snippet like this:</p> <pre><code>&lt;a&gt;some&lt;b&gt;text&lt;/b&gt;here&lt;/a&gt; </code></pre> <p...
<p>The XML document object actually uses text nodes, but doesn't show it in the dump. Try this: </p> <pre><code>a = xmlParse("&lt;a&gt;some&lt;b&gt;text&lt;/b&gt;here&lt;/a&gt;"); writeDump(a.xmlRoot.xmlNodes); </code></pre> <p><a href="http://i.stack.imgur.com/sgwYA.jpg" rel="nofollow"><img src="http://i.stack.imgur...
Spliting a double/int into 2 different values <p>Im a bit new to programming and im stuck with a few questions I have to do.</p> <p>In the questions I have to create a program which turns change (money) into "pounds:" and "pence:". How would I do this with a single double such as 154p = Pound: 1 Pence: 54.</p> <p>I a...
<p>You just need to convert the cm you obtained to m. You need to us the division operator <code>/</code> and the remainder operator <code>%</code></p> <p>As an example:</p> <pre><code> 38 = 9 x 4 + 2 38 / 9 = 4 and 38 % 9 = 2 </code></pre> <p>For more information about these, take a look at this link: <a href="htt...
Masonry div height = 0, but should adjust to search results <p>My content div's height is 0, but I want it to adjust dynamically to its children - which are position absolute. I am trying to use masonry as a way to display search results, so sometimes the content div will look like this: <a href="http://i.imgur.com/UP...
<p>For starters you could try <code>overflow: auto</code> on the content div, but I think that is the default value anyway.</p> <p>It would be nice to see your html, too.</p> <p>If you want the content div to be full height all the time (it seems like that would be a good solution) you could use something like</p> <...
How to Intercept Outbound WCF Service Calls from a .NET Web Application <p>The .NET web applications we build all integrate with a third party application through a WCF service. Every time a page loads a number of WCF service calls are made to retrieve data that are used to populate some user controls. </p> <p>Through...
<p>Use Dependency Injection instead of creating the actual WCF endpoints and passing them around. Then mocking them up is trivial. You would then use the interface and let DI take care of the rest!</p>
Can't get output from function <p>Code I currently have is </p> <pre><code>def BoxVolume(length, breadth, height): #Returns the volume of a box of given dimensions return length * breadth * height print (BoxVolume(3, 4, 5)) </code></pre> <p>I'm very new to this as its my first assignment, hence the comple...
<p>Try that:</p> <pre><code>def BoxVolume(length, breadth, height): #Returns the volume of a box of given dimensions return length * breadth * height print (BoxVolume(3, 4, 5)) </code></pre> <p>In python you have to be careful with identation.</p>
Javascript disable space scrolling <p>How do I disable space scrolling? I am making a canvas game (like agar.io) and I don't want the user to scroll down when he presses the space key, but I still want the canvas to recognize it as the user pressing space down. I am using p5.js as the canvas library.</p>
<p>This is covered in <a href="https://p5js.org/reference/#/p5/keyPressed">the reference</a>:</p> <blockquote> <p>Browsers may have different default behaviors attached to various key events. To prevent any default behavior for this event, add "return false" to the end of the method.</p> </blockquote> <p>In other w...
How to have 'details' and 'create' in same view? MVC <p>The code below (in controller) read a specific row-data from the previous page(gets <code>id</code> via <code>@Html.ActionLink("Details", "Details", new { id=item.Id })</code> inside the View)</p> <pre><code> public ActionResult Details(Guid? id) { ...
<p>First of all change your entities a little bit for configure relations between them:</p> <pre><code>public class User { [Key] public System.Guid Id { get; set; } public string UserName { get; set; } public string Password { get; set; } public string Email { get; set; } public virtual IColle...
Grouping values in an array <p>I have a numpy array of size a*2. (Typical size of a is 100). In the first column are values between x_smallest and x_largest. In the second column are the corresponding y values. Now almost all x values are unique, so I want to group them. Like the first group goes from values x_smallest...
<p>Okay, I think I solved it by myself. Here is the solution in case someone has a similiar problem and find this question:</p> <pre><code>numgroup = 5 # Number of Groups dmimax = numpy.amax(dmivsstasta[:, 0]) # Gets x_largest dmimin = numpy.amin(dmivsstasta[:, 0]) # Gets x_smallest stamax = numpy.amax(dmivsstasta[...
set class active to next slide element <p>I have a question about Javascript. You can find my HTML markup below</p> <pre><code>&lt;div class="slides"&gt; &lt;div class="slide active" id="one"&gt;&lt;/div&gt; &lt;div class="slide" id="two"&gt;&lt;/div&gt; &lt;div class="slide" id="third"&gt;&lt;/div&gt; &lt;di...
<p>Something like the below will work. Makes use of many javascript DOM properties and methods. You will need to change the names of your functions slightly as a hyphen is not valid in a name of a function. Ive replaced with underscores.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" ...
MySQL Group_Concat still truncating results after group_concat_max_len is increased <p>I'm dynamically pivoting a table in MySQL (well in php but 1 step at a time).</p> <p>My concat looks like such:</p> <pre><code>SELECT GROUP_CONCAT(DISTINCT CONCAT('MAX(IF(name = "', p.name,'",te.hours, 0)) AS "', p.name, '"')) FR...
<p>What tools / languages are you using?</p> <p>It is quite usual for e.g. phpMyAdmin to show the text truncated in row view and only the full text when viewing a record.</p>
store value in javascript after page load? <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#divid1").click(function(){ $("#divid1").hide(); //want this to keep hidden aft...
<p>Try <code>localStorage</code>.</p> <p><strong>Set item</strong></p> <pre><code>localStorage.setItem('selectedId', 100); </code></pre> <p><strong>Get item</strong></p> <pre><code>localStorage.getItem('selectedId'); </code></pre> <p>Finally, <strong>Remove item</strong></p> <pre><code>localStorage.removeItem("se...
lsnrctl start rane when i fireing this command this error comeing <pre><code>[oracle@myserver ~]$ lsnrctl start rane LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-SEP-2016 23:04:58 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /oraeng/app/oracle/product/11.2.0/bin/tnslsnr: please wait.....
<p>The port number you have specified is not valid. The usual port number for a listener is 1521, but if you want to use a different value it still has to be in the valid range, with a maximum of 65535, and avoiding the well-known ports up to 1024. The number you have tried to use, 152101, is well outisde the allowed r...
How to find all non duplicated items in an array of Strings? <p>I want to find all non repeating items in an array of Strings.<br> Suppose I've:</p> <pre><code>String[] str = {"Red", "Red", "Green", "Green", "Blue"}; </code></pre> <p>I'd like to find <em>"Blue"</em> as it is not repeating again.</p> <p>How can I ach...
<p>One of the solution is to create the Map with String as a key and Integer as the value. You will have to iterate through the array and increase the amount of the String in a map.</p> <pre><code>String[] str = {"Red", "Red", "Green", "Green", "Blue"}; Map&lt;String,Integer&gt; stringsCount = new HashMap&lt;String,In...
RNImageToBase64 native module crashes for a URL <p>I am trying to convert a React Native Asset into an Base64 image.</p> <p>There is a React Native library for that implemented in NativeModules, but it crashes the native iOS app upon executing <code>getBase64String(url, callback)</code>.</p> <p>Example URL sent to <c...
<p>The problem was that it was trying to access images in the Assets Library.</p> <p>My solution consists of a bit modified version of the <code>RNImageToBase64</code> module that works with the file paths on disk.</p> <pre><code>#import "RNImageToBase64.h" #import &lt;AssetsLibrary/AssetsLibrary.h&gt; #import &lt;UI...
Is there WM_QUERYHIDE/CLOSE or similar message? <p>I have a top-level window that was created with <code>WS_POPUP</code> / <code>WS_EX_APPWINDOW</code> so it uses non-standard frame and its caption appears on taskbar. Yet I have custom <code>WM_NCHITTEST</code> handler if that matters. </p> <p>When the window is "col...
<p>You can try to add WS_MINIMIZEBOX to the window style like this: WS_POPUP | WS_MINIMIZEBOX.</p>
concatenation using '+' symbol gives me error "Conversion failed when converting the varchar value 'current quarter' to data type int." <p>i'm trying to concat few strings using + symbol... when i use concat function it is working fine but when i use '+' symbol to concat the strings it throws an error.</p> <p>Anyone ...
<p>Obviously something is not a string. That would be the <code>TimeDimension_Year</code> column. So: </p> <pre><code>SET @VAR1 = (SELECT CAST(MIN(TimeDimension_Year) as varchar(255)) FROM TimeDimension_LU WHERE TimeDimension_TimeDimensionType_ID = 15 ) + '-' + 'current quarter'...
Multiple Minimums in R <p>I am trying to find the values which contribute the most and least to a Guassian Kernel Density estimator. I've written a function to find these, but I'm getting multiple values for a max when I run it. I thought this might be related to the number of significant digits, so I increased those b...
<p>I think the correct code should be like the following (with 2 modifications, the indexing in the for loops were incorrect that resulted in wrong z and kernel values):</p> <pre><code>kern&lt;-function(data=0,effOf=0,bw=0){ z&lt;-rep(0,length(data)) k&lt;-rep(0,length(data)) for(i in 1:length(data)){ # iterat...
Make notifications response when the job is completed <p>I am using Symfony framework3 with Pheanstalk bundle and Doctrine. I creating the event which sends data to beanstalk. The other SF app on the different server perform a job and update notification status on the first SF app to completed. How can I check when the...
<p>1) It would be good with WebSockets as that doesn't involve while(true) loop. A websocket can be opened by the frontend after a task has been submitted for processing. After the job finished processing it would notify the server side of the websocket to relay the info back on the socket for the frontend.</p> <p>2) ...
Can't access blob storage via azure-storage package in Python WebJob <p>I am trying to read/write from blob storage using a Python WebJob on an Azure App Service. My App Service's requirements.txt file includes the azure-storage package name: the package is successfully installed via pip during App Service deployment. ...
<p>Looks like six module is missing. This issue is also tracked via this thread: <a href="https://github.com/Azure/azure-storage-python/issues/22" rel="nofollow">https://github.com/Azure/azure-storage-python/issues/22</a>. You can fix issue by adding the six module to requirements.txt or manually installing six module...
uploading and saving a file in php <p>I am trying to upload a file and save it in a folder. It prints: successful but the file is not in the destination folder. Do I give any sort of permissions? How do I give them? Also how do I specify destination folder path, i.e do I use \ or / ? </p> <pre class="lang-php prettypr...
<p>It's a small issue I think. I believe this line:</p> <pre><code>move_uploaded_file($file_tmp,"/uploads".$file_name); </code></pre> <p>should be tweaked ever so slightly to:</p> <pre><code>move_uploaded_file($file_tmp,"/uploads/".$file_name); </code></pre> <p>because the filename (I would guess) does not have a l...
How do I get pointer to beginning of a page <p>How do I get a pointer to the beginning of a page?</p> <p>I tried the following to no success:</p> <pre><code>#define PAGESIZE 4096 bool is_page_aligned(void *p) { return !((long int)p &amp; 0xFFF); } int main(void) { bool res; void *buffer; bu...
<p>To get the address of the beginning of the page containing the address <code>a</code>, divide by the page size and then multiply by the page size.</p> <pre><code>long int page_beginning = PAGESIZE * (a / PAGESIZE); </code></pre> <p>This works because of the truncation performed during integer division.</p> <p>You...
Using Bootsfaces Datatable- Not able to use dataTableColumn <p>I m using Bootsfaces0.9.1. When i try to use the bootsfaces datatable as suggested in showcase, i am not able to use b:dataTableColumn tag. It says that the "value" attribute is not defined in b:dataTableColumn tag.</p> <pre><code>&lt;b:dataTable value="#...
<p>Actually, that's a bug (or feature) of Netbeans. The application works, but your IDE shows an error (or a warning). Either use BootsFaces-0.9.2-SNAPSHOT (see <a href="https://github.com/TheCoder4eu/BootsFaces-OSP/issues?utf8=%E2%9C%93&amp;q=369" rel="nofollow">issue #369 on the BootsFaces GitHub repository</a> to se...
Issue in handling pipe delimited flat files,each field within double quotes. What can be a solution here <p>I have to handle pipe delimited flat files, in which each field comes within double quotes.</p> <p>sample data:</p> <pre><code>"1193919"|"false"|""|"Mr. Andrew Christopher Alman"|""|""|"Mr." </code></pre> <p>I...
<p>you can use <code>gawk</code>'s <code>FPAT</code> variable to define quoted fields</p> <pre><code>$ gawk -v FPAT='[^|]*|"[^"]*"' '{print $1}' </code></pre> <p>and add your logic around the number of field etc.</p>
How can I remove the span wrapper in Contact form 7? <p>I use <a href="http://contactform7.com/" rel="nofollow">http://contactform7.com/</a> in my WP theme.</p> <p>Now I have:</p> <pre><code>&lt;span class="wpcf7-form-control-wrap name"&gt; &lt;input type="text" name="name" value="" size="40" class="wpcf7-form-cont...
<p>You can remove the span wrapper using jQuery:</p> <pre><code>$("#name").unwrap(); </code></pre> <p>It will remove input's parent element, so in this case it will remove the span. Please note that after removing the span, some Contact Form 7 features may not work correctly. For example validation may not work.</p> ...
Dockerfile: why doesn't the bash command work? <p>I'd like to learn the Dockerfile from a very simple start, so here's my Dockfile:</p> <pre><code>FROM ubuntu ENTRYPOINT /bin/bash </code></pre> <p>however, after building the image and run the container, I find that I can't run the bash commands. For example, if I typ...
<p>How are you running the container? Note that you have to pass the options <code>-i</code> in order to keep STDIN open and the <code>-t</code> to allocate a pseudo-TTY.</p> <p>Below you can find an example:</p> <blockquote> <p>docker run -i -t my-image</p> </blockquote>
Coding zero values into a data frame <p>I am working in R with a series of data values that have an x position (distance along a transect) and a z position (distance from the ground for a given x position). There is not a data value measurement at each x, z coordinate, to do the analysis that I need to perform, I need ...
<p>In R you would do it much the same way as you describe in Matlab. First, create a matrix with all zeroes:</p> <pre><code>df &lt;- data.frame(x, z, value) mat &lt;- matrix(0, 4, 8) </code></pre> <p>And then the tricky part, where you have to create a vector of the selected elements</p> <pre><code>mat[cbind(df$x, ...
Can't assign values to cv::Mat inside function <p>I need to create a <code>Mat</code> object of type <code>CV_32FC2</code> to store coordinate points contained in a <code>KeyPoint</code> structure. I want to do it inside a function for clarity.</p> <pre><code>void myfun(vector&lt;KeyPoint&gt;&amp; k){ Mat p1_dist(...
<p>First you need to return the matrix you create. To conform to OpenCV, you can pass a reference to <code>Mat</code>:</p> <pre><code>void myfun(const vector&lt;KeyPoint&gt;&amp; k, Mat&amp; p1_dist){ ... } </code></pre> <p>Then you need to access the data values with the correct template. If you need a <code>CV_32FC...
How to create a loop in Access 2013 VBA to change theme <p>I am converting databases from .mdb to .accdb. In order to utilize the themes in Access 2013, I need to find a way to loop through all the controls on a form and set the theme. How would I perform this loop? </p>
<p>Looping through controls on a form can be done like this:</p> <pre><code>dim ctl as control for each ctl in me.controls 'Do things ctl.tag="example" next ctl </code></pre>
Facet based on field or element range index <p>I have an xml file like below</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;document-envelope xmlns="http://abc/content-repo/envelope"&gt; &lt;metadata xmlns="http://abc/content-repo/metadata"&gt; &lt;name&gt;48363ff1d9e0a48dc9e578f0f4519564628fdbb...
<p>If you want to have separate facet counts for each delimited value, then I think you will have to create separate elements. If you only care to count number of matches for that <em>combination</em> of values, then you could build a custom constraint (assuming you are using Search API), and parse them at query time. ...
Regex Negative Lookbehind Matches Lookbehind text .NET <p>Say I have the following strings: </p> <pre><code>PB-GD2185-11652-MTCH GD2185-11652-MTCH KD-GD2185-11652-MTCH KD-GD2185-11652 </code></pre> <p>I want REGEX.IsMatch to return true if the string has MTCH in it and does not start with PB.</p> <p>I expected the r...
<p>You need a lookahead: <code>^(?!PB)\S+(?=MTCH)</code>. Using the look-behind means the <code>PB</code> has to come before the first character.</p>
Razor, HTML, jQuery: How to check/uncheck all checkboxes? <p>I have the following code in <strong>Razor and HTML</strong>:</p> <pre><code> @:&lt;td&gt; &lt;input class="privcheck" type="checkbox" name="selectedPrivileges" value="@priv.PrivilegeID" ...
<p>i would suggest using <a href="http://api.jquery.com/prop/" rel="nofollow"><code>prop()</code></a> instead of <code>attr()</code></p> <pre><code>$(document).on("click", "#checkallprivs", function (event) { event.preventDefault(); $('.privcheck:checkbox').prop('checked', true); }); $(document).on("click", ...
Swift: Assign delegate class when delegator class isn't a direct child? <p>I am making an app that uses a set of drill-down tables, each with their own TableViewController, so my storyboard is set up with a MainViewController that has a segue to a TableViewController (MainTable) which has a segue to another TableViewCo...
<p>You may pass your delegate to the MainTable and assign it there when creating SubTable. Create a field in your MainTable to store it</p> <pre><code>var subTableDelegate : delegate? </code></pre> <p>in MainViewController:</p> <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let de...
What is a simple way to Cache a List (or other Collection) in Java <p>I have a Collection in the form of a List pulled out of the database that will never change once it is pulled; every user in the system will see the same thing. I have been trying to figure out the simplest way to cache it. I know I can use CacheBuil...
<p>From @BenManes above, I used Suppliers.memoize:</p> <pre><code>private Supplier&lt;Collection&lt;Person&gt;&gt; cache = Suppliers.memoizeWithExpiration( new Supplier&lt;Collection&lt;Employee&gt;&gt;() { public Collection&lt;Employee&gt; get() { return getAllEmployees(); ...
build a path tree for URIs <p>I have a list of URIs for which I need to create a tree/object structure. For example here is the URIs</p> <pre><code>/api/abc/xyz/abc/cde /api/xyz/abc/d3/d2 /api/abc/cde/d3/d2 /api/abc/cde/d1/d2 </code></pre> <p>The result tree should look like this</p> <pre><code>{ api: { ...
<pre><code>var string="a/b/c"; keys=string.split("/"); var obj={}; var index=obj; for(let i=0;i&lt;keys.length;i++){ index=index[keys[i]]={}; } </code></pre> <p>Obj should now contain the string as an object. You can repeat that with multiple atrings</p>
C++ how to validate input for use with overloaded >> operator <p>I am writing a program that can do operations on complex numbers. I have a class called ComplexNumber that has the overloaded operators in it. My program takes input from a file in the form of <code>complex *operator* complex</code>. So, for example an in...
<p>Normally I'd do this with a state machine. Never done it with C++ streams before. Bit sneakier than it looked, but basically the same. Commentary on the whats and whys embedded as comments in the code.</p> <pre><code>#include &lt;string&gt; #include &lt;iostream&gt; #include &lt;sstream&gt; #include &lt;cmath&gt; #...
Android Activity Slow transition <p>I want to remove the old activity from stack after clicking on a button that triggers an intent to a new activity. The problem is: The transition is not smooth like a normal transition. For like a half second the screen is completely white. How to make this smooth?</p> <pre><code>bu...
<p>Use: <code>Activity.overridePendingTransition().</code> Define simple transition animations with XML file.</p> <p>Remmember this 4 atributes:</p> <pre><code>android:interpolator="@android:anim/accelerate_interpolator" android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="2000" </code></pre> <p>This a...
explanation of haskell function <p>The code I am looking at contains this top level function:</p> <pre><code>starman :: String -&gt; Int -&gt; IO () starman word n = turn word ['-' | x &lt;- word] n </code></pre> <p>I can see that this is a function that takes 2 arguments and then calls the turn function that looks l...
<p>The full line is:</p> <pre><code>starman word n = turn word ['-' | x &lt;- word] n </code></pre> <p><code>turn</code> is called with three parameters:</p> <pre><code>word ['-' | x &lt;- word] n </code></pre> <p>The middle one is the one you're having trouble with. It can be read as: "a hyphen for each character ...
Is there @minApi annotation, analogous to @TargetApi annotation in Android? <pre><code>int API_VERSION = 21; </code></pre> <p>@TargetApi(API_VERSION) is used in Android to specify that the method/class is supported for API_VERSION and below.</p> <p>Can we mirror something similar which specifies that a method or clas...
<p>There is <a href="https://developer.android.com/reference/android/support/annotation/RequiresApi.html" rel="nofollow"><code>@RequiresApi</code></a>:</p> <blockquote> <p>Denotes that the annotated element should only be called on the given API level or higher.</p> <p>This is similar in purpose to the older @T...
Upload Images With Aurelia to Express/Multer Api <p>Implementing an Image/File-Upload into my aurelia App. The Express Api works and successfully receives Files and Images using Multer Plugin, tested with Postman.</p> <p>Now I'm trying to figure out, how to attach the files ot the Aurelia Http/Fetch-Call. Somehow the ...
<pre><code>uploadImagesApi(images) { let formData = new FormData() for (let i = 0; i &lt; images.length; i++) { formData.append('images', images[i]); } return http.fetch(url + "/", { method: 'put', body: formData, }) ....
Encoding issue for sending data via java socket? <p>I have the following code. I can do the reading all well and convert data into hex. The issue is when I send back <code>String replyMessage = "7E81";</code>, the device receives it as <code>"3745"</code>. What is wrong? Is it due to my encoding, or do I need to do s...
<p>Based on comments in chat:</p> <blockquote> <p>the documentation say </p> <p>Start Byte (1 Byte) 7e<br> Message ID (2 Byte) 01 00<br> Message Body Nature (2 Byte) 00 19<br> Phone no. of Device (6 Byte) 09 40 27 84 94 70<br> Message Serial number (2 Byte) 00 01<br> Message Body (N Byte) 00 00 00 00...
React component being rendered with old props <p>I have the following component: </p> <pre><code>var Answer = React.createClass({ getInitialState: function(){ return {edit: false, comments: []} }, componentWillMount: function(){ $.ajax({ context: this, method: 'GET', url: '/answer...
<p>Alright I figured it out after some thought. The problem was that <code>render</code> is being called before <code>componentWillMount</code>, so the child component <code>Comments</code> was being rendered with the initial props the first time, so I needed to let the child component know that it will receive new pro...