input
stringlengths
51
42.3k
output
stringlengths
18
55k
Finding the 5 most common words in a text <p>I have a school task where a part of the task asks us to make a method that finds the 5 most commons words in a .txt file. </p> <p>The task asks us to put all the words in an ArrayList, which i have already done. The real problem is making the program print out the top 5 w...
<p>Iterate through the ArrayList, for each word in the list, put the word into a HashMap where the key is the word and the value is an Integer which you will increase every time you find the word again. At the end iterate through the HashSet and find the top 5 integers. Print those found words.</p>
D3.js SVG image bounding box offset <p>I am attempting to fill a div with an svg image using D3.js. So far I have been able to center my image and watch it scale as I grow and shrink the browser window. However when attempting to dynamically find the bounding box of image I can only find the top,left properties of the ...
<p>Your approach isn't going to work. By setting the image width/height to <code>100%</code>, the image element will always be positioned at <code>[0,0]</code>. If you know the pixel size of how you want the image to display, you can do something like this:</p> <p><div class="snippet" data-lang="js" data-hide="false...
How to bind dropdown list in angularjs from JSON string array <p>I am trying to bind a dropdown list from JSON string attach below but my last value of JSON is getting override with all values . I have tried to console and I have received individual values in console but while binding i m unable to do it. I have used s...
<p>solved this I was foolish to form another array which is running out of sync that's why it was not binding properly so bind it to $scope.groups[i].items.push({id:itemid.menu_item_id,name:itemid.item_name}); instead of forming one more foreach</p>
Inno Setup installator has wrong text encoding <p>My installator (Inno Setup) has a bad Russian text encoding for the some Windows installations. All machines have Windows XP SP3 (English version), but on some this works, some does not have. </p> <p>There are any settings on Windows to fix it?<br> Thanks</p>
<p>My guess is that you are using the Non-Unicode version of Inno Setup. The machines, where the installer has wrong encoding, probably do not have the Russian set as the legacy (non-Unicode) encoding.</p> <p>In Windows XP Control panel, check the <em>"Regional and Language Options"</em>. There on the <em>Advanced</em...
Inline SVG background image does not work in React.js <p>I have a component that should provide a div with a dot grid pattern. </p> <p>The function that should do the work looks like this:</p> <pre><code>drawSquareDotGrid(distance, unit, colour){ var newGrid = "data:image/svg+xml;utf8,&lt;svg width=\""+...
<p>As @Kaiido pointed out URI should be encoded with <code>window.encodeURIComponent</code>. Also there were missing xlmns and viewPort information in the SVG header.</p> <p>Fixed code looks like this:</p> <pre><code>drawSquareDotGrid(distance, unit, colour){ var prefix = "data:image/svg+xml;charset=UTF-8," ...
Passing dynamic argument on onClick inside for does not work <p>Following react code does not work.'select' function is always called with 10 instead of assigned values.</p> <pre><code> select( x ) { alert( x ); // Always alerts 10. } render() { var AllData = []; for( var i = 0; i&lt;10 ;...
<p>Since you are using ES2015 <em>arrow function</em> notation, I'd suggest to just replace <code>var</code> by <code>let</code> for your loop variable initialization. That way you have a true <em>block scope</em>, otherwise you have to deal with <em>function scope</em> which is the root of your trouble here.</p> <pre...
Multiple NullPointerExceptions with ResourceBundleEditor in Eclipse Neon <p>Fresh Spring Tool Suite 3.8.2 (Eclipse Neon 4.6.1) with ResourceBundleEditor installed.</p> <p>When opening <code>.properties</code> files, multiple <code>NullPointerException</code>s pop up.</p> <blockquote> <p>java.lang.NullPointerExcepti...
<p>Remove the JSDT Chromium debugger, more specifically, remove files <code>org.eclipse.wst.jsdt.chromium.debug.*</code> from Eclipse plugins directory.</p>
How can I get the same result as java function getBytes() use PHP? <p>My Java code is like this:</p> <pre><code>public void trans() { try { byte[] test = "测试".getBytes("utf-8"); for(byte b:test){ System.out.println(b); } } catch (UnsupportedEncodingException e) { ...
<p>In PHP you might want to use this function for that</p> <pre><code>$result = mb_encode_numericentity('测试test', [0, 0x10FFFF, 0, 0x10FFFF], 'UTF-8'); echo htmlentities($result); </code></pre> <p><a href="http://php.net/manual/en/function.mb-encode-numericentity.php" rel="nofollow">http://php.net/manual/en/funct...
MapReduce java.lang.ArrayIndexOutOfBoundsException: 0 <p>I try to run a mapreduce in java, but get this error.</p> <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at com.mapreduce.WordCount.run(WordCount.java:23) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java...
<p>You need to launch your program <strong>with arguments</strong> corresponding to the input path and the output path, so your launch command should be of the next format:</p> <pre><code>java -cp &lt;my-classpath-here&gt; com.mapreduce.WordCount &lt;input-path&gt; &lt;output-path&gt; </code></pre>
LINQ retrieve statement didn't return latest updated result <p>I have a table called Organization and a table called Staff. </p> <p>Inside the Staff table I've got 2 fields which are </p> <ul> <li>StaffStatus to indicate whether he/she is available for the organization and </li> <li>ParentStatus to inidicate whether ...
<p>So I find the solution to refresh my database with the current value.</p> <pre><code>Friend Function getUserByID(strInput As String) As Staff objUser = (From userDB In db.Staffs Where userDB.UserID = strInput).FirstOrDefault() db.Refresh(RefreshMode.OverwriteCurrentValues, objUser) getUse...
How to update only status on a Button click using in SQLite in android <p>I am developing a SQLite database. I created a table which schema is: name, image, isselected.<br> The initial status of a message is 0.<br> I am updating the status on a Button click by using the <code>setStatus()</code> method on the database....
<p>You did not pass the id which row you want to update (or you want to update all rows?), ISSELECTED variable is not declared. I mean this line:</p> <pre><code>sqldb.update(TABLE_PEOPLE, cv, "id=" + ISSELECTED, null); </code></pre> <p>I would write like this (now I can't test it). I would pass the selected id to the...
make a sum of variable cells <p>i need your help with writhing a code. Below you can find an example of my sheet.<br> I need to add the values of the totals from the subs and the result needs to come in the cell next to subtotaal in the main block. But here is the catch, the number of subs are not always the same. That...
<p>I'm assuming your first Main block is in row 3; if not, modify this as appropriate:<br> <code>=SUM(OFFSET($K4,0,0,MATCH("Main",$B4:$B1000,-1),1))</code></p> <p>This formula will sum all the values in a particular range; the <code>OFFSET</code> function builds the range. It starts from a defined reference cell - K4,...
Find out the letter frequency in from a list in Python <p>I'm trying to code a program that will count the occurence of different chars in a list. I want to find the 7 most common once and also want to count the % of the occurence of that letter of the total amount of letters.</p> <pre><code>fileOpen = open("lol.txt",...
<p>You can use <a href="https://docs.python.org/2/library/collections.html#collections.Counter.most_common" rel="nofollow"><code>most_common</code></a>, and then loop on the list to get the values :</p> <pre><code>In [35]: s = 'ieufisjhfkdfhgdfkjvwoeiweuieanvszudadyuieafhuskdjfhdviurnawuevnskzjdvnziurvzdkjHFiuewhksjnv...
Reading another Clojure program as a list of S-Expressions <p>Suppose I have a very simple <code>.clj</code> file on disk with the following content:</p> <pre><code>(def a 2) (def b 3) (defn add-two [x y] (+ x y)) (println (add-two a b)) </code></pre> <p>From the context of separate program, I would like to read the ...
<pre><code>(import '[java.io PushbackReader]) (require '[clojure.java.io :as io]) (require '[clojure.edn :as edn]) ;; adapted from: http://stackoverflow.com/a/24922859/6264 (defn read-forms [file] (let [rdr (-&gt; file io/file io/reader PushbackReader.) sentinel (Object.)] (loop [forms []] (let [fo...
Printing out 500 random triangles in java <p>I have a problem with printing 500 triangles in window.</p> <p>The code I created shows one traingle and it only changes while I'm resizing window, and I have to make all 500 traingles appear at once. Any idea how to do this?</p> <pre><code>import javax.swing.*; import jav...
<p>Move the generation of the random numbers to the body of the loop. Otherwise you'll draw the same triangle 500 times:</p> <pre><code>for(int z = 0; z &lt; 500; z++) { int x1 = nmb.nextInt(200) + 1; int x2 = nmb.nextInt(200) + 1; int x3 = nmb.nextInt(200) + 1; int x4 = nmb.nextInt(500) + 1; int ...
cocos2d-x v3 c++ Drop shadow cocos2d::Sprite <p>As far as I've found out, cocos doesn't offer a simple filter handling like AS3 for example does.</p> <p>My situation: I want to add a realtime shadow to an cocos2d::Sprite.</p> <p>For example I would like to do something like this (similar to AS3):</p> <pre><code>auto...
<p>There isn't any built in support for shadows on <code>Sprites</code> in Cocos2D-X.</p> <p>The best option, performance-wise, would be to place your shadows in your sprite images already, instead of calculating and drawing them in the code.</p> <p>Another option is to sub-class <code>Sprite</code> and override the ...
Select value with check if between two values <p>I have the following table in excel:</p> <pre><code> 0 1150 0.27 1151 1200 0.26 1201 1250 0.24 1251 1300 0.24 1301 1350 0.23 1351 1400 0.22 1401 1450 0.21 1451 1500 0.2 1501 1550 0.2 1551 1600 0.19 </code></p...
<p>Assuming your table starts on <code>Column A</code> and the value you mentioned is in <code>I24</code>:</p> <pre><code>=IF(AND(I24&gt;A24,I24&lt;B24),C24, "") </code></pre>
Undefined reference to 'testing::UnitTest::GetInstance()" <p>I am migrating from the makefile automatically created by Eclipse to a manual makefile. It does work with Eclipse's, but not with mine. This is the compiler output:</p> <pre><code>13:54:30 **** Incremental Build of configuration Debug for project MY_PROJECT ...
<p>Keep in mind that for -l flags, the order is very important. Are you sure the -lgtest is in the correct position ?</p> <p>Also, the linker expects a libgtest.so file for -lgtest, not just gtest.</p> <p>Hope it helped. </p>
ASP.NET DefaultButton is focused on page load <p>I'm setting the propriety <code>DefaultButton</code> on my asp form, in order to send the form on the key <code>Enter</code>.</p> <p>Everything is working fine, but my button has the focus state on the page load which is bothering because of some CSS styles applied on t...
<p>This is the default behavior of default button in ASP.NET. What you can do to override that is to set default focus manually on some other control. To do so, call <code>Page.SetFocus</code>:</p> <pre><code>Page.SetFocus(SomeOtherControlID); </code></pre> <p>This will set focus control on the form like that:</p> <...
How to return Any from a function? <p>I am working on type system for a database project. One problem is mapping a type id to a reader that given an type id and address, a function can return given any data type from built in <code>u32</code>, <code>String</code>, to defined structs. </p> <p>I don't have any problem o...
<p><a href="https://doc.rust-lang.org/std/any/trait.Any.html"><code>Any</code></a> is a trait, which means that it is unsized and thus cannot be returned by a function as is.</p> <p>However, you can try boxing it:</p> <pre><code>fn get_val (id:i32, mem_ptr: usize) -&gt; Option&lt;Box&lt;Any&gt;&gt; { match id { ...
Making a countdown timer that doesn't interrupt the entire program? <p>So I'm trying to make a reaction game where you press start button, a hidden timer that will countdown to zero from a random number between 1 &amp; 10 seconds. Most answer regarding java timers recommend using </p> <blockquote> <p>Thread.sleep(10...
<p>You can't just use <code>Thread.sleep()</code>, it won't work as you think it does. Instead, you can use <a href="https://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html" rel="nofollow"><code>javax.swing.Timer</code></a> which is made to do what you're trying to do.</p> <p>Some notes from the docs (if you ...
How Do I Implement a Popover in a Rails Partial Using Bootstrap 3? <p>I currently have a Rails 4 application running Bootstrap 2 (gem twitter-bootstrap-rails 2.2.8). I was successful in implementing a popover using partials where a map is displayed when a link is clicked. Here is the code that I have.</p> <p>applicati...
<p>I kept looking at this and realized that in <code>application.js</code> I required turbolinks. For whatever reason it messes up things I try to do. I removed <code>//= require turbolinks</code> and my scripts work again. Go figure.</p>
vba to get email senders details from GAL <p>I am trying to get the email senders's details (eg. name, job title, dept etc) from a folder. I am able to get required details for the conacts in my address book, however I am not getting details about the contacts in GAL.</p> <p>My code is as below:</p> <pre><code>Public...
<p>I am using the following function</p> <pre><code>Private Function getSmtpMailAddress(sMail As Outlook.mailItem) As String Dim strAddress As String Dim strEntryId As String Dim objRecipient As Outlook.Recipient Dim objSession As Outlook.NameSpace Dim objAddressentry As Outlook.AddressEntry Di...
Is not less than "value" vb.net <p>I want to add another logical condition. Which is "is not less than 1".</p> <pre><code>If DataGridView1.Item(6, i).Value &lt;= 90 Then </code></pre>
<p>"Is Not less than" you mean "Greater than or equal to?" i.e., `>='</p> <p>So:</p> <p><code>If DataGridView1.Item(6, i).Value &lt;= 90 And DataGridView1.Item(6, i).Value &gt;= 1 Then</code></p>
Apache POI generating document and sorting inside <p>I am trying to '<em>group</em>' my transactions by a 'transactionBatch' parameter. I see that my HashMap is successful in gathering unique batches. When I debug the below code everything seems to be done correctly. Although when I check the excel file, transactions a...
<p>The problem was in this line: </p> <pre><code>HSSFRow dynamicRow = spreadSheet.createRow(i + 2); </code></pre> <p>I had to assign another variable outside of the for method to keep a int:</p> <pre><code>int rowNumber = 2; </code></pre> <p>and then just increase its value with each row. </p> <pre><code>HSSFRow d...
Google Chart IE9 Issue (undefined) <p>I'm developing some charts for use across all supported browsers and am getting an error only in IE9. Console states either: gvjs_wa is undefined, gvjs_t is undefined or gvjs_uz is undefined.</p> <p>Thanks!</p> <pre><code>&lt;HTML&gt; &lt;head&gt; &lt;script src="https://www.gsta...
<p>i've seen questions in the past where jquery conflicts with google charts,<br> specifically with the <code>setOnLoadCallback</code> method </p> <p><a href="http://stackoverflow.com/q/35304392/5090771">google.setOnLoadCallback not able to get the document elements</a><br> <a href="http://stackoverflow.com/q/3545409...
add a loading animation until a specific javascript finish loading <p>I have an external JavaScript src which I want to add a loading animation until it's finish loading:</p> <pre><code>&lt;script src="https://xxxx.domain.com/xxx.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>I'm currently using jQuer...
<p>Hopefully this works:</p> <pre><code>&lt;script src="https://xxxx.domain.com/xxx.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; hideLoadingThingy(); &lt;/script&gt; </code></pre> <p>The second script should run after the first one finishes loading. This is because it is inc...
Custom message on completed order status email notification only for customer user role <p>I would like to improve this code from <a href="http://stackoverflow.com/questions/38975742/displaying-a-coupon-message-on-emails-for-completed-order-status-only/38976146#38976146"><strong>this answer</strong></a>, to display a m...
<p>To enable this custom message on email notification for complete order status and <strong>just for 'customer' user role</strong>, you have to get the user data related to the order, to get the user role. Then you will use it in your conditional.</p> <p>Here is the code:</p> <pre><code>add_action( 'woocommerce_emai...
Android: get displayed text from textview in signle line only available <p>I have single line textview. I am setting string in it. Sometimes full string not possible to display. So I just want that string which is displayed. </p> <pre><code>TextView valueTV = new TextView(context); // valueTV....
<p>I thanks both @Andriy and Sujith for helping. Mix of both answers worked for me.</p> <pre><code>ViewTreeObserver vto = valueTV.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override ...
Eclipse Neon + JBossTools + Maven results on error: No compiler is provided in this environment <p>I'm having some problems when trying to install <code>wildfly.swarm</code> addon (<a href="https://github.com/forge/wildfly-swarm-addon" rel="nofollow">https://github.com/forge/wildfly-swarm-addon</a>) through <code>JBoss...
<p>I'm facing the same problem. I can run mvn install on command line, but not in eclipse. You can temporarily fix this problem by adding this in pom.xml</p> <pre><code> &lt;plugin&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.1&lt;/version&gt; ...
Modeless Dialog in App::InitInstance() <p>My application needs to create some expensive stuff in <code>InitInstance()</code>. I want to inform the user about the progress so i decided to create a modeless dialog in the <code>InitInstance()</code> method. </p> <p>My problem is, the dialog is not drawn. It updates just ...
<p>It sounds like your “expensive stuff” is compute bound and not allowing the update of any UI thread(s). These types of problems are typically resolved by utilizing a separate thread to provide the progress feedback. You may want to have a look at <a href="http://www.codeproject.com/Articles/552/Using-Worker-Th...
Error 2762 when executing installer (WixCloseApplications) - worked with WiX 3.10.0.2103 <p>I have a problem with my installer that uses WiX.</p> <p>I updated to WiX 3.10.3.3007 some time before and if I try to build an installer with VS 2015. I now get strange errors during the installation. The build itself works an...
<p>The code with:</p> <p>util:CloseApplication Id="CloseApp" Target="myapp.exe" RebootPrompt ="no"</p> <p>is generally the right way to do it, depending on the options you want to use. That's the issue that needs analyzing, but it appears that you went ahead and tried to create your own custom action to call, and tha...
Populate jQuery array with contents of CSV using PHP <p>I'd like to populate my <code>data</code> array with the contents of a CSV file using PHP.</p> <p>My current code:</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-3.1.1.js" integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA=" crossorigin=...
<p>each time you print a line you override the previous one. Also you're using jsonencode with a nonarray I think thats why it gives you false, try this:</p> <pre><code>$file = fopen('food.csv', 'r'); $allfile = []; while (($line = fgetcsv($file)) !== FALSE) { print_r($line); $allfile[] = $line; } fclose($file); ?...
Can redux be seen as a pub/sub or observer pattern? <p>I just try to get my head around react.js, that being said, I just finished a few tutorials on the web. I am completely new to redux, wich is part of some videotutorials I watched. The more I dive into it, the less it makes sense to me in terms of redux replacing t...
<p>Redux is not supposed to "replace the initial idea of react.js", think of it more like a library to managed shared state between components and to coordinate state mutations. Redux does use a pub/sub pattern indeed, see the store methods here: <a href="http://redux.js.org/docs/api/Store.html#store-methods" rel="nofo...
Display data from SQLiteDatabase in a listView <p>I can currently display my data from the databas in a normal TextView. But I now want to display the rows in the database in a listview, I've tried to do this with a cursor I can't seem to figure it out.</p> <pre><code>public class MyDBHandler extends SQLiteOpenHelper ...
<p>You can use something like the <a href="https://developer.android.com/guide/topics/ui/layout/listview.html" rel="nofollow">sample code in this guide here</a>.</p> <p>The example uses a <code>CursorLoader</code> which may be used with a <code>ContentProvider</code> ideally, but you can use just the <code>SimpleCurso...
Is it possible to submit multiple records at once in Access? <p>I need to figure out a way for a user to input around 150 data points collected easily and quickly. I have no experience with Access so I don't know if it is possible to do this, but I need a way for a user to input a table like this:</p> <p><a href="http...
<p>You layout is not really different then say a typical invoice, or say a purchase order in which “many” rows of data are attached to a given order, event or whatever.</p> <p>So if you were entering data points for a given day, or test, then you would create a main table that outlines the details of the test (dat...
SQL BigQuery: fatal error when using PHP string variable in query <p>I am puzzled by this error:</p> <blockquote> <p>"invalidQuery", "message": "Field 'QLD' not found in table 'medicare.medicareTable'.", "locationType": "other", "location": "query" } ], "code": 400</p> </blockquote> <p>because the field QLD is most...
<p>Not</p> <pre><code>WHERE State = $qld </code></pre> <p>But</p> <pre><code>WHERE State = '$qld' </code></pre> <p>Text is text ;)</p>
Anchor link on another page after page load <p>Right now, I am linking to an anchor link that is on another page. When I get to the page, it takes me to where the anchor link is before the page fully loads. The problem is that after the page fully loads, the anchor link is at another position on the page than where it ...
<p>This sounds like you have race condition. You have to wait for the page to render to then scroll using a method such as</p> <p><a href="http://stackoverflow.com/questions/17733076/smooth-scroll-anchor-links-without-jquery">Smooth scroll anchor links WITHOUT jQuery</a></p> <p>But it depends on what the page is wait...
Cypher query that will return only 1 relation of each type between two nodes <p>How can I craft a query that will return only one relation of a certain type between two nodes?</p> <p>For example:</p> <pre><code>MATCH (a)-[r:InteractsWith*..5]-&gt;(b) RETURN a,r,b </code></pre> <p>Because (a) may have interacted with...
<p>Use <code>shortestPath()</code> to get the quickest single result.</p> <pre><code>MATCH (a)-[:InteractsWith*..5]-&gt;(b) WITH DISTINCT a, b MATCH p = shortestPath((a)-[:InteractsWith*..5]-&gt;(b)) RETURN a, b, RELATIONSHIPS(p) AS r </code></pre> <p>If you want to get a specific one, you'll have to get all of the <...
Twisted threading and Thread Pool Difference <p>What is the difference between using</p> <pre><code>from twisted.internet import reactor, threads </code></pre> <p>and just using</p> <pre><code>import thread </code></pre> <p>using a thread pool?</p> <p>What is the twisted thing actually doing? Also, is it safe to ...
<blockquote> <p>What is the difference</p> </blockquote> <p>With <code>twisted.internet.threads</code>, Twisted will manage the thread and a thread pool for you. This puts less of a burden on devs and allows devs to focus more on the business logic instead of dealing with the idiosyncrasies of threaded code. If you ...
How to check if used paginate in laravel <p>I have a custom view and in some functions, I used <code>paginate</code> and other functions I don't use <code>paginate</code>. now how can I check if I used <code>paginate</code> or not ?</p> <pre><code>@if($products-&gt;links()) {{$products-&gt;links()}} @endif // not...
<p>Try like this</p> <pre><code>@if($products instanceof \Illuminate\Pagination\AbstractPaginator) {{$products-&gt;links()}} @endif </code></pre> <p>You need to check wheater the <code>$products</code> is instance of <code>Illuminate\Pagination\AbstractPaginator</code>. It can be an array or Laravel's <code>Coll...
Don't use serialize for the user role Symfony <p>I have a project and a Symfony3 Silex 2 API that is based on the database created with SF3. The problem arises because of the ROLE field in the database, in effect symfony3 stores in the database the user roles via serialize, flint or using a string.</p> <p>Why Symfony ...
<p>Make sure in SF3 platform, map the <code>roles</code> field with <code>simple_array</code> DBAL type instead of <code>array</code> (i.e. <code>@ORM\Column(name="roles", type="simple_array")</code>).</p> <p>The difference is that <code>array</code> type stores their values serialized and <code>simple_array</code> st...
c# obtaining property values from object <p>I am trying to use a method to create an object and return that object to main(). Once in main I want to be able to access the properties of that object such as print Holly.age. VS does not recognize the object Holly in main() to have any properties. Is anyone able to tell wh...
<blockquote> <p>VS does not recognize the object Holly in main() to have any properties</p> </blockquote> <p>This is because you have declared <code>Holly</code> to be <code>object</code> rather than <code>Cat</code>, and similarly your create routine returns <code>object</code> rather than <code>Cat</code>.</p> <p...
Clickable legend at Core Plot <p>I use Core Plot files to create my chart. But CorePlot doesn't contain event "click on legend item".</p> <p>How can I detect user's click on legend item ?</p> <pre><code>class ViewController: NSViewController, CPTPlotDataSource, CPTPieChartDataSource { @IBOutlet weak var graphView: C...
<p>Core Plot legends can have a delegate that is called on mouse down, mouse up, and/or selected (mouse down followed by mouse up on the same item) events. See the <a href="http://core-plot.github.io/MacOS/protocol_c_p_t_legend_delegate-p.html" rel="nofollow">CPTLegendDelegate protocol</a> for details on the available ...
Ajax.BeginForm JavaScript callback with parameter causes $(this) to refer to window instead of form <p>I am using the following code to create a form with JS callbacks:</p> <pre><code>@using (Ajax.BeginForm("Example", "Example", null, new AjaxOptions { HttpMethod = "POST", OnBegin = "ajaxFormBegin", OnSucc...
<p>Your assignment to <code>OnSuccess</code> is a function <strong>call</strong> in global context.</p> <pre><code>@using (Ajax.BeginForm("Example", "Example", null, new AjaxOptions { HttpMethod = "POST", OnBegin = "ajaxFormBegin", OnSuccess = "ajaxFormSuccessWrapper" } &lt;script&gt; function ajaxFormSuc...
Jarsigner (MIME Content-Type is not application/timestamp-reply) <p>Some time ago I wrote a program to sign jars in our build process. Which worked for a couple of months without any problems.</p> <p>Now the jarsigner outputs (without changing anything!):</p> <pre><code>jarsigner: unable to sign jar: java.io.IOExcep...
<p>I am experiencing the same problem. I think something change in Comodo's timestamp service today. The response status for <a href="http://timestamp.comodoca.com" rel="nofollow">http://timestamp.comodoca.com</a> is currently HTTP/1.1 302 Moved Temporarily Content-Type: text/html</p> <p>This causes a problem for ja...
XDebug with PhpStorm: Debugging a CLI script, connection over reverse SSH tunnel <p>I've got the PhpStorm 10.0.3 and trying to debug a CLI script that runs on a remote server.</p> <p>I've got reverse SSH tunnel set up from my local machine to the remote server.</p> <p>Remote server xDebug is configured with the follo...
<p>There were actually 2 problems here. As in the @LazyOne comment, there was a port collision with the PHP5-FPM service. In my case I've turned it off, as the client's server configuration does not use FPM anyway.</p> <p>I also had to export PHP_IDE_CONFIG variable on the remote host:</p> <pre><code> export PHP_IDE_...
Vertical Bootstrap nav (rotated -90°) <p>How to create a <a href="https://v4-alpha.getbootstrap.com/components/navs/" rel="nofollow">Bootstrap Nav</a> with vertically aligned items like so:</p> <p><a href="https://i.stack.imgur.com/xCQ9c.png" rel="nofollow"><img src="https://i.stack.imgur.com/xCQ9c.png" alt="enter im...
<p>(edit) My 1st answer using <strong><code>writing-mode: vertical-lr</code></strong> and then <strong><code>transform: rotate(180deg);</code></strong> plus some CSS to make it work or as a starter (no, flex isn't needed here but I use it so much for navbars...)</p> <p><strong><a href="http://codepen.io/PhilippeVay/pe...
Vim regex matching multiple results on the same line <p>I'm working on a project where I'm converting an implementation of a binary tree to an AVL tree, so I have a few files that contain lines like:</p> <pre><code>Tree&lt;int&gt;* p = new Tree&lt;int&gt;(*t); </code></pre> <p>all over the place. The goal I have in ...
<p>Credit on this one goes to Marth for pointing this out. My issue was with vim's <code>gdefault</code>. By default it's set to 'off', which means you need the /g tag to make your search global, which is what I wanted. I think mine was set to 'on', which means without the tag the search is global, but with the tag ...
fgets / fgetc not working <p>Okay, I've read a lot of posts about <code>fgetc</code> not working properly but the errors are involved in a bit more complex tasks than mine. I'll write only the pertinent block of code. The next code prints EOF when I'm really sure that it shouldn't.</p> <pre><code>FILE *fp= fopen("data...
<p>Use <code>int c</code> instead of <code>char c;</code>.<code>fgetc</code> returns integer. </p>
Cannot find function getMonth in object 33463 <p>I have created a script to send emails to a specific people with Birthday Reminder. This use to work till day before yesterday. I don't know why am I getting this error that Cannot find function getMonth, Can anyone tell where is the mistake</p> <pre><code>function emai...
<h1>Short answer</h1> <p>Check that the cell value is a valid date for Google Sheet.</p> <h1>Explanation</h1> <p>From <a href="https://developers.google.com/apps-script/reference/spreadsheet/range#getvalue" rel="nofollow">https://developers.google.com/apps-script/reference/spreadsheet/range#getvalue</a> (emphasis mi...
Long Term Support Branches in git? <p>I'm working for an enterprise company, developing software for macOS.</p> <p>I'm not sure how to solve my problem by supporting multiple versions of a software, in one single git-repo.</p> <p>The product is an Xcode project for macOS, code is managed by git. </p> <p>At current t...
<p>You can use <a href="https://git-scm.com/book/en/v1/Git-Branching" rel="nofollow">branches</a> with <a href="https://git-scm.com/book/en/v1/Git-Basics-Tagging" rel="nofollow">tags</a> to handle multiple "trees" in a single repo. Take a look at <a href="https://github.com/rails/rails" rel="nofollow">Ruby on Rails rep...
JBoss Deployment Error - Failed Services <p>Trying to debug my application in Wildfly 8.x server, I confront that error: </p> <pre><code>16:03:18,740 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final 16:03:19,098 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final 16:03:19,170 INFO [org.jboss....
<p>It seems like database connection issue. Please check </p> <ol> <li>If database is up for accepting connections.</li> <li>Any firewall, stopping opening of ports etc.</li> <li>Do check jta="true" or false is allowed and code written.</li> <li>Check if you have packaged associated jdbc driver jar file with applicati...
Design pattern to rewrite a Java class from an API <p>I have to use the EWS Java API to call Exchange Server. In this API, there is Task class which have more than 20-30 getters of different properties. In our company, we will use only 4-5 properties; idem for Contacts and Appointment.</p> <p>In my opinion, I consider...
<p>Use Facade pattern. Create a class that encapsulates all the logic that your users would be needing in order to use your 3 Task-related actions (Appointments, Task, Contact).</p> <p>Using this "Facade" class would hide the actual implementation logic (original API) from the end users, since majority of the API is n...
Cannot get vue-router to work with webpack <p>I'm trying to get vue-router to work without success and it got me quite angry after a while since i don't see any issue.</p> <p>I'm using webpack via Elixir in Laravel, which has gulpfile like this:</p> <pre><code>const elixir = require('laravel-elixir'); require('larav...
<p>thats okay cause you didnt bind VueRouter to the <code>window</code> object as you did with <code>window.Vue = require('vue');</code></p> <p>But usually you dont need the Router in the <code>window</code> Do it in your app.js:</p> <pre><code>window.Vue = require('vue'); var VueRouter = require('vue-router'); wind...
How do I combine a Controlled Lifetime relationship type (i.e. Owned<T>) with a delegate factory? <p>In my application, I have a service that requires a constructor parameter not resolved by Autofac, that I instantiate using a delegate factory:</p> <pre class="lang-cs prettyprint-override"><code>public class Service {...
<p>You could change your injected factory to include the string parameter:</p> <pre><code>private Func&lt;string, Owned&lt;ISomething&gt;&gt; _somethingFactory; </code></pre> <p>Then you can pass the <code>string</code> to the factory when you want to create a new instance:</p> <pre><code>public void DoSomethingUsef...
Javascript HighCharts Changing Data onChange instead of adding new one <p>I am using HighCharts and I am currently using addSeries which just adds new data but instead I need to replace the existing data and add new data when changing the select box.</p> <p>Here is the code: </p> <p><strong>JS:</strong></p> <p>var c...
<pre><code>chart.series[0].setData(dat2); </code></pre> <p><a href="http://api.highcharts.com/highcharts/Series.setData" rel="nofollow">http://api.highcharts.com/highcharts/Series.setData</a></p>
Is it possible to conditionally show an XML include based on a classes method response? <p>I'm wondering if it's possible to use DataBinding to do conditionally show a layout based on a methods boolean response. Here's what I'm trying to do</p> <p>XML Layout:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt...
<p>Yes, using a conditional statement within XML is possible. I am not too familiar with data binding library, but a similar functionality is used in the <a href="https://developer.android.com/topic/libraries/data-binding/index.html#layout_details" rel="nofollow">documentation</a>:</p> <blockquote> <p>Zero or more i...
Apply style to control in custom renderer <p>I want to apply a style to a control. This is the style</p> <pre class="lang-xml prettyprint-override"><code>&lt;Application.Resources&gt; &lt;ResourceDictionary&gt; &lt;SolidColorBrush x:Key="BackgroundColor" Color="Yellow" /&gt; &lt;Style TargetType="...
<p>Now I created a separate test project with the code above. Now I tried with different Xamarin.Form versions and this is the result:</p> <p><strong>XF 2.2.0.45</strong>: style is applied<br> <strong>XF 2.3.0.107</strong>: style isn't applied<br> <strong>XF 2.3.1.114</strong>: style isn't applied<br> <strong>XF 2.3.2...
Parse String to double[] <p>As can add all the values ​​of a string array being these positive or negative and then pass them to a double array.</p> <p>Example: SUM VALUES String sa_notas[] = {1, 5, -2} RESULT (1+5-2) = 4</p> <p>ERROR MENSSAGE: at org.apache.harmony.luni.util.FloatingPointParser.initialParse(Flo...
<p>How about a little different approach?</p> <pre><code>import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegEx { // Example input: final static private String NUMBERS = "Data: 0,5€ -0.1$ 9 -3 #3"; // Regular expression to match floating point numbers: final static private Pa...
The jQuery UI sortable serialization <p>I know this question has been asked numerous times but I think I'm missing a point or something. I'm trying to leverage the serialization of jQuery sortable, but it looks like it's not working. </p> <p>Here is my base list:</p> <pre><code> &lt;ol class='simple_with_no_drop v...
<p>Your JS Code is fine. In your html code just add data-id attribute with each of the li, and it will work!</p> <pre><code>&lt;ol class='simple_with_no_drop vertical'&gt; &lt;li id='script_1' data-id='script_1' class='highlight'&gt;Hello ES&lt;/li&gt; &lt;li id='script_2' data-id='script_2' class='highli...
Android objectanimator not animating <p>I have designed today two drawable's of the classic <code>arrow</code> and <code>hamburger</code> icon to recreate and understand <code>objectAnimator</code> in android. The problem occurs when no animation is played but the drawable is changed.</p> <p>I have created <code>ic_ba...
<p>You need to give names to the <code>paths</code> in your <code>VectorDrawables</code>. If we look at your first <code>AnimatedVectorDrawable</code>:</p> <pre><code>&lt;animated-vector xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/ic_backarrow"&gt; &lt;target and...
HTML / CSS Div trouble - sitting next to but below each other <p>I'm real sorry if this has been answered multiple times before, I did try to search, but I couldn't quite find what I'm looking for.</p> <p>I'm messing around toying with different generic portfolio pages just for practice / learning (I'm pretty new). Wh...
<p>Something like this would be a good start. Bootstrap can take care of the columns for you so you don't need to set any margins for those. The sticky navigation isn't really ideally done here but should work.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" href="style.css"...
How to debug production java using a dump recorded when app throws an exception? <h3>How can we debug what happened when an exception was thrown at a later time?</h3> <p>We've got a production app written in Java that randomly throws an exception, which we can catch and log on the server. We'd like to debug this to se...
<p>I recommend having a look into Oracle's JVM Flight Recorder, which is not free, but exactly for this scenario.</p> <p><a href="http://www.oracle.com/technetwork/java/javaseproducts/mission-control/java-mission-control-1998576.html" rel="nofollow">http://www.oracle.com/technetwork/java/javaseproducts/mission-control...
Jenkins build job cannot locate item in a keychain <p>I've got a jenkins job that will execute a gradle script that retrieves android store and key passwords from the keychain. The script works fine running on my local machine, however I'm trying to add it to the jenkins job and it's failing to locate the item in the k...
<p>Just in case this is useful for someone:</p> <p>1) Create a new keychain using keychain-access. Let's call it 'jenkins', for example.<br> 2) Copy the keychain to the <code>jenkins</code> library directory (<code>$HOME/Library/Keychains/jenkins.keychain</code>)<br> 3) run <code>chown jenkins:jenkins</code> on the <c...
Finding characters with spaces <p>I was trying last week to find parts of a text containing specific words delimited by punctuation characters. That works well.</p> <pre><code>[^.?!:]*\b(why|how)\b[^.?!]*[.?!] </code></pre> <p>On the following sentence <code>"How did you do it? bla bla bla! why did you do it?"</code>...
<p><code>[ ]</code> is always a character class, which means that at one position, you can match <em>one</em> character. The "negation" in your example is in fact probably not even doing what you thing it does. </p> <p>What you probably want to match is <em>either the beginning of a string, the end of a sentence, or...
Sqlite database gives me warnings <p>I have a sqlite database and I use System.Data.SQLite in my C# project.</p> <p>My request is :</p> <pre><code>SELECT d1.* FROM DYN_table as d1 INNER JOIN ( SELECT id_bill, ordre_phase, type, MAX(valeur) maximum FROM DYN_table WHERE id_customer=347 AND type IN (1,5,2) GROUP BY i...
<p>The database creates a temporary index on the column <code>id_bill</code> of the subquery <code>d2</code>.</p> <p>It is not possible to create this index explicitly, unless you explicitly create a (temporary) table for this subquery.</p> <p>Ignore the warning. If you need to optimize this query, consider rewriting...
Swift adding multiple images to a single UIButton <p><a href="https://i.stack.imgur.com/r6Hvw.png" rel="nofollow"><img src="https://i.stack.imgur.com/r6Hvw.png" alt="enter image description here"></a>In my app, I would like to add multiple images on a single <code>UIButton</code>.</p> <p>This is what I have now:</p> ...
<p>I fixed the problem here is the new code:</p> <pre><code> let screenSize: CGRect = UIScreen.main.bounds let width = screenSize.width let height = screenSize.height NextButton = UIButton(frame: CGRect(x: width*0, y: height*0.55, width: width*0.95, height: height*0.05)) NextButton.addTarget(self, action:...
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force NOT WORKING <p>I'm trying to setup Node.js and Python on my work laptop.</p> <p>I've installed Node and Python successfully.</p> <p>When I'm trying to update my npm using this command in Windows PowerShell:</p> <pre><code>Set-ExecutionPolicy Unrestricted -Sc...
<p>The error message show the root of error:</p> <pre><code> Window powershell updated your execution policy suceffully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of remoteassigned. </code></pre> ...
add document to a groups one drive usign microsofts graph api <p>I'm trying to find a way to add documents to a group in Office Online via the Microsoft graph api. I see example in the documentation (<a href="http://graph.microsoft.io/en-us/docs/api-reference/v1.0/resources/drive" rel="nofollow">http://graph.microsoft...
<p>Group drive contains <code>root</code> and <code>items</code> navigation properties just like regular drive resource. Just like you can create new files on the drive, you should be able to use similar <a href="http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_post_children" rel="nofollow">API</a> on ...
Ng-repeat with ng-hide OR do the job in the controller for improved performance? <p>The question is simple but for sure i believe it provides added value to an application development.</p> <p>In terms of performance is it better to use:</p> <pre><code>ng-repeat="r in roads", ng-hide="r.distance &gt; 1000" </code></pr...
<p>It is better to filter the items of the array in the controller or better on the server instead of hiding them after having rendered them. If you filter the array before displaying it the browser don't need to render the DOM associated to the item and then spending time to hiding it. Keep in mind that using <code>ng...
Transforming one column into multiple ones in a Spark Dataframe <p>I have a big dataframe (1.2GB more or less) with this structure:</p> <pre> +---------+--------------+------------------------------------------------------------------------------------------------------+ | country | date_data | ...
<p>Using regular expressions in this case is slow and also fragile.</p> <p>If you know that all records have the same structure, i.e. that all "text" values have the same <em>number</em> and <em>order</em> of "parts", the following code would work (for any number of columns), mainly taking advantage of the <code>split...
Check array so that no duplicates can be added <p>Inside my <code>getNearestMeeting</code> method it seems to allow array with the same <code>key</code> and same <code>value</code>.</p> <p>I'm wanting to check to see if there is <code>key</code> already and <code>meeting_id</code> value. As you see down below that the...
<p><a href="http://chat.stackoverflow.com/rooms/11/conversation/bug-fix-discussion-between-sean-and-chris-beckett">After the discussion in the Stack Overflow PHP Chat</a>, the problems identified were the following:</p> <ol> <li>The <code>$ignore</code> array was structured strangely, if a pupil had multiple meetings ...
html page failed to show css background-image <p>I`m working on a VS2010 ASP.NET Web Application project, and I`ve added a html page to it. The problem is when starting debug(F5) , this page fail to show some icons which were set in css file , but when opening html page directly, those background-image is showing perfe...
<p>I changed css codes and it worked:</p> <pre><code>.leaflet-draw-toolbar a { background-image: linear-gradient(transparent, transparent), url('images/spritesheet.svg'); background-image: url('images/spritesheet.png'); background-repeat: no-repeat; background-size: 270px 30px;} </code></pre> <p>As you see , in the f...
Can a member variable (attribute) reside in a register in C++? <p>A local variable (say an int) can be stored in a processor register, at least as long as its address is not needed anywhere. Consider a function computing something, say, a complicated hash:</p> <pre><code>int foo(int const* buffer, int size) { int ...
<p>The compiler can do that if (and only if) it can prove that nothing else will access <code>a</code> during <code>foo</code>'s execution.<br> That's a non-trivial problem in general; I don't think any compiler attempts to solve it. </p> <p>Consider the (even more contrived) example</p> <pre><code>struct B { B (...
Using Multiple Spring Eureka Discovery Services <p>I have a user request to allow a support tool, which uses Spring Cloud Services, to display a set of links to the same support tool that would exist multiple environments (Dev, Test 1, Test 2, Prod). I am currently connecting via Eureka Server and registering in each o...
<p>Correct, <code>DiscoveryClient</code> only connects to one eureka server at a time. You would have to create each <code>DiscoveryClient</code> manually. It would probably be easier to use the eureka <a href="https://github.com/Netflix/eureka/wiki/Eureka-REST-operations" rel="nofollow">http api</a>.</p>
Do I need to specifically seperate out css and js when using plunker <p>This script renders ok on our local webserver but when added to <code>plunker</code> nothing is being rendered.</p> <p>Am I allowed to embed javascript in the html file in plunker - or do I need to explicitly move it to .js files?</p> <p>To refer...
<p>In your plnkr, you need to change the javascript reference from</p> <pre><code>&lt;script src="http://d3js.org/d3.v2.js"&gt;&lt;/script&gt; </code></pre> <p>to</p> <pre><code>&lt;script src="https://d3js.org/d3.v2.js"&gt;&lt;/script&gt; </code></pre> <p>to avoid the following error.</p> <pre><code>Mixed Content...
Netbeans 8.1 & Java : Messed up output when error is thrown <p>I noticed that Netbeans messes up the entire output once an error is thrown. It makes the output look like this incomprehensive mess:</p> <pre><code>Pushing elements onto doubleStack 1.1 2.2 3.3 4.4 5.5 6.6 Exceptions.FullStackException: Stack is full, ca...
<p>When you use <code>exception.printStackTrace()</code>, then the stack trace is printed to <code>System.err</code>, your own messages are printed to <code>System.out</code> (I guess). Both are buffered streams, and only when those streams are flushed (buffer size reached, newlines, etc), the output appears at the des...
Check how many users are using application on network? <p>I have a winform application on my network drive that many users are using. Is there a way to track how many users either by count or by their domain username who is using the application? I've look around and can't find any starting point on this subject. Any h...
<p>Take a look at this documentation, you will be able to see how many users and which users have your winform application open. </p> <p><a href="https://technet.microsoft.com/en-us/library/cc725689%28v=ws.11%29.aspx?f=255&amp;MSPPError=-2147217396" rel="nofollow">https://technet.microsoft.com/en-us/library/cc725689%2...
How to avoid ValueWidth with AmCharts? <p>I'm using a 100% Stacked Column Chart in a website for a client.</p> <p>In the legend, we have the value of the variable we're hovering. It gave : </p> <p>[Color of the variable] [Name of the variable] [Value of the variable]</p> <p>However, in some cases, when the value of ...
<p>You could try playing around with the equalWidths and horizontalGap properties, like in this demo: <a href="https://codepen.io/team/amcharts/pen/1acd9511369ff5f6d89e447be0b8f191" rel="nofollow">https://codepen.io/team/amcharts/pen/1acd9511369ff5f6d89e447be0b8f191</a></p> <pre><code>"legend": { "position": "bott...
Avoid a Dictionary<string, T> from being bound to all query string parameters <p>In a C# ASP.NET MVC project, I have an action that receives a <code>Dictionary&lt;string, T&gt;</code> (<code>T</code> type is not really important, I think) as a parameter. I also want that parameter to be optional, with a default value o...
<p>Instead of defining you model param as Dictionary create a model that would require more explicit binding</p> <p>Something like</p> <pre><code> ModelClass { string SomeName {get;set;} T Internal {get;set;} } public ActionResult YourAction(ModelClass boundInstance){} </code></pre> <p>This would certainl...
Nifi-1.0.0 and Crate.IO <p>Crate database offers a jdbc driver through which I should be able to connect to Crate from Nifi using DBCPConnectionPool controller service. So I did that, I get a connection, the ConvertJSONToSQL processor is able to get the columns from the Crate database but when I get to the PUTSql proce...
<p>I believe this is a bug in PutSQL that is hiding an issue either in the JDBC configuration, SQL statement, or something else. Using the standalone JDBC driver with valid SQL INSERT statements, I was able to PutSQL working with Crate.</p> <p>Can you double-check your connection information and SQL statement(s)? Also...
Realm + NSClassFromString <p>Hi everyone and thank you for be reading this. </p> <p>I am new with Realm and I am stucked with a function that I can't figure out how to build. My intention is to have one function called <code>func delete(className:String, id:Int){</code> that should be able to delete any object of any ...
<p><a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/WritingSwiftClassesWithObjective-CBehavior.html" rel="nofollow">According to the Apple developer docs</a>, classes in Swift are namespaced by their module names. So it's not sufficient to simply write the class name...
Replace semicolon between letters in PHP <p>I have the following issue, I need to replace all semicolons inside a string which appear only between letters with a slash. The issues is that I also have html entities with semicolons and str_replace messes them up.</p> <p>Sample string:</p> <pre><code>Category A &amp;gt;...
<p>To replace semicolon between letter only, you can use regex lookahead and lookbehind.</p> <pre><code>$str = "Category A &amp;gt; Subcategory A;Category A &amp;gt; Subcategory B;Category B &amp;gt; Subcategory C"; $str = preg_replace("/(?&lt;!\s);(?!\s)/", "/", $str); echo $str; </code></pre> <p>or if your html ent...
what is the use of jQuery.parseXML() <p>I was reading the document <a href="https://api.jquery.com/jQuery.parseXML/" rel="nofollow">https://api.jquery.com/jQuery.parseXML/</a>. It says <code>Jquery.parseXML(string)</code> Parses a well formed XML string into an XML document.I am just confused what is difference betwee...
<p>A string is just textual information. You could open in Notepad, display it in your console, send it in an email, etc. It doesn't carry any intrinsic meaning or function.</p> <p>An XML document is an object which is constructed <em>from</em> a string. It gives you functions just like working with the DOM. You can s...
Download from DropBox using DropBox.Api <p>anybody knows how to do this using DropBox.Api package and not DropNet package in C#?</p> <pre><code>//using DropNet: client = new DropNetClient("gwsdfs343sdfjtwt8", "6ygdfghdfhd34cf", userToken: "w5dgfdfg343", userSecret: "239dgfsgs34434o"); </code></pre> <p>I've installed...
<p>I've just used the <code>generated token</code> from DropBox app, it wasn't possible to do it the other way, it was years ago, now it's easier using just the <code>generated token</code></p>
replacing fields from json formating using easier methodology in Qt 5.7 using QVariantMaps <p>I have 3 variantMaps created from JSON and I would like to substitute<br> for example all 3 things from 3d with 2nd and than second to first to the properties.</p> <pre><code> QVariantMap wholeMapToChange; //1. ...
<p>It is the right solution if the maps aren't too big, since the cost is N*M. But it is a premature pessimization. You should implement the loop to have N+M cost: after all, the maps are sorted, so you only need to iterate each map once.</p> <p>A complete example:</p> <pre><code>// https://github.com/KubaO/stackover...
Point to Json File you created in Android Studio <p>Practing my JSON to JAVA Object skills, running into an issue, trying to point to the json file i created in android studio, instead of writing out my json data in full. here is my code. Thank you</p> <p>Trying to turn this:</p> <pre><code> System.out.println( ...
<p>If you want to do this, place the json file in the raw resources folder.</p> <p>I created a ResourceManager class to get the content.</p> <pre><code>public class ResourceManager { private final Context context; private final Resources resources; private static ResourceManager resourceManager; pri...
maven-dependency-plugin analyze - "Skipping project with no build directory" <p>I'm running mvn dependency:analyze-only &amp; im getting the error below. Can someone point me to the correct config for running the maven dependency analyzer?. </p> <p>FYI, my project build fine with maven, so im not sure what its lookin...
<blockquote> <p>Note that the dependency:analyze-only goal is used in preference to dependency:analyze since it doesn't force a further compilation of the project, but uses the compiled classes produced from the earlier test-compile phase in the lifecycle.</p> <p>The project's dependencies will then be automatic...
A JSONArray text must start with '[' at 1 [character 2 line 1] <p>I have a JSON file and i am trying to deal with but the following error is appears:</p> <blockquote> <p>Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] at org.json.JSONTokener.sy...
<p>You have to read the content of the file first, because the constructor of <a href="https://github.com/stleary/JSON-java/blob/master/JSONArray.java" rel="nofollow">JSONArray</a> needs the file-content and not the file-path.</p> <pre><code>new JSONObject(new JSONTokener(new FileInputStream(new File("path"), "UTF-8")...
PhantomJS ReferenceError for included function <p>I am trying to render a page of a webapp of mine.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="includes.js"&gt;&lt;/script&gt; &lt;script type="text/javas...
<p>This is not really an answer but a fix.. I registered the <code>onConsoleMessage</code>, <code>onError</code>, <code>onResourceError</code> and <code>onResourceTimeout</code> events and noticed and error which indicated that the function was not initialized properly.</p> <p>I used</p> <pre><code>load_gantt = funct...
Visual Studio Load Testing. Is there a way to specify both how many times a minute you want a test to run and how many minutes? <p>I am attempting to do some loadtesting at work, and they want me to use Visual Studio's load testing. The test asked for is to have 100 logins occur per minute for 30 minutes.</p> <p>I can...
<p>Before really answering this question you need to ask some other questions, such as:</p> <ul> <li>What do the users do after they login?</li> <li>Can we just do logins and will the system under test (SUT) mind having several hundred (or several thousand) users who have logged in but not logged out?</li> </ul> <p>H...
python pyquery import not working on Mac OS Sierra <p>I'm trying to import pyquery as I did hundreds on time before, and it's not working. It looks like related to the Mac OS Sierra. (module installed with pip and up-to-date)</p> <pre><code>from pyquery import PyQuery as pq </code></pre> <p>And got an error on the na...
<p>Finally found why. My file had the same name as my import... So the library import was overridden by the name of the .py file. </p>
Mongodb won't start - reason: errno:111 Connection refused <p>All of a sudden I can't get mongodb to work.</p> <p>Usually I will start with </p> <pre><code>mongo </code></pre> <p>however I get this when trying to start.</p> <pre><code>MongoDB shell version: 3.0.6 connecting to: test 2016-10-11T15:36:56.462+0100 W N...
<p>It seems that your error is similar to <a href="http://stackoverflow.com/questions/29813648/failed-to-unlink-socket-file-error-in-mongodb-3-0">this</a></p> <p>Removing the <code>/tmp/mongodb-27017.sock</code> file should do the trick.</p> <p>Also check your disk space, as it seems the process is not starting becau...
Write a Java method changeBlue(weight) <p>Write a method <code>changeBlue(weight)</code>. Do not change any color of the pixels in the first half of the picture. For the second half, change blue value of each pixel by <code>new blue=original blue * weight</code>. </p> <blockquote> <p>For example, if a pixel has valu...
<p>Not the best implementation but try : </p> <pre><code>public void changeBlue(int weight) { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int value = 0; int index = 0; int halfSize = pixelArray.length/2; for (index = 0; index &lt;= pixelArray.length; index++) { ...
kubectl exec into contain of multi container pod <p>I have problem login into one container of a multi-container pod. I get the container id from the <code>kubectl describe pod &lt;pod-name&gt;</code></p> <pre><code>kubectl describe pod ipengine-net-benchmark-488656591-gjrpc -c &lt;container id&gt; </code></pre> <p>...
<p>ah once more detailed reading the man page of kubectl exec :</p> <blockquote> <p>Flags: -c, --container="": Container name. If omitted, the first container in the pod will be chosen -p, --pod="": Pod name -i, --stdin[=false]: Pass stdin to the container -t, --tty[=false]: Stdin is a TTY</p> </bloc...
WebViewClient not calling shouldOverrideUrlLoading <p>The problem is rather simple. In the application we want to keep track of the current url being displayed. For that we use <code>shouldOverrideUrlLoading</code> callback from the <code>WebViewClient</code> by saving the url into a class field for every update. Here...
<p>When you click a product on that web page, it loads the new content in with JavaScript and updates the visible URL in the address bar using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API#Adding_and_modifying_history_entries" rel="nofollow">HTML5 History APIs</a>.</p> <p>From the above MDN...
Trivia Game loop and get line issues <p>Ok, so I'm new to this so please bare with me. I'm working on a simple trivia game, and just for testing I created this small bit of code to make sure it was working right.</p> <pre><code>// Trivia game for one player. Player will choose a category and program // will ask you qu...
<p>It's counting every answer as correct because the condition of your <code>if</code> statement:</p> <pre><code>if (ans = correct) </code></pre> <p>is an assignment, which technically evaluates to <code>true</code> (because it's non-zero).</p> <p>Change to:</p> <pre><code>if (ans == correct) </code></pre> <p>to e...
Why don't objects have hasattr and getattr as attributes? <p>When you need to access an object's attributes dynamically in Python, you can just use the builtin functions <code>hasattr(object, attribute)</code> or <code>getattr(object, attribute)</code>.</p> <p>However this seems like an odd order for the syntax to tak...
<p>You'll find quite a few similar examples - like <code>len(obj)</code> instead of <code>obj.length()</code>, <code>hash(obj)</code> instead of <code>obj.hash()</code>, <code>isinstance(obj, cls)</code> instead of <code>obj.isinstance(cls)</code>. You may also have noticed that addition is spelled <code>obj1 + obj2</c...
find duplicates in Ruby array of arrays, sum their values, then combine them <p>I have a pipe delimited text file that i am looping through that looks like so:</p> <pre><code>123|ADAM JOHNSON|AAUA|||||||||||1|||| 123||AAUA||||||||8675|90.0|90.0|||||||| 444|STEVE SMITH|AAUA|||||||||||1||||| 444||AAUA||||||||2364|50.0|5...
<p>I don't think your data item looks like <code>[["123", ["8675", "90.0"]]]</code> based on how it's created... more likely it looks like <code>["123", ["8675", "90.0"]]</code></p> <p>In which case, this should do what you want...</p> <pre><code>group_array = @group_array.sort result = [] save_3 = nil save_4 = nil t...