input
stringlengths
51
42.3k
output
stringlengths
18
55k
Mouse listnener not removing a JPanel in java <p>I have a JFrame with 64 JPanels on it. I have a mouseListener that should be removing the JPanel that is being clicked on. However, the only thing that happens when you click a JPanel is that you get a bunch of errors.</p> <p>The code is as follows:</p> <pre><code>im...
<blockquote> <p>ClassCastException: javax.swing.JFrame cannot be cast to javax.swing.JPanel</p> </blockquote> <p>So fix the problem. You can't add a MouseListener to a JFrame and expect it to be a JPanel. </p> <p>You need to either:</p> <ol> <li><p>add the <code>MouseListener to each JPanel</code> in your loop whe...
Exception handling in a class C++ <p>I am going through Data Structures and Algorithms in C++ and I am facing an issue currently. I am writing a stack class using arrays and the book suggests me to use exception specification in the function declaration. In my case I have StackEmptyException and StackFullException clas...
<p>I think the reason your book says you shouldn't always use a try/catch to catch this is because you should first do the bounds checking yourself. So before you pop() check if isEmpty() first for example.</p>
Does importing with (import ...) slow down the app? <p>I'm new to Android Development, sorry if it's a dumb question. Android Studio uses <code>import ...</code> by default. I want to know what libraries does it import and does using <code>import ...</code> slow down the app?</p>
<p>No, the import statement doesn't actually do anything except for removing the need to qualify.</p> <p>For example, if you didn't want to use the import statement for an arraylist, it is actually quite possible to write</p> <pre><code>java.util.ArrayList&lt;Integer&gt; foo = new java.util.ArrayList&lt;Integer&gt;()...
Ajax Callback -> messages form PHP via JSON to JS and output to DIV <p>This is a newbie-question. I have never learned JS and it is very hard for me to do easy things..</p> <p>I have a PHP-Script, which gets data via JS from the Website. The PHP-Script updates the database and Returns a success via the following code-...
<p>Instead of using <code>success_msg</code> and <code>error_msg</code>, you could just use <code>status_msg and status</code> (in your PHP script). </p> <p><code>status_msg</code> would contain the text. status would contain <code>"success" or "error"</code>. You could also use any other kind of marker you like.</p> ...
Why doesn't ${@:-1} return the last element of $@? <p><em>I thought to post up a Q&amp;A on this as I did not find anything similar. If it already exists, please mark this as a duplicate.</em></p> <hr> <p>The following code, running under Bash shell, doesn't work (should return just <code>f</code>, the last (-1-th) i...
<h3><code>${parameter:-word}</code> is a type of <a href="https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion">parameter expansion</a>:</h3> <blockquote> <p><strong><code>${parameter:-word}</code></strong></p> <p>If parameter is unset or null, the expansion of word is substituted. Oth...
Added SSL to Static IP Address API Server <p>I am not sure if anyone have this issue.</p> <p>I have an </p> <ul> <li>Local API Server + Database with Static IP</li> <li>Web Site</li> </ul> <p>My API server is holding all the information and the Web site is just a middleman and point all transaction to the server. So...
<p>If you give it a hostname and a SSL cert for that hostname, anyone accessing via IP will get an "invalid SSL hostname mismatch" type error (exact error depends on what browser/client/etc. is being used to access it). This is because your 10.42.56.113 doesn't match "db.example.com" and the SSL cert is for "db.exampl...
What is the reason for the garbage value printed at the beginning? <p>I am writing a program which will do two things</p> <ol> <li><p>get a number between 0 to 10(10 is not included,so values should be less than 10),separate them and store them in an array</p></li> <li><p>print the array for each number</p></li> </ol>...
<p>It's because you're not setting <code>arr[i]</code> to anything in the base case in mirror function. And if there isn't any use of the return value of the function, why are you making it return anything?<br> Either make it <code>void</code> or if you've to return value from it, at-least make sure that all control pa...
How to get class's numeric suffix? <p>There's a class:</p> <pre><code>&lt;div id="my-id" class"my-class my-class-level-3"&gt;&lt;/div&gt; </code></pre> <p>How can I get its numeric <code>my-class-level</code> suffix (in this case - <code>3</code>)? Order of class attributes can be absolutely random.</p>
<p>This is how I would do It:</p> <pre><code>"use strict"; function getSuffix(element) { let match; if ( match = element.className.match(/my-class.+my-class-level-(\d+)/) ) return match[1]; return null; } console.log(getSuffix({className: 'my-class random class names my-class-level-5'})); </co...
Spring-Boot executable encoding <p>My Rest-Application delivers data in correct encoding when running under Eclipse. But when I start the application as executable jar on a Windows System, my special characters are broken.</p> <p>What am I missing?</p> <p><a href="https://i.stack.imgur.com/wnFSe.png" rel="nofollow"><...
<h3>Eclipse</h3> <p>Eclipse's encoding is set in <code>preferences-&gt;general-&gt;workspace</code>, which whould by default be inherited from the OS (cp1250 on windows). When you create a "Run as" task, it also stores it. So if you update eclipse's setting, make sure you re-create your "run as" task. You can see the ...
How can I ensure a bind is updated on the VM before a component's props get populated <p>So I've a data property that is populated from a field on my vm</p> <pre><code>var vm = new Vue{ data: { somevalue: null, }, } </code></pre> <p>This value is bound to a field that is prepopulated on load:</p> <pr...
<p>Can't you just put a "watch" on the prop and perform the action once the value has changed to something other than null?</p>
Prevent insertion of invalid characters to text input <p>I have a form with standard text elements:</p> <pre><code>&lt;form id="f"&gt; &lt;input type="text" name="from" pattern="^[A-Za-z ]+$&gt; &lt;input type="text" name="to" pattern="^[A-Za-z ]+$&gt; &lt;/form&gt; </code></pre> <p>And I'd like to prevent ...
<pre><code>$("#f input[type=text]").keypress( function(e) { new_text = $(this).val() + String.fromCharCode(e.which) pattern = $(this).attr("pattern") return Boolean(new_text.match(pattern)) }) </code></pre> <p>The code works by returning false, and thereby cancelling the keypress, if the new text does not ...
hide or delete image not found with $("img").error(function() <p>In my page I can have images not uploaded yet or removed by error so I'm looking for something who can remove or hide the warning about my img src not found ?</p> <p>you can check my code here or in this link -> </p> <p><a href="http://www.booclin.ovh/t...
<p>The error you have in console : <code>$ is not defined</code> mean jQuery is NOT loaded.</p> <p>You load it inside <code>&lt;div class="rightpart"&gt;</code> within the <code>&lt;body&gt;</code>.</p> <p>Try loading it in the <code>&lt;head&gt;</code> right before: <code>&lt;script type="text/javascript" src="index...
Using a for loop to set background images using Javascript <p>I am trying to set background URL of all the tiles to the name in the memory array.</p> <p>I have tried:</p> <pre><code>document.getElementById('tile_' + i).style.background = 'url(' + memory_array[i] + ') no-repeat';; </code></pre> <p>But this does not w...
<blockquote> <p>// This is the relevant line</p> </blockquote> <p>That line should be</p> <pre><code>document.getElementById('tile_' + i).style.background = 'url(' + memory_array[i] + ') no-repeat'; </code></pre> <p>And your array should be</p> <pre><code>var memory_array = ['img1.gif', 'img1.gif', 'img2.gif', 'i...
ExtJS 6.2 Sort grid Panel groupings based on summary row <p>I've been searching for hours to figure out how to do this. Essentially what I want to do is group data based on one column, create a summary for that grouping, then sort the groups based on the summary.</p> <p>Using one of their kitchen sink examples, I woul...
<p>This can be done using a <em>grouper</em> with a <em>sorterFn</em>. The <em>sorterFn</em> should compare the summary values you are sorting by. For the kitchen sink example you mentioned, if you want to sort by the sum of the <em>estimate</em> column while grouping by the <em>project</em> column, the grouper would ...
Creating index on nested table column <pre><code> CREATE TYPE nums_list AS TABLE OF NUMBER; CREATE TABLE mytest ( id NUMBER, num NUMBER, tagged nums_list ) NESTED TABLE tagged STORE AS mytest_tagged_table; </code></pre> <p>Now I need creating index on <code>tagged</code> nested ...
<p>This is an interesting example of the Oracle documentation being out of synch. The index example should include the definitions of the types. However we can find these examples in the <a href="https://docs.oracle.com/cloud/latest/db112/LNPLS/create_type.htm#i2126557" rel="nofollow">the PL/SQL reference</a>. So <a hr...
how to match two different columns in Mysql which has comma separated values <p>I have two tables: </p> <ol> <li>CampaignTable</li> </ol> <p>which has following property</p> <pre><code>id , campaign ,user_group </code></pre> <p>example would be </p> <pre><code>1 8867116213 5,11,15,16,18,20 2 8867116214 0,8,22 ...
<p>You should definetely normalize your data. For example consider this kind of normalization which renders almost no change to your DB structure:</p> <pre><code>INSERT INTO CampaignTable (`campaign`, `user_group`) VALUES (8867116213, 5), (8867116213, 11), (8867116213, 15), (8867116213, 16), (8...
WebSocket connection to 'ws://localhost:2017/' failed: Invalid frame header <p>I'm trying to make an async websocket server using c#.</p> <p>I already have handshake completed, after searching a lot on the internet.<br> But after the handshake I can't seem to send any data in byte array format :( </p> <p>This is the...
<p>As you can see in <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers" rel="nofollow">this article</a> or in the <a href="https://tools.ietf.org/html/rfc6455" rel="nofollow">webSocket specification itself</a>, the webSocket protocol exchanges data in a specific data fra...
drupal 8 accessing input type from label template <p>How do you reference the input type of the respective form input from inside the form element label template (form-element-label.html.twig)?</p>
<p>The element type is not available in that TWIG template. You will have to hook into the form element and pass a variable to the element label hook.</p> <pre><code>/** * The contents of $variable['label'] will be passed to the preprocess * hook of the element's label. */ function theme_preprocess_form_element(arr...
shiny mainPanel width when including markdown <p>I'm trying to include a "reactive" <code>.Rmd</code> file within a shiny application. It would summarize the user's choices and various conditions that arise. For whatever reason, I find including <code>shiny</code> <em>within</em> <code>.Rmd</code> <a href="http://rmark...
<p>It appears that the rmd code adds the following property to the <code>body</code> element:</p> <pre><code>max-width: 800px; </code></pre> <p>To remove this, add the following to your ui code (for example below <code>sliderInput</code>)</p> <pre><code> tags$head(tags$style(HTML(" ...
Improved SGBM based on previous frames result <p>I was wondering if there is any good method to make SGBM process faster, by taking the info from the previous video frame. </p> <p>I think that it can be made faster by searching correspondences only near the distance of the disparity of previous frame. The problem I se...
<p>You have told what is the problem, if the scene is in motion. I managed to wrote some algorithm that take in consideration the critical zone around the objects' borders, they were a little more accurate but very slower than SGBM. </p> <p>Maybe you can simply set the maximum and the minimum value of disparity in ...
timeInterval Variable won't work <p>I'm trying to change the timeInterval in a scheduledTimer. I'm trying to do this by changing a variable to the interval and than setting the timeInterval to this variable. I don't get any errors but the timeInterval won't change. Can someone help me?</p> <pre><code>var enemyTimer = ...
<p>The reason why your code doesn't work is because the <code>Timer</code> object doesn't know that its interval needs to be in sync with your <code>enemySpawnTime</code>. The solution is simple, just recreate the timer when you change the enemy spawn time.</p> <p>But...</p> <p>You should <em>NEVER</em> use <code>Tim...
Swift 3: error: ambiguous reference to member '>' <p>I can't make sense of this error from the Swift compiler:</p> <pre><code>error: ambiguous reference to member '&gt;' let moveDirection = dx &gt; 0 ? .right : .left </code></pre> <p>Here is the code:</p> <pre><code>enum MoveDirection { case none cas...
<p>The error message is misleading. The problem is that you need to give Swift more information about what <code>.left</code> and <code>.right</code> are:</p> <pre><code>let moveDirection = dx &gt; 0 ? MoveDirection.right : .left </code></pre> <p>or</p> <pre><code>let moveDirection: MoveDirection = dx &gt; 0 ? .rig...
Difference between two similar Goodle Unity Ads plugins <p>Tere is a two plugins for Unity from Google for having Ads in your app.</p> <p>First, based on firebase and provided via google play services:</p> <p><a href="https://github.com/googleads/googleads-mobile-unity" rel="nofollow">https://github.com/googleads/goo...
<p>Maybe this can help.</p> <p><a href="http://stackoverflow.com/questions/19956048/should-we-prefer-admob-in-google-play-services-compared-to-old-admob-sdk">Should we prefer AdMob in Google Play services compared to &quot;old&quot; AdMob SDK</a></p> <p>But I think to read more their docs and choose, is best solution...
Node JS Array, Foreach, Mongoose, Synchronous <p>I'm not that experienced with node js yet , but i'm learning.</p> <p>So my issue. Example: I have a small app with mongoose and async modules. In mongodb in a user collection i have 1 user with a field balance = 100 . </p> <pre><code>var arr = [1,2,3,4]; var userId...
<p>The problem is where the final callback got called. You need to call cb() inside of waterfall's final callback, not outside:</p> <pre><code>var arr = [1,2,3,4]; var userId = 1; async.forEachSeries(arr, (item, cb) =&gt;{ async.waterfall([ next =&gt; { users.findById(userId, (err, user) =&gt;{ ...
php _GET parameter passed through URL trouble, any length or size restriction on the url? <p>I am moving my site to a new cPanel linux server, here is the comparison of the new and old server:</p> <p>New Server: php version:5.6.25 (Zend: 2.6.0) Database: MySQL 5.5.52-cll Server OS: Linux 2.6.18-502.el5.lve0.8.85</p...
<p>The de facto limit is 2000 characters. That being said, is it possible to change it? Yes. Should you change it? No, because even if you set a higher limit, some of the most popular web browsers have limitations of their own, making your application less accessible.</p> <p>Since what you are doing is an update, I wo...
onDragOver doesn't happen (in JavaFX) <p>Why doesn't <code>onDragOver</code> event happen in the following example?</p> <p>How to implement simplest drag behaviour, i.e. w/o clipboard things?</p> <pre><code>import javafx.application.Application; import javafx.event.EventHandler; import javafx.geometry.*; import javaf...
<p>First, you need to call <code>startDragAndDrop</code>, instead of <code>startFullDrag</code>. The different drag modes are described in the <a href="http://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/MouseEvent.html" rel="nofollow">documentation for <code>MouseEvent</code></a>. Additionally, one annoying...
Google Sign In for websites: Can't render sign-in button <p>I am following the official guide <a href="https://developers.google.com/identity/sign-in/web/sign-in" rel="nofollow">here</a> and can't get a button to render. I'm not a front-end dev but have to get this working to demonstrate some backend functionality. S...
<p>Here's how you can use <a href="https://developers.google.com/identity/sign-in/web/build-button" rel="nofollow">Google's Sign-In button</a> template to initialize the login &amp; grant of permissions process in a slightly more elegant manner:</p> <pre class="lang-html prettyprint-override"><code>&lt;meta name="goog...
Jackson YAML: support for anchors and references <p>I'm investigating the use of YAML for a somewhat complicated metadata language. It would help to make the documents smaller and less complex if we could use <a href="http://camel.readthedocs.io/en/latest/yamlref.html#anchors" rel="nofollow">YAML's anchors and referenc...
<p>First, Jackson actually does support YAML anchors and references, at least to degree they work with how Jackson supports Object Id references with <code>@JsonIdentityInfo</code>: limitation being that you can not -- for example -- refer to one key/value pair of am Object.</p> <p>But identity id/reference handling i...
Keras mixture of models <p>Is it possible to implement MLP mixture of expert methodology in Keras? Could you please guide me by a simple code in Keras for a binary problem with 2 experts.</p> <p>It needs to define a cost function like this:</p> <pre class="lang-python prettyprint-override"><code>g = gate.layers[-1].o...
<h2>Model</h2> <p>You can definitely model such a structure in Keras, with <a href="https://keras.io/getting-started/sequential-model-guide/#the-merge-layer" rel="nofollow">a merge layer</a>, which enables you to combine different inputs. Here is a <a href="http://sscce.org/" rel="nofollow">SSCCE</a> that you'll hopef...
GitHub: Can't find remote repository after re-installation <p>I've re-installed the git bash. And when I tried to clone from one of my private repository, I was told that </p> <pre><code>remote: Repository not found. fatal: repository 'https://github.com/&lt;MY REPO ADDRESS&gt;/' not found </code></pre> <p>I've check...
<p>The user.name and user.email have nothing to do with https authentication.<br> The former is for commits, the latter uses the GitHub username and password.</p> <p>Since I don't see a debugging.git repo in <a href="https://github.com/neolicd?tab=repositories" rel="nofollow">your repo page</a>, it could be a private ...
Sort Single Linked List in descending order <p>How would I display this linked list in desending order by Score? I need it when it when I display it in my GUI to sort by the highest score at the top, and then desending to the lowest score in the bottom? Also, I was wondering if there is a way to limit the entries to on...
<p>Why are you taking Score as a String?</p> <p>I am assuming score as Integer</p> <p>below is the sort method that you can include in ScoreList class, which will sort your LinkList in descending order of player score. </p> <ul> <li>Time Complexity : O(nlogn)</li> <li>Space COmplexity: O(n)</li> </ul> <p>Hope this ...
asp.NET and SQL Server datetime issues <p>I am having hard time to store date information into the datetime column of SQL Server.</p> <p>I get the input from the user for three columns:</p> <ol> <li>Creation Date</li> <li>Preparation Date</li> <li>Next Preparation Date</li> </ol> <p>I use calendarextender and format...
<p>Dates do not have a format while stored in a database. It is actually usually just a very large <code>long</code> that counts the number of milliseconds from a set starting date.</p> <p>If you want to store the format you need to stop storing it as dates and instead just treat the text as text in the database, howe...
Python system libraries leak into virtual environment <p>While working on a new python project and trying to learn my way through virtual environments, I've stumbled twice with the following problem:</p> <ul> <li>I create my virtual environment called venv. Running <code>pip freeze</code> shows nothing. </li> <li>I in...
<p>I realized that my problem arose when moving my virtual environment folder around the system. The fix was to modify the <code>activate</code> and <code>pip</code> scripts located inside the <code>venv/bin</code> folder to point to the new venv location, as suggested by <a href="http://stackoverflow.com/a/16683703/32...
reading a csv file into a array <p>I am completely new to java (just started this week). I am trying to read the csv file, "read_ex.csv", into an array. I have searched endlessly on the web/satckoverflow to find a way to read the file into an array. The best i have been able to do is read it in a streaming fashion, but...
<p><img src="https://commons.apache.org/proper/commons-csv/images/logo.png" ></p> <blockquote> <p>I am new to java and wold be open to any method that reads a csv into a file that a beginner could understand.</p> </blockquote> <p>Here is an existing solution for you from <a href="http://commons.apache.org/" rel="no...
JAVA - creating basic 2D shapes that scale to window size <p>I am trying to learn Java by reading and doing examples out of a textbook I found online. I was able to do an example in the book fairly easily but want to take it one step further. When I wrote the code for a program called 'concentric circles' I noticed tha...
<p>If you want your circles to be circular (not elliptical) then first off you need to know which is narrower, the width or the height. Using the syntax shortcut for <code>if...else</code> you'd want something like: </p> <pre><code>int smallest = width &lt; height ? width : height; </code></pre> <p>Next you need to t...
DataBinding: How to create RecyclerView Adapter with same model and different layout? <p>I use same adapter for two different item layouts. One is for grid, one is for linear display. I'm passing layout id with itemLayout to adapter. However, I wasn't able to add data binding properly. Could you help me out, please?</p...
<p>My bad. This part works perfectly. My problem is extending BaseActivity which also uses DataBinding. The crash is related to that. After removing extending BaseActivity from my activity, it worked. However, I opened another question realted to that. If you could look at that, I'll be grateful. <a href="http://stacko...
Maven - Is `maven-archetype-simple` a valid archetype? <p>Usually, I create maven jar project with archetype <code>maven-archetype-quickstart</code>, it works well.</p> <p>But I want to create Maven project with no sample <code>App.java</code> class, thus I tried <code>maven-archetype-simple</code> archetype, and get ...
<p>The artifact <code>maven-archetype-simple</code> <a href="http://repo1.maven.org/maven2/org/apache/maven/archetypes/maven-archetype-simple/" rel="nofollow">does exist on Maven Central</a>, but it isn't a valid archetype since it doesn't containt the right metadata files. A valid archetype <a href="http://maven.apach...
using inappbrowser to convert website to mobile app without showing the link of the website <p>I am using phonegap to be able to have my website (that is already hosted in shared hosting server) and has responsive web design. I have tried the solution provided in posted question:</p> <ol> <li>typing my website link in...
<p>Ok I figure out this issue, Actually I need to set the location = no and the link will not be shown</p>
How can I delete an item from an Object in NodeJs/express/mongoose? <p>I know this has been asked before, but no one of the answers worked for me. In my App, I have a users collection in MongoDb. These users collection have an array field named 'segActuacions' that can be modified within a form. This form sends this Ob...
<p>Note your delete wouldn't work because you are using <code>userI</code> as a string and not using the variable value. Also update will just update the fields that are in the object.</p> <p>But I think you should use <a href="https://docs.mongodb.com/manual/reference/operator/update/unset/#unset" rel="nofollow">$uns...
Str.length ,if..else <p>I want my code to run a statement if a string has more than 12 characters. My code:(I have a ("demo") that i have not mentioned here.)</p> <pre><code> &lt;script&gt; var str = "Hello World!"; if(str.length=="12"){ document.getElementById("demo").innerHTML = "Hi"; }else{ document.getEleme...
<pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt; &lt;p id="demo"&gt;&lt;/p&gt; &lt;script&gt; function myFunction() { var str = "Hello World!"; if(str.length&gt;=11){ document.getElementById("demo").innerHTML = "Thanks Keith,For the help...
declare Angular2 component at top level module and use at lower level modules <p>I am working on Angular2 application using Angular2 final release.</p> <p><a href="https://i.stack.imgur.com/6laNs.png" rel="nofollow"><img src="https://i.stack.imgur.com/6laNs.png" alt="enter image description here"></a></p> <p>This is ...
<p>You can put your component in a separate module and have your Main and Feature modules import it.</p>
Function that returns an int value, instead of a string in C <p>I'm trying to write a function in C that gets an int as a parameter and returns a char array (or a string).</p> <pre><code>const char * month(int x) { char result[40]; if(x&lt;=31) strcpy(result,"can be a day of the month"); else strcpy(result...
<pre><code>const char * month(int x) { char result[40]; if(x&lt;=31) strcpy(result,"can be a day of the month"); else strcpy(result,"cannot be a day of the month"); return result; } </code></pre> <p>This doesn't make sense. You return a pointer to the array, but after the function returns, the array no...
Return value based on closest number <p>In the snippet you'll find a function that returns and outputs the distance belonging to a planet inside an array, based on what planet you type in <code>var found = getDistanceNumber('Saturn');</code></p> <p>I wanna use this code, not to return the distance of the planet as it'...
<p>Check this solution that save the previous planet then return it as result if the passed Planet in condition is matched :</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>...
Can I add a dynamic key to an object? <p>What would a function look like that "keys" an input object? I've been researching the topic, but couldn't find any good answers. </p> <p>So, if I have an input object... </p> <pre><code>var fruits = [{fruit: "apple", taste: "sour"}, {fruit: "cherry", taste: "swe...
<p>You could use a function which creates a new object and return the items with the wanted key.</p> <p>Version with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" rel="nofollow"><code>Array#forEach</code></a></p> <p><div class="snippet" data-lang="js" data-hi...
Trying to annotate classes to represent a json string with jackson <p>I have an JSON structure from an external source and have some difficulty trying to build a class structure that can be used for deserialization. I have registered that each member of the json array has a name for the array item (oneDevice) - first t...
<p>Reading the following POST <a href="http://stackoverflow.com/questions/27154631/json-mapping-exception-can-not-deserialize-instance-out-of-start-array-token">Related question</a> i finally got this to work only short time after posting the question.</p> <p>If I instead use List in the PushOkResponse class, and drop...
Unity3d different screen sizes and limited play area <p>I have been playing around with unity for quite some time now, and I have an app or two published on android, but I have yet to figure out one really important thing that keeps eluding me about mobile. </p> <p>I have looked at various tutorials on things such as ...
<h1>Game design today must indeed be reactive.</h1> <h1>It is very, very difficult, and there is no easy or built-in solution.</h1> <p>Yes, this is unfortunately an absolute basic aspect of game design in our era.</p> <p>It is indeed very, very difficult to make 2D games work on all different screen shapes.</p> <p>...
Referencing self in a callback <p>My code is:</p> <pre><code>class myclass observable.Observable { let label = "test"; navigatingTo(args: observable.EventData) { target.on( "name", this._callback ); } _callback ( eventData ) { console.log( this.label); } } </code></pr...
<p>You can pass a third argument when subscribing with <code>on()</code>. The third argument will be used as a context(this) for the callback. So probably you want to do:</p> <pre><code>target.on("name", this._callback, this); </code></pre>
Python program asks for input twice, doesn't return value the first time <p>Here is my code, in the <code>get_response()</code> function, if you enter 'y' or 'n', it says invalid the first time but then works the second time.<br> How do I fix this?</p> <pre><code>import random MIN = 1 MAX = 6 def main(): userVa...
<p><code>answer != 'y' or answer != 'n':</code> is always true; <code>or</code> should be <code>and</code>.</p>
GAE (Python) Best practice: Load config from JSON file or Datastore? <p>I wrote a platform in GAE Python with a Datastore database (using NDB). My platform allows for a theme to be chosen by the user. Before <em>every</em> page load, I load in a JSON file (using <code>urllib.urlopen(FILEPATH).read()</code>). Should I i...
<p>Do you expect the configuration to change without the application code being re-deployed? That is the scenario where it would make sense to store the configuration in the Datastore.</p> <p>If the changing the configuration involves re-deploying the code anyway, a local file is probably fine - you might even conside...
TypeError: 'HtmlResponse' object is not iterable <p>I'm new to python, but trying to get my head around it in order to use Scrapy for work.</p> <p>I'm currently following this tutorial: <a href="http://scrapy2.readthedocs.io/en/latest/intro/tutorial.html" rel="nofollow">http://scrapy2.readthedocs.io/en/latest/intro/tu...
<p>As the error message states</p> <pre><code> for sel in response: </code></pre> <p>You try to iterate through the <code>response</code> object in your <code>medium_Spider.py</code> file at <strong>line 11</strong>.</p> <p>However <code>response</code> is an <code>HtmlResponse</code> not an <em>iterable</em> which ...
Java Best Practice for Date Manipulation/Storage for Geographically Diverse Users <p>I have read all of the other Q/A about Date Manipulation, but none of them seems to deliver a satisfactory answer to my concern.</p> <p>I have a project with geographically diverse users which uses <code>Date</code> in some of its cla...
<blockquote> <p>what can I do with Joda that can't be done with traditional Java</p> </blockquote> <p>It's not really about what you can or cannot do with traditional Java in the general case. It's more about how the library API works to make you write better (more robust and correct) code easier than traditional Ja...
Validate user input to only accept type int or String "quit" <p>My code prints out an array which is already declared then asks for user input. User is supposed to enter a number in the format xy or type quit to stop using the program. After getting user input it prints out the element of the array using x as row and y...
<p>With the exception added, it appears the failure is occurring here;</p> <pre><code>String x = xy.substring(0, 1); String y = xy.substring(1); </code></pre> <p>The StringIndexOutOfBoundsException means the String "xy" is too short, presumably blank on the readline.</p>
Single-row subquery returns more than one row Help Please <p>I am trying to build a simple query for working out times when staff clock in and clock out. The DB records the person's name, if their clocking in or out and the time. It records more then that but I don't need that info.</p> <p>So an example DB would be:</...
<p>I've created an example <a href="http://rextester.com/OXLN87427" rel="nofollow">here</a>.</p> <p>In the naive assumption that in the table there will be alwas one "In" and at most one "Out" for a single name, the following query should work:</p> <pre><code>Select c1.user, to_char(MAX(CASE WHEN c1.In_Out='I...
Swift 3 - find number of calendar days between two dates <p>The way I did this in Swift 2.3 was:</p> <pre><code> let currentDate = NSDate() let currentCalendar = NSCalendar.currentCalendar() var startDate : NSDate? var endDate : NSDate? // The following two lines set the `startDate` a...
<p>Turns out this is much simpler to do in Swift 3:</p> <pre><code>let currentCalendar = Calendar.current guard let start = currentCalendar.ordinality(of: .day, in: .era, for: date) else { return 0 } guard let end = currentCalendar.ordinality(of: .day, in: .era, for: self) else { return 0 } print( start - end ) </c...
Unable to access modified value of imported variable <p>I am new to python and have some problem understanding the scope here.</p> <p>I have a python module A with three global variables :</p> <pre><code>XYZ = "val1" ABC = {"k1" : "v1", "k2" : "v2"} PQR = 1 class Cls_A() : def sm_fn_A(self) : global XYZ ...
<h1>Explanation</h1> <p>Three global variables are defined in module <code>A</code>, in this code:</p> <pre><code>XYZ = "val1" ABC = {"k1" : "v1", "k2" : "v2"} PQR = 1 </code></pre> <p>Then new global variables <code>XYZ</code>, <code>ABC</code>, <code>PQR</code> are defined in module <code>B</code>, in this code:</...
how to manipulate my dataframe in spark? <p>I have an nested json rdd stream comming in from a kafka topic. the data looks like this: </p> <pre><code>{ "time":"sometext1","host":"somehost1","event": {"category":"sometext2","computerName":"somecomputer1"} } </code></pre> <p>I turned this into a dataframe and t...
<pre><code>// Creating Rdd val vals = sc.parallelize( """{"time":"sometext1","host":"somehost1","event": {"category":"sometext2","computerName":"somecomputer1"}}""" :: Nil) // Creating Schema val schema = (new StructType) .add("time", StringType) .add("host", StringType) .add("event", (new StructTy...
Oracle SQL developer- Create Table from Table and View <p>I have one table and view where one column is common which is the primary key of the table. Now if I want to join the table and view only with specific columns, should I create view or table in that case? Also I want to import the joined result to Tableau.</p>
<p>Well If you want just join table and view in single query you may write it, or you may create view for it, if you want. For example:</p> <pre><code> create table tmp_table_a (id, first_col, second_col, third_col) as select level, lpad('a',level,'b'), lpad('c',level,'d'), lpad('e',level,'f') from dual connect ...
Drag and Drop between tables in horizontalLayout doesn't work <p>I've got 3 Tables in Vaadin: </p> <p><a href="https://i.stack.imgur.com/4x5bH.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/4x5bH.jpg" alt="3 Tables within a horizontal Layout"></a></p> <p>My Problem now is that Drag &amp; Drop doesn't work. ...
<p>Off-topic: why do you have <code>@Theme("valo")</code> on your view? As far as I know that's used with the <code>UI</code> class...</p> <hr> <p>On-topic:</p> <p>As I was saying in my comment I don't think it's related to <code>HorizontalLayout</code>. Either you may have misunderstood the <em>drag source</em> and...
How to check runtime error of a program in bash? <p>I made a C program that would throw <strong>segmentation fault</strong> error whenever I run it. And then I made a bash script as follows:</p> <pre><code>cat input.txt | ./a.out 1&gt; output.txt 2&gt; error.txt cat error.txt </code></pre> <p>The output of the second...
<p>Your problem stems from the fact that the <code>Segmentation fault (core dumped)</code> message is <strong>not</strong> generated <em>by your program</em>, it is generated by the shell in which you can the <code>a.out</code> command. The process looks approximately like this:</p> <ul> <li>Your program generates a ...
How to ignore an empty constraint in SQL SELECT query <p>I have a simple MySQL database that I am querying from PHP. I have a user input some constraints in via a form, and then want to return results from a SELECT query based on the constraints. What I have is working when both constraints are used. However, if one of...
<p>I think you should build your query differently based on the value of the constraints:</p> <pre><code>$query = "SELECT * FROM food_items WHERE " . ($foodtypes != "" ? "type IN ('$foodtypes')" : "TRUE") . " AND " . ($budget ? "cost &lt;= $budget" : "TRUE") . " AND " . .. and so on .. </code></pre> <p><strong>...
How to rename many groups of rows in Pandas? <p>I have a list of lists:</p> <p>result_list = [[10x20], [10x10], [10x5], [10x2], [10x20, [10x10], [10x5] ....[10x2]]</p> <p>Inside each [ ] there are 10 values. I imported this list of lists to a Pandas Dataframe,I calculated the average and rounded to 2 decimals. </p> ...
<p>Assume I have this <code>df</code></p> <pre><code>df = pd.DataFrame(np.random.rand(24, 10)) df['Total Acc'] = df.sum(1) df </code></pre> <p><a href="https://i.stack.imgur.com/OTWwo.png" rel="nofollow"><img src="https://i.stack.imgur.com/OTWwo.png" alt="enter image description here"></a></p> <p>Create a new index ...
Rectangle collision in pygame? (Bumping rectangles into each other) <p>I decided to move that Squarey game to pygame, and now I have 2 rectangles that can move around and bump into the walls. However, the rectangles can move right through each other. How would I make them bump into each other and stop? My code:</p> <p...
<p>To check for collisions, try something like this:</p> <pre><code>def doRectsOverlap(rect1, rect2): for a, b in [(rect1, rect2), (rect2, rect1)]: # Check if a's corners are inside b if ((isPointInsideRect(a.left, a.top, b)) or (isPointInsideRect(a.left, a.bottom, b)) or ...
react authentication flow verification <p>I have some API in nodejs and a React App for client side. I try to create the auth system for my API/backoffice with a jwt token, I use <code>jsonwebtoken</code> for create and verify token on server side but I have some doubt for client side...now on login I save the token on...
<p>Do you know <code>Higher Order Components</code>?</p> <p>Here is an article about HOC: <a href="https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e#.hb4ck2u52" rel="nofollow">https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e#.hb4ck2u52</a></p> <p>Re...
Declare enum as a class property (for child classes to define later?) <p>I am making a game in Unity, and all of the player characters and enemy character's actions are determined by the value of enumerated type <code>moveState</code>. (The update function first queries the variable <code>myMoveState</code> and calls a...
<p>I think you are viewing the problem from an unfavorable angle. What are you going to do? You define a property in a parent class, inherit it by the child class and then say "Nah, lets kick out all the values and define new ones". But that is not the parent property anymore, nor is this the idea of inheritance.</p> ...
How can I find out if two lines overlap? <p>My function takes two objects that represent lines and is supposed to return whether they overlap or not. Overlapping returns "true", but not overlapping doesn't seem to return false. Any idea why? </p> <pre><code>function checkOverlap(line1, line2) { if(line2.start &lt;= ...
<p>You have to check whether one line's start is between the start and end of the other line.</p> <pre><code> if((line2.start &lt;= line1.end &amp;&amp; line2.start &gt;=line1.start) || (line1.start &lt;=line2.end &amp;&amp; line1.start &gt;= line2.start)) { return true; } </code></pre>
How is numpy pad implemented (for constant value) <p>I'm trying to implement the numpy pad function in theano for the constant mode. How is it implemented in numpy? Assume that pad values are just 0.</p> <p>Given an array </p> <pre><code>a = np.array([[1,2,3,4],[5,6,7,8]]) # pad values are just 0 as indicated by cons...
<p>My instinct is to do:</p> <pre><code>def ...(arg, pad): out_shape = &lt;arg.shape + padding&gt; # math on tuples/lists idx = [slice(x1, x2) for ...] # again math on shape and padding res = np.zeros(out_shape, dtype=arg.dtype) res[idx] = arg # may need tuple(idx) return res </code></pre> ...
Catch anything and save it into a variable <p>I'm wondering if there is a keyword for "all" in python <code>except</code>. I've ran into this seemingly simple problem:</p> <pre><code>try: #do stuff except any as error: print('error: {err}'.format(err=error)) </code></pre> <p>I know that you can do <code>exce...
<p>You can catch almost anything this way:</p> <pre><code>try: #do stuff except Exception as error: print('error: {err}'.format(err=error)) </code></pre> <p>But to catch really everything, you can do this:</p> <pre><code>import sys try: #do stuff except: err_type, error, traceback = sys.exc_info() ...
Notepad++ and autocompletion <p>I'm using mainly <strong><a href="https://notepad-plus-plus.org/" rel="nofollow">Notepad++</a></strong> for my C++ developing and recently i'm in need for some kind of <em>basic autocompletion</em>, nothing fuzzy, just want to type some letters and get my <strong>function declaration</st...
<p>Edit the <strong><em>cpp.xml</em></strong> file and add all the keywords and function descriptions you'd like. Just make sure you add them in alphabetical order or they will not show up.</p> <p>Another option is to select <strong><em>Function and word completion</em></strong> in the <strong><em>Auto-Completion</em...
how to display and then change array of images by set number of click of a button <p>I'm working on Xcode 8 and Swift 3.</p> <p>So far I have connected a button with a label. The label is set at 0 and by clicking it, it will change the number by 1.</p> <p>Now what I'm trying to do is I want to set an array of images ...
<p>Here's a pseudo code for array of JPEGs:</p> <pre><code>var arrayOfPictures: [UIImage] = [] arrayOfPictures.append(UIImage(named:"Image1.jpg")!) arrayOfPictures.append(UIImage(named:"Image2.jpg")!) arrayOfPictures.append(UIImage(named:"Image3.jpg")!) </code></pre> <p>Here's a pseudo code for button's method:</p> ...
Parse no response with nested/chained saves <p>So I have two objects which I am saving. However, I want to store a reference to one of the object (lets call it a) on the other (b) so I am saving 'a' first and then once the save is complete, saving object 'b' after setting the reference into its proper field. However, t...
<p>It actually works. The problem was that I had a function within the response.success call that was being made to format the object before sending it back but I was getting a nullpointexception due to something I was trying to access. I didn't turn on verbose logging so parse never told me that this was happening.</p...
count number of 0 with floodfill algorithm <p>I wanted to count number of 0 and 1 from a 2d array with floodfill algorithm....But unfortunetly...it's showing the wrong result.</p> <p>I have a matrix like this</p> <pre><code>0,1,1,0,1 1,0,1,1,0 1,0,1,1,0 1,0,1,1,0 1,0,1,1,0 </code></pre> <p>It supposed to show nu...
<pre><code>int zero = apply(row, col); </code></pre> <p>In your flood fill algorithm, you are only going in four direction and cover the area which match your criteria. And fortunately <code>[row,col]</code> index has <code>0</code> and it count all four 0 from <code>[row, col]</code>. Now think what if <code>apply(ro...
Checking With Assertion <p>The methods setDates and setTimes have as preconditions that none of their arguments are null. This is to be checked by means of an assertion. (This means that if the precondition is not met, the program will fail at the assertion, and an AssertionError will be thrown.)</p> <p>here is my cod...
<p>First of all the methods setTime and setDates are public what suggests that they may be used outside of the package. Given that you have no control over parameters - using assert would not be considered as the best practice. You should rather use Runtime Exceptions such as IllegalArgumentException when value can be ...
How to avoid using literal strings to narrow disjoint unions in flow <p>All the examples I find online for narrowing the disjoint union in flowtype uses string literals, like <a href="https://flowtype.org/docs/disjoint-unions.html#_" rel="nofollow">the official one</a>. I would like to know if there is a way to check a...
<p>I'm not in my best shape right now, so sorry if I read your question wrong. I'll try to help anyway. Is this what you're looking for?</p> <pre><code>const actionTypes = { FOO: 'FOO', BAR: 'BAR' } type ActionType = $Keys&lt;actionTypes&gt; // one of FOO, BAR function buzz(actionType: ActionType) { switch(act...
PHP function duplicating data <p>I am trying to make a comment section with MySQL and PHP. But, for some reason, whenever I refresh the page, the data gets duplicated. This happens every time I refresh the page.</p> <p>Example</p> <p><a href="https://i.stack.imgur.com/A3HEe.png" rel="nofollow"><img src="https://i.sta...
<p>Yea, you are right, the problem is there:</p> <pre><code>&lt;?php echo"&lt;form method='POST' action='".setComment($conn)."'&gt; &lt;input type='hidden' name='uid' value='Anonymous'&gt; &lt;textarea name='message'&gt;&lt;/textarea&gt;&lt;br/&gt; &lt;button type='submit' name=...
QTextLayout manual line breaking <p>I'm trying to render lines one by one using <code>QTextLayout</code>. I've tried to set <code>wrapMode</code> to <code>QTextOption::ManualWrap</code> and call <code>QTextLine::setNumColumns</code> for each line but the whole text appears in a single line.</p> <p>I've also tried to s...
<p><a href="http://doc.qt.io/qt-5/qtextline.html" rel="nofollow">QTextLine</a> is used for single line text. If you want multiple lines then use <a href="http://doc.qt.io/qt-5/qtextedit.html" rel="nofollow">QTextEdit</a>.</p>
Datatables doesnt get fit width columns on print? <p>I try to print datatables, but why when I print it doesnt get fit width coulmns,? here's my result <a href="https://postimg.org/image/i0eue3xhh/" rel="nofollow">Screenshot from 2016-10-17 06-38-39.png</a></p> <p>any way to add in my code.? I'm totaly newbie</p>
<p>Assign your table columns a width.</p>
android.view.InflateException: Binary XML file line #69: Error inflating class, when using a custom font for edittext <p>please am trying to use a custom font which i did, but my app crashes when its suppose to start the LoginActivity. have searched but could not find a solution the issue. this is the error msg......</...
<p>seems like error happends at LoginActivity:line 34, but line 34 is space in your code copy.</p>
Gradle Multi-Project Setup with Dependencies -> Could not resolve all dependencies <p>I've got a small multi-project setup with gradle (also new to it), but it doesn't compile. I can run it inside of the IDE, but when I want to compile it, it fails. When I then try to use one of the dependencies from the Engine project...
<p>EDIT (Better answer)</p> <p>I would organize projects differently.</p> <p>Try to use this hierarchy : </p> <pre><code>Project/ | +- Game/ +- Engine/ +- build.gradle +- settings.gradle </code></pre> <p>In your settings.gradle</p> <pre><code>include ':Game' include ':Engine' </code></pre> <p>In your b...
Php floating if statement Confused <pre><code>function is_decimal( $it ) { return is_numeric( $it ) &amp;&amp; floor( $it ) != $it; } if (is_decimal == true){ echo "Decimal"; } </code></pre> <p>This gives me an error even though the int is not a decimal (float). Can someone help me. Thanks It works fine for ...
<p>just use <code>if(is_numeric( $spaces )){ ... }</code> work for int, float even if they are represented by string</p>
Setting CircularImageView border color programmatically <p>I am using the <a href="https://github.com/lopspower/CircularImageView" rel="nofollow">CircularImageView</a> library. I have a <code>CircularImageView</code> in my <code>ViewHolder</code>, and I want to change its border color on click.</p> <p>My <code>onBindV...
<p>I got it working, try this:</p> <p><a href="https://i.stack.imgur.com/3cyfp.png" rel="nofollow"><img src="https://i.stack.imgur.com/3cyfp.png" alt="enter image description here"></a></p> <pre><code>public void onBindViewHolder(RecyclerView.ViewHolder mholder, int position) { final User user = mList.get(po...
XPath query for list of UML class attributes that are not associations <p>I have a UML model developed with Rational Software Architect v9.1.2. I'm crafting a BIRT report with which I would like to show all of the class attributes that are NOT associations. I have the following XPath query:</p> <pre><code>resolveURI($...
<p>First thing I'd try is changing the qualifier to check for nullness - e.g.</p> <p>resolveURI($classURI)/ownedAttribute[@association = null]</p> <p>Never know.. might work! :)</p> <p>cheers Steve</p>
How to decrypt a "sha512" encrypted variable? <p>I have this code: </p> <p><code>$password = vancab123;</code></p> <p><code>password_hash(base64_encode( hash('sha512',$password, true) ), PASSWORD_DEFAULT );</code></p> <p><strong>Database stored value:</strong></p> <p><code>$password = $2y$10$jUa8ZEFBX5lfsBmySUnJFeS...
<p>And you dont need to jump through all those hoops to use <code>password_hash</code> and this is how to check that an entered password matches the previously hashed password</p> <blockquote> <p>The point of a HASH is it cannot (within a sensable time frame) be converted back to its original value. Instead you have...
Median of three, pivot <p>I'm looking for the <strong>median of three</strong>, using this for a pivot in a QuickSort. I would not like to import any statistics library because I believe it creates a bit of overhead which I would like to reduce as much as possible.</p> <pre><code>def median(num_list): if (num_list[0]...
<p>Let Python do the work for you. Sort the three elements, then return the middle one.</p> <pre><code>def median(num_list): return sorted([num_list[0], num_list[len(num_list) // 2], num_list[-1]])[1] </code></pre>
Determine if peer has closed reading end of socket <p>I have a socket programming situation where the client shuts down the writing end of the socket to let the server know input is finished (via receiving EOF), but keeps the reading end open to read back a result (one line of text). It would be useful for the server t...
<p><code>getsockopt</code> with <code>TCP_INFO</code> seems the most obvious choice, but it's not cross-platform.</p> <p>Here's an example for Linux:</p> <pre><code>import socket import time import struct import pprint def tcp_info(s): rv = dict(zip(""" state ca_state retransmits probes backoff opti...
Send notification when requesting data from api <p>I am trying to create an alert system for my app with a background service and notifications but I actually don't know where to start this thing.</p> <p>What I have already done: I have created an API which returns an integer. The user sets a goal in my app which will...
<p>Get into RXJava, run a Service and combine it with a NotificationManager</p>
in c# for type safe tree implementation (typesafe node) <p>I am looking for /tring to implement a type safe tree implementation in C#.</p> <p>How can a type safe tree be implemented, without using interfaces (which force to reimplement the tree functionality all over the place) and without using casts?</p> <p>I have ...
<blockquote> <p>I have the idea of using tree as common base class, but then type safety is gone. My current approach is usage generics. But I am missing some conversion back to the base type.</p> </blockquote> <p>Then constraint the generic type to your base type:</p> <pre><code>public class Node&lt;T&gt; where T:...
How to use environment variables in ReactJS imported CSS? <p>I created a simple React app using <a href="https://github.com/facebookincubator/create-react-app" rel="nofollow">https://github.com/facebookincubator/create-react-app</a>.</p> <p>I am trying to specify a configurable URL to a component's CSS like this:</p> ...
<p>If you want to use js variables in CSS, try React inline-style instead of plain css file.</p> <p><a href="https://facebook.github.io/react/tips/inline-styles.html" rel="nofollow">https://facebook.github.io/react/tips/inline-styles.html</a></p> <p>If you want to separate CSS and JS, you might need a CSS preprocesso...
Why does my app crash with a NullPointerException, and why is my adapter (probably) null? <p>When my app tries to get the position on the adapter, it crashes, because apparently my adapter isn't getting populated correctly.</p> <p>The data is coming in fine through Retrofit, and my custom adapter (<code>NewsAdapter</c...
<p>You are basically using the first constructor which means you need to pass your <code>ArrayList&lt;Articles_Map&gt;</code>. Using your first constructor makes your Array uninitialized and that's causing your the <code>Nullpointer Exception</code>. </p> <pre><code>final NewsAdapter nAdapter = new NewsAdapter(ListNew...
Can't pass random variable to tf.image.central_crop() in Tensorflow <p>In Tensorflow I am training from a set of PNG files and I wish to apply data augmentation. I have successfully used <code>tf.image.random_flip_left_right()</code></p> <p>But I get an error when I try to use <code>tf.image.central_crop()</code>. bas...
<p>I solved my own problem defining the following function. I adjusted the code provided in tf.image.central_crop(image, central_fraction). The function RandomCrop will crop an image taking a central_fraction drawn from a uniform distribution. You can just specify the min and max fraction you want. You can replace ran...
NodeJS Mongoose Passport local strategy query Mongodb gives error, <p>I have a Passport local strategy try to query a user in mongodb: </p> <pre><code>passport.use(new LocalStrategy( function(username, password, done){ console.log("username and password is &gt;&gt;&gt;&gt;&gt;", username, password); va...
<pre><code>.then(function(user){ console.log("inside findone user&gt;&gt;&gt;&gt;&gt;", err, user); </code></pre> <p>The error is being thrown because that <code>err</code> isn't defined.</p> <p>If you log the actual error that the <code>fail</code> function:</p> <pre><code>.fail(function(err){ console.log("fail...
Packing a Form as a reusable Control like FolderBrowser <p>I have created a form that emulates a <code>FolderBrowseDialog</code>, but with some added features I wanted. It's tested and working, so now I want to make it into a control. My problem is that as soon as I inherit from <code>UserControl</code> instead of <cod...
<p>To make it a reusable component, instead of trying to derive it from <code>Control</code>, create a <a href="https://msdn.microsoft.com/en-us/library/system.componentmodel.component.aspx" rel="nofollow"><code>Component</code></a> which uses that form. This way it can show in toolbox and you can drop an instance of y...
iOS Button Vector Image doesn't automatically adjust to screen size <p>I am currently trying to introduce myself to Xcode, IB and Vector images. I am struggling with the auto layout and having the buttons adjust to screen size. </p> <p>As you can see the buttons are same size in the iPhone 6s and iPad Pro.</p> <p><im...
<p>What constraints do you have to change the size of the imageView? I would expect to see a constraint between the top two images (and the bottom two) that forces a constant gap.</p> <p>The constraints on each image's width should then have a lower priority so they get stretched on a bigger screen. Then you want to c...
How to read .data file into R <p>I have tried to load the data from <a href="http://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/hungarian.data" rel="nofollow">http://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/hungarian.data</a> into R using the following piece of code</p> <pre>...
<p>The file contains extra line breaks that are causing issues. If you chop them out with regex, you can read it in:</p> <pre><code># read file into a single string x &lt;- readr::read_file('http://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/hungarian.data') # or in base, x &lt;- paste(readLines(u...
How to programmaticaly trigger refresh primeNG datatable when a button is clicked <p>I have a refresh button that is outside the primeNG datatable. How do I programmaticaly trigger to refresh the datatable?</p> <p>something like this:</p> <pre><code>&lt;div class="pull-right"&gt; &lt;button id="FilterBtnId" ...
<p>The <a href="https://angular.io/docs/ts/latest/guide/forms.html#!#add-a-hero-and-reset-the-form" rel="nofollow">Angular form guide</a> contains a small trick that could be used as a <em>workaround</em>, it consists on recreating the dom by adding <code>*ngIf</code> to the element to control its visibility</p> <pre>...
Microsoft.ACE.OLEDB16.0 provider not registered on local machine <p>I'm working on an app using Visual Studio 2013 and Access 2016 and I believe I have everything connected correctly, but when I try to debug the program every time the database is supposed to be used the title message pops up. I have downloaded a lot of...
<p>In the connection string</p> <pre class="lang-none prettyprint-override"><code>Provider=Microsoft.ACE.OLEDB12.0 </code></pre> <p>is not a valid provider name because it is missing a period. It should be</p> <pre class="lang-none prettyprint-override"><code>Provider=Microsoft.ACE.OLEDB.12.0 </code></pre>
File Access in python <p>Whenever I go to load a text file for my program it displays the info in the text file yet when I input the roster function it does not display the text file and show it is available to be modified. Is it something with how I created the text file in the first place or is my coding for <code>lo...
<p>you didnt load your data into <code>dict_member</code> before displaying the roster </p> <p>when you load your data in the loadData function you redefine <code>dict_member</code> so it will "shadow" the outer <code>dict_member</code> so when the <code>display</code> function is called <code>dict_member</code> will ...
Luhn's Algorithm Pseudocode to code <p>Hey guys I'm fairly new to the programming world. For a school practice question I was given the following text and I'm suppose to convert this into code. I've spent hours on it and still can't seem to figure it out but I'm determine to learn this. I'm currently getting the error<...
<p>well, i can see 2 problems:</p> <p>1)when you do:</p> <pre><code>for i in creditCard[-1] </code></pre> <p>you dont iterate on the creditCard you simply take the last digit. you probably meant to do </p> <pre><code>for i in creditCard[::-1] </code></pre> <p>this will iterate the digits from the last one to the f...
Pig Latin String Encryption <p>I am writing a program that takes a string, splits it into words, converts the words into pig latin, and then returns the result string. I have it working to a certain point.</p> <p>For example if I enter these words that do not start with a vowel into the program I get:<br/><br/> pig ->...
<p>This method:</p> <pre><code>public static void pigLatinEncrypt(String[] words, boolean isVowel) </code></pre> <p>takes an array of words and a <em>single</em> <code>isVowel</code> boolean. Thus, if there is more than one word, and some, but not all, of them begin with vowels, there's no way to tell the method th...
Doctrine not saving a one to one referenced field <p>I have a RequestForEstimate entity that at some point in my logic gets to the point where I create a PurchaseOrder and I need to insert a RequestId in the PurchaseOrder table. I have it reference by using the One to One association in doctrine. For some reason the DB...
<p>I will give you an example from one of my projects. The whole trick is in entities setters and cascaders configurations. Hope it will help.</p> <p>Entities:</p> <pre><code>class Agreement { // ... /** * @ORM\OneToOne(targetEntity="AppBundle\Entity\Requisites", mappedBy="agreement", cascade={"persist"...
Laravel can't update database? <p>This is a weird error. I can add a new record to the database fine with a new UserEdit method, but if I try to update a record. Nothing. It doesn't even file a blank value, or issue an error. </p> <p>What am I missing? To try to eliminate issues, I tried running the core update method...
<pre><code>public function store(Request $request) { $user = new UserEdit; //$user-&gt;name = $request-&gt;name; $user-&gt;First_Name = "foo"; $user-&gt;Last_Name = "bar"; $user-&gt;save(); return $user; } </code></pre> <p>Try this function, maybe you had a mi...