input
stringlengths
51
42.3k
output
stringlengths
18
55k
get data from a ngrepeated div to another div on click <pre><code>&lt;div ng-app="appPage" ng-controller="appController"&gt; &lt;div class="nav"&gt; &lt;h1 class="logo"&gt;Todlio&lt;/h1&gt; &lt;a href="setting.html"&gt;&lt;i class="icon setting" style="color:#fff;font-size:1.8em;;position:absolute;top:1...
<p>There are a few ways to do this. One easy way is as follows:</p> <ol> <li>Define a $scope variable with a name like $scope.currentTodo.</li> <li>In the repeat loop, the ng-click would set $scope.currentTodo=todo</li> <li>This current variable will hold the todo object so you can use {{ $scope.currentTodo.title }} i...
Loading Files From A Local Folder <p>I have been working on a HTML/JavaScript program which requires to be downloaded on to you local computer. I am wanting the program to load .mp3 files form the users music folder and display it. How can I do this locally without PHP. </p>
<p><strong>For security reasons,</strong></p> <p>All the popular browsers <strong>does not let you load files from the local computer</strong> by default, unless the user select the file (or drag and drop it) on the browser (html5 example <a href="https://www.html5rocks.com/en/tutorials/file/dndfiles/" rel="nofollow">...
Adding search function to the AlternateID on the Sales Order Line Grid <p>I want to add a pxselector to the AlternateID field on the Sales Order Line grid to search multiple alternate id's for a single item for the customer identified on the SOHeader. I added the following code:</p> <pre><code>namespace PX.Objects.SO...
<p>George, you put a wrong name for your event handler and that causes the error. Try replacing your handler with the code snippet below:</p> <pre><code>[PXMergeAttributes(Method = MergeMethod.Merge)] [PXSelector(typeof(Search&lt;INItemXRef.alternateID&gt;), typeof(INItemXRef.alternateID), typeof(INItemXRef.in...
How to add "Open in app" link on my website <p>I have added support for deep links to my android app and have added the appropriate intent filters. If I click on a weblink in a browser and I support that url, a chooser will been shown with my app listed. </p> <p>But what I want now is add a html link to my website so...
<p>you should Try to open it like myapp://returnApp/?status=1 (add trailing slash character). This is happens because path parameter is defined with default value of /.</p> <p>Unfortunately, you can't match exactly for empty string. As documentation states:</p> <pre><code>Note : - The path part of a URI which must be...
Exceptions in Java - Try/ Catch <p>I'm learning Java and I have this program that tells the sign depending on the day and month the user writes. The program works as it is, but if the user enters a day like 90 or so, the program doesnt evaluate that "error". Can I correct this with a try/catch? If so, how do I write it...
<p>It's pretty simple, really...</p> <pre><code>try { //statements that may cause an exception } catch (exception(type) e(object))‏ { //error handling code } </code></pre> <p>That's all you really need right there. Just put your code that you think might break in the appropriate spot.</p> <p>Though, hav...
Oracle group by to get a record based on the length <p>I have this data after grouping by in table, so we can see code is repeated twice as there are different names associated with it. </p> <p>But I want whenever the max length is more then get that name, otherwise, get short name,</p> <p>so for </p> <ul> <li><code...
<p>Simply change your query to:</p> <pre><code>select code, max(name) from acct where code in('CS226','CS161') group by code </code></pre>
How can I set length of array to field value in the same class? <p>I made the the field value maxSeats as to represent the number of max seat that will be in the main class like this. Main Class: </p> <pre><code>public static void main(String[] args) { Student a = new Student("Abigail", 1, 5); Student b = new ...
<p>1) You need to create your array after you define the value of the variable <code>maxSeats</code>.</p> <p>2) You're setting the values in your constructor backwards.</p> <p>Try this:</p> <pre><code>private int maxSeats; private int routeNum; String[] studentArray; public SchoolBus(int mS, int rN){ maxSeats = ...
Fastest way to parse all Excel formulas using Python 3.5 <p>As part of a bigger set of tests I need to extract all the formulas within an uploaded Excel workbook. I then need to parse each formula into its respective range references and dump those references into a simple database. For example, if Cell A1 has a form...
<p>What do you mean by "extracting the formulae faster"? They are stored with each cell so you have to go cell by cell. When it comes to parsing, openpyxl includes a tokeniser which you might find useful. In theory this would allow you to read the worksheet XML files directly and only parse the nodes with formulae in t...
Hash not inserting into database <p>I am trying to insert array into data base. I can see the array (status"=>{"group_one"=>"One", "group_two"=>"One"}) in the parameters but while inserting inot db, it is being ommitted.</p> <p>My console displays the following:</p> <pre><code>Parameters: {"utf8"=&gt;"✓", "authent...
<p>Perhaps you should try changing your datatype from <code>string</code> to <code>text</code></p> <p><a href="http://stackoverflow.com/questions/6694432/using-rails-serialize-to-save-hash-to-database">Using Rails serialize to save hash to database</a></p>
Why is some of the colorization of cells not occurring, and is there a connection between that and the "Cannot perform runtime binding" err msg? <p>I'm getting the following err msg:</p> <p><a href="https://i.stack.imgur.com/xC3gQ.png" rel="nofollow"><img src="https://i.stack.imgur.com/xC3gQ.png" alt="enter image desc...
<p>I don't rightly know why the previous code didn't work, but my guess is that the logic was just generally too discombobulated. I refactored and simplified it (rather than trying to adapt some existing code written by someone else, I started afresh and did it "my way") and it now works just fine. The new code is:</p>...
How to clear "warning message" after selecting file? <p>Please follow the instructions below:</p> <p><strong>My View:</strong></p> <pre><code>&lt;div class="col-xs-6"&gt; @Html.LabelFor(model =&gt; model.File) &lt;br /&gt; @Html.TextBoxFor(model =&gt; model.File, new { @class = "form-control", @type = "fi...
<p>I think you are looking for something like this:</p> <pre><code>$.ajax({ success: function (response) { if (response.ErrorFile) { $("#ErrorFile").html('&lt;span class="text-danger field-validation-error" data-valmsg-replace="true"&gt;&lt;span class=""&gt;* Required field.&lt;/spa...
Unable to nest loops in jmeter test plan <p>I have a JMeter test plan to do the following: </p> <ul> <li>Reads a list of domain URLs from a CSV</li> <li>visit each </li> <li>extract main menu items from each domain</li> <li>loop on each menu item <ul> <li>visit the menu item </li> </ul></li> </ul> <p>I have a debug...
<p>Found the answer. had to check the <code>use "-" before number</code> checkbox in the loop through Non-admin links section as shown in the picture below. <a href="https://i.stack.imgur.com/Ox6LT.png" rel="nofollow"><img src="https://i.stack.imgur.com/Ox6LT.png" alt="enter image description here"></a></p>
How to remove duplicates of a string from another string in Java? <p>So I need to remove duplicates of a specific string from another string in Java, a few examples:</p> <pre><code>'test12312312312' -&gt; Remove duplicates of '123', output -&gt; 'test12312' 'my sentence-!!!!!!!!!' -&gt; Remove duplicates of '!!'...
<p>With <code>String#replace</code>:</p> <pre><code>String needle = /* search string */; String base = /* input string */; int firstLoc = base.indexOf(needle); if (firstLoc &gt; 0) { int cutoff = firstLoc + needle.length(); return base.substring(0, cutoff) + base.substring(cutoff).replace(needle, ""); } return...
Forcing Riak to store data on distinct physical servers <p>I'm concerned by this note in Riak's documentation:</p> <blockquote> <p>N=3 simply means that three copies of each piece of data will be stored in the cluster. That is, three different partitions/vnodes will receive copies of the data. <strong>There are no g...
<p>There is no configuration that avoids the minuscule possibility that a partition might have 2 or more copies on one physical node (although having 5+ nodes in your cluster makes it extremely unlikely that a single node with have more than 2 copies of a partition). With your 6 node cluster it is extremely unlikely th...
Batch, trying to set a variable to a value that is the characters from x to x+5, missing operand? <pre><code> :modify set xa=x+5 set /a m1=%l1:~%x%,%xa%% set /a m2=%l2:~%x%,%xa%% set /a m3=%l3:~%x%,%xa%% set /a m4=%l4:~%x%,%xa%% set /a m5=%l5:~%x%,%xa%% goto main </code></pre> <p>x was ...
<p>You have to use the <code>delayedexpansion</code> to make the substitution.</p> <p>and <code>set /a</code> is used to make some Aritmetical operation that's why you get the operand error.</p> <pre><code> setlocal enabledelayedexpansion :modify set /a xa=x+5 set m1=!l1:~%x%,%xa%! set m2=!l2:~%x%,%xa...
Is there a multiplication analogue to Integer::sum? <p>Since Java 8, the <code>Integer</code> class has a static <code>sum</code> method that adds two integers:</p> <pre><code>public static int sum(int a, int b) { return a + b; } </code></pre> <p>I can pass this method to higher-order functions via <code>Integer:...
<p><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#multiplyExact-int-int-" rel="nofollow"><code>Math::multiplyExact</code></a></p> <blockquote> <p><code>static int multiplyExact(int x, int y)</code></p> <p>Returns the product of the arguments, throwing an exception if the result overflows...
ONLYOFFICE and mime-types assosiasions <p>I`m using Elementary Os Loki and wanted to use ONLYOFFICE. I tried installing the last deb file from official site and tried to use the repo(no change). The problem is that when the package installs it doesn`t register itself to allow opening the file from filemanager or termin...
<p>It is a bug in onlyoffice-desktopeditors. We will fix it soon. You can set file associations: open context menu of the file, choose "open with" -> "other applications". Then find 'desktopeditors' in recommended applications, select this and press 'Set as default' button. After this you will be able to open files fr...
How can I publish a beta in Google Play while my app is still in Timed publishing? <p>I have an app that's close to launch. In prep for this, I've put it into production with "Timed publishing". It's ready to go, all I have to do now is click "Go Live".</p> <p>However, I have a bug fix and I want to put out a beta for...
<p>Right now I'm facing the same problem, but I think it's not possible to publish a beta if timed publishing is enabled without going live.</p> <p>Here is the reference about this topic I found in Google support:</p> <p><a href="https://i.stack.imgur.com/4mhUy.png" rel="nofollow"><img src="https://i.stack.imgur.com/...
ng-lightning with angular2+systemjs and NgModule <p>I tried to use ng-lightning (0.24.0) with angular2 (2.0.2) and systemjs module loader. The bundle loading is okay I think but when I try to call an ng-lightning template in an ngModule I've got template parse error. From a single component it is workink but inside an ...
<p><code>Angular</code> is built with modularity in mind: this means that each Module should declare or import every component, directive and pipe that it wants to use.</p> <p>For the parser to recognize a component, it <em>must</em> have been declared in the current module, or exported by another module that the curr...
React native: How to combine external and inline styles? <p>This is a part of a _renderRow-function. I have some basic styles for a button, and also a style that is read from a variable on the row. In this example it's '#f00' but it could be a variable, like thisColor. How can I combine an external style with an inline...
<p>Can use the spread syntax:</p> <pre><code>&lt;TouchableHighlight style={{ ...styles.button, backgroundColor: '#f00'}} </code></pre>
Unable to save Selected File to directory when not on the development server <p>When I am on the development server testing, the following code will save the document in the directory I want it to be in... But when I test it on another computer from the network, the file will not save to the directory. The Directory ha...
<p>I figured it out... So silly on my part. </p> <p>When I copied the website from development to production, I didn't change the physical directory to match what was in production. </p>
Error accessing Swift dictionary value <p>I'm using a provided value to access an array value from a dictionary:</p> <pre><code>print("thisFrom "+thisFrom) print(values[thisFrom]) let ingredientArr = values[thisFrom] as! [String: Float] </code></pre> <p>But this is the output:</p> <pre><code>thisFrom cup Optional(["...
<p><code>values[thisFrom]</code> is not of the type <code>[String: Float]</code>. It is <code>[String: Double]</code> instead.</p> <p>Why?</p> <p>Let's have a look at the value for the key "butter": It is a <a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/...
TypeError: not enough arguments for format string - Python SQL connection while using %Y-%m <pre><code>with engine.connect() as con: rs = con.execute(""" SELECT datediff(STR_TO_DATE(CONCAT(year,'-',month,'-',day), '%Y-%m-%d') , current_date()) from TABLE ...
<p>It sees your <code>%</code> signs and thinks you want to format the string. I believe you should be able to replace them with <code>%%</code> to indicate that you want the character, not a format substitution.</p>
MATLAB: Moving Integrator (Sum) Window with Varying Size, Based on a Condition <p>I'd like to define the start and end indices of a moving integrator (sum) window based on the cumulative sum of the values of <code>array</code>. Each window should have a cumulative sum of less than or equal to a threshold. </p> <p>The ...
<p>The idea is that if we want to get cumulative sum from an starting index <code>k</code> there is no need again to compute cumsum. Instead only cumsum computed onec, and disired cumulative sum is difference of original cumulative sum and <code>k-1</code>th element of original cumulative sum</p> <pre><code>original_S...
Shortest possible JS code to get ids of all elements of a given tag <p>I want to gather all the ids on a page for <code>foobar</code> elements into a comma-delimited string. For example:</p> <pre><code>&lt;div&gt; &lt;foobar id="456"&gt;&lt;/foobar&gt; &lt;foobar id="aaa"&gt;&lt;/foobar&gt; &lt;foobar id="987"&...
<p>With ES5 I belive there is not much that can be done, however note that the default argument value for the <code>join</code> function is ',' so you can skip that and it will end up like: </p> <pre><code>[].slice.call(document.getElementsByTagName("foobar")).map(function(a){return a.id}).join() </code></pre> <hr> ...
Rails 4: Turn complicated filter into a scope <p>I have a many-to-many / has-many-through relationship in my connecting my recipe model to my tag model such that:</p> <pre><code>class Tag &lt; ActiveRecord::Base has_many :taggings has_many :recipes, through: :taggings end class Tagging &lt; ActiveRecord::Base...
<p>You can basically convert most association-method-chains (though not all*) into a scope</p> <p>eg I'd try this (note: not tested for bugs) and see how it turned out</p> <pre><code>scope :tagged_with, -&gt;(name) { find_by_name!(name).recipes } </code></pre> <p>If that doesn't work, I'd try something like:</p> <p...
Javascript setInterval doesn't work <p>I have this code that has to be a tree with random signs. I put setInterval to change the signs every second, but nothing happens and I don't get even any error. Someone please tell me where I made a mistake, or more :).</p> <p>OLD VERSION</p> <p><div class="snippet" data-lang="...
<p>I tested the code on Google Chrome and it worked correctly.</p> <p>Only had an <code>undefined</code> error in <code>arraySigns</code>.</p> <p><a href="https://i.stack.imgur.com/ls1qJ.png" rel="nofollow"><img src="https://i.stack.imgur.com/ls1qJ.png" alt="Image generate tree"></a></p>
How do you expand all objects in the console view of chrome? <p>Is there a short cut for me to expand all these objects? I have attached a photo of what i would like to expand below. Any help would be amazing.</p> <p><a href="https://i.stack.imgur.com/dwnu2.png" rel="nofollow"><img src="https://i.stack.imgur.com/dwnu2...
<ol> <li>Switch devtools to detached/floating window by clicking its Settings button, dock side: undock.</li> <li>Press <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>i</kbd> inside the devtools window to open devtools for the devtools.</li> <li><p>Paste and execute the following code in the newly opened devtools window:</p> <...
Firebase Authentication is not working for me <p>In documentation for Auth with Facebook says: </p> <blockquote> <p>Make sure your OAuth redirect URI (e.g. my-app-12345.firebaseapp.com/__/auth/handler) is listed as one of your OAuth redirect URIs in your Facebook app's settings page on the Facebook for Developers si...
<p>I'm not sure what you're trying to do, but if you have app and do want to use firebase functionality to authenticate the user with facebook you have to install FBSDK and implement it in your code.</p>
How to perform CRUD operations on a Heroku DB from a Heroku Java Web app <p>I have a simple Java web app deployed in Heroku at <a href="https://wallpostapi.herokuapp.com/" rel="nofollow">this link</a> and I've also attached a Heroku <code>hobby-dev</code> <strong>POSTGRES</strong> database to it. </p> <p>I'm trying to...
<p>Use JDBC to connect to the database and you can easily perform crud operations.</p> <p>For ex:</p> <p>private static Connection getConnection() throws URISyntaxException,SQLException{</p> <pre><code>URI dbUri = new URI(System.getenv("DATABASE_URL")); String username = dbUri.getUserInfo().split(":")[0]; String pas...
Passing and copying arrays? <p>I am trying to create two Arrays in main then call a method where the values of the first array(which I randomized) are copied to the second array,I am getting stuck at calling the method and passing. I am lost on how to call and pass arrays any help would be appreciated. </p> <pre><cod...
<p>You didn't passed your arrays to the method, replace <code>copyArray();</code> by <code>copyArray(ar, at);</code>.</p>
Retrieve table data based on specific condition in Teradata <p>I have a table with below data:</p> <pre><code>emp_id | emp_sal | emp_grp 1 5 HMCCR 1 10 HMCPR 1 20 HMCPR 1 30 HMCPR 1 40 HMCRR 2 40 HMCRR 2 50 HMCCR </code...
<p>You can use <code>row_number</code> with some logic to get the emp_grp HMCPR to be ordered first if it exists.</p> <pre><code>select emp_id,emp_sal,emp_grp from ( select e.*, row_number() over(partition by emp_id order by case when emp_grp = 'HMCPR' then 0 else 1 end,emp_sal) as rn from db_wrk....
How to use AppenderSkeleton, Logger and LoggingEvent in Log4j_2.x <p>I am new to using log4j. My current task involves migrating log4j 1.2 to log4j 2.6. We use slf4j version 2.x of log4j. I have updated jar files to required versions. I am getting following error in finding symbols AppenderSkeleton, Logger and LoggingE...
<p>Depending on your current usage: have you customized Log4j 1 components, or is your application simply calling the Log4j 1 library?</p> <p>If no customization you can continue to use the SLF4J API or even the Log4j 1 API (using the log4j-1.2-api module). </p> <p>If you have custom Log4j 1 components you need to ta...
get, access and modify element values for an numpy array <p>I once saw the following code segment</p> <pre><code>import numpy as np nx=3 ny=3 label = np.ones((nx, ny)) mask=np.zeros((nx,ny),dtype=np.bool) label[mask]=0 </code></pre> <p>The <code>mask</code> generated is a bool array</p> <pre><code>[[False False Fals...
<p>Here is a code snippet with some comments that might help you make sense of this. I would suggest you look into the link that @Divakar provided and look into <a href="https://docs.scipy.org/doc/numpy-1.10.1/user/basics.indexing.html#boolean-or-mask-index-arrays" rel="nofollow">boolean-indexing</a>. </p> <pre><code...
How to assign a value to more than one element of an array using loops? <p>I'm trying to write a program that makes each month of the year an array. Each month has different charges, some occur every month, some only occur every few months. We have to write this program using only loops, so I'm wondering how I can assi...
<p>Your second loop wouldn't work like you expect, instead perform the math in your first loop. Something like,</p> <pre><code>for (month = 0; month &lt; yearlyExpenses.length; month++) { yearlyExpenses[month] = rent + miscExpenses; if (month == 0 || month == 5) { yearlyExpenses[month] = yearlyExpenses[month] ...
Why does my custom UICollectionViewLayout throw an error when adding space between cells? <p>I'm making a custom <code>UICollectionViewLayout</code> class for practice, essentially trying to reproduce the horizontal flow layout where cells are laid out horizontally infinitely.</p> <p>Everything was working perfectly w...
<p>Found the solution! Apparently overriding <code>layoutAttributesForItem(at indexPath: IndexPath) -&gt; UICollectionViewLayoutAttributes?</code> fixes the issue! But I have no idea why.</p>
Cannot assign to property: ‘inputAccessoryView’ is a get-only property <p>Within my swift app, I am trying to hide the inputAccessoryView that shows when a user taps a textfield inside of a webview.</p> <p>Here is the code attempting to do that:</p> <pre><code> func keyboardWillShow(notification: NSNotification)...
<p>I think the error is due to the way the keyboardView is declared.</p> <p>When I create my own UIView and assign it as the inputView for a first responder, I can then assign (or set to nil) the first responder's inputAccessoryView.</p> <p>I assume you are trying to remove an existing accessory view, as Apple says t...
Cannot connect to SQL server from python using Active Directory Authentication <p>I am using pymssql library to connect python to Sql Server. I can connect using windows/sql server authentication. I want to connect using Active Directory Authentication. </p> <p>Tried the below connection string. But it fails with erro...
<p><a href="http://pymssql.org/en/latest/ref/pymssql.html#functions" rel="nofollow">Note that pymssql.connect does not have an 'authentication' parameter</a>. You are passing it that as a named arg, which is invalid, and the reason you see your error.</p> <p>See <a href="http://pymssql.org/en/latest/pymssql_examples.h...
Type 'void' is not assignable to type 'any[]' <p>I am getting error at following line of the constructor code</p> <pre><code>this.data = this.getRisks(); . </code></pre> <p>The error is </p> <blockquote> <p>Type 'void' is not assignable to type 'any[]'.</p> </blockquote> <p>Could somebody tell me how do i assign...
<p>Since <code>getRisks()</code> doesn't return anything, simply call it and it will set <code>this.data</code></p> <pre><code>constructor(private _riskService: RiskService) { this.getRisks(); this.loadRisks(); } </code></pre> <p>You can set <code>this.data = []</code> if you need it to be defined before dat...
output truncated when writing to a file in python <p>i have unusual problem, i'm using Anaconda and my python code runs really good the output on the screen is perfect, however, after each print i put file.write to write my result in my file as well but not all output is written there every time it truncates the output...
<p>i just added the parenthesses to the file.close it fixed the problem ... thanks and sorry for the </p>
Artifactory delete all artifacts older than 6 months <p>How would you delete all artifacts that match a pattern (e.g older than 6 months old) from artifactory? </p> <p>Using either curl, or the go library</p>
<p>The jfrog cli takes a spec file to search for artifacts. See here for <a href="https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-UsingFileSpecs" rel="nofollow">information on jfrog spec files</a></p> <p>The jfrog cli <a href="https://www.jfrog.com/confluence/display/CLI/C...
Capture two parts of the same string with PHP <p>I have a list with this structure</p> <pre><code>Boss: (test 23, of 2014) Boss: (test 42, of 2015) Boss: (test 70, of 2016) </code></pre> <p>How can I capture the numbers in the string and wrap then in spans? So the structure will end like this:</p> <pre><code>Boss:...
<p>This function can help here</p> <p>step one:</p> <p><code>preg_replace('# ([0-9]{2}),#','&lt;span class="test_$1"&gt;$1&lt;/span&gt;',$input);</code></p> <p>step two:</p> <p><code>preg_replace('# ([0-9]{4})#','&lt;span class="year_$1"&gt;$1&lt;/span&gt;',$input);</code></p>
Javascript create array with fixed value but matching column amount from another array <p>I have an array which is built from data dynamically, so it can change.</p> <p>It's basically this:</p> <pre><code>["t1", "something", "bird", "dog", "cow", "fish"] </code></pre> <p>What I need to do is to count how many of the...
<p>You can use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow"><code>Array.prototype.map</code></a> method:</p> <pre><code>var input = ["foo", "bar", "baz"]; var mapped = input.map(function () { return 1; }); </code></pre>
PHPUnit - Mocking a trait <p>I have a trait that is used by multiple classes, i.e </p> <pre><code>class SomeClass { use TimeoutTrait; function handle() { $this-&gt;traitFunction() // can this be mocked? } } </code></pre> <p>PHP unit is capable to mock the traitFunction()?.</p> <p>Thanks ...
<p>The simplest way is to mock the parent class and then do your unit tests on the trait. Or you can make a specific class to implement the trait, solely for unit testing, but that assumes your trait doesn't do anything that interacts with the parent or vice versa.</p>
Unit testing apache httpconfig <p>I have a big, complex config file for httpd, which contains many reverse proxy blocks, redirects, IP whitelists and aliases.</p> <p>Is it possible to run unit tests against this config file?</p> <p>i.e.</p> <ol> <li>Request to /account/login should be sent to the reverse proxy login...
<p>How about this:</p> <ol> <li>install bats - <a href="https://github.com/sstephenson/bats" rel="nofollow">https://github.com/sstephenson/bats</a></li> <li>install docker - <a href="https://docs.docker.com" rel="nofollow">https://docs.docker.com</a></li> <li>install host-manager - <a href="https://github.com/macmade/...
Deleting file on sdcard on Android 4.4.x KitKat <p>I am attempting to delete a file on the sdcard on Android 4.4.x (KitKat). From my understanding, we cannot simply invoke File.delete(...) since this is no longer supported. We'll need to use the storage access framework.</p> <p><a href="https://developer.android.com...
<p>Alrighty, I found a solution. For whatever reason, I updated my android support library from 23.0.1 -> 24.2.0 and it seems to have worked. I tried looking through the release notes of the support library as well as closed issues in the Android source, but couldn't find anything related to my fix. I guess I should...
Can't run tests from Espresso Test Recorder <p>I used the test recorder to create a simple UI Test. However when I run the test that was generated, I get an error</p> <pre><code>Error:(4, 37) error: package android.support.test.espresso does not exist Error:(5, 33) error: package android.support.test.rule does not exi...
<p>Did you add forget add espresso to your dependencies ?</p> <pre><code>androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2' </code></pre>
Python: Pandas, dealing with spaced column names <p>If I have multiple text files that I need to parse that look like so, but can vary in terms of column names, and the length of the hashtags above: <img src="https://s4.postimg.org/8p69ptj9p/feafdfdfdfdf.png" alt="txt.file"></p> <p>How would I go about turning this in...
<p>Consider reading in raw file, cleaning it line by line while writing to a new file using <code>csv</code> module. Regex is used to identify column headers using the <em>i</em> as match criteria. Below assumes more than one space separates columns:</p> <pre><code>import os import csv, re import pandas as pd rawfile...
Undefined Reference to sem_wait and pthread_create when compiling with g++ <p>I am fairly new to C and do not understand why I am getting these errors when I try to compile my program using <code>g++ ./main.c</code>. I have tried looking at other resources and I am unable to find the answers I need. If there is a solut...
<p>Add the <code>-pthread</code> param to pull in all the threading stuff for linking</p> <pre><code>g++ ./main.c -pthread </code></pre>
How to make Windows 10 Store "forget" an app download for testing purposes? <p>I'm testing my Win32 app converted to UWP, so I'm new to the whole Windows 10 Store concept.</p> <p>So far I was able to get my app certified &amp; published in the store via a private link. Now I would like to download and test it, but the...
<p>If you have bought the app you can't undo that, but you can always create a new user who has never bought for the testing purpose.</p> <p>EDIT: Windows Store is for real transactions and not for testing. If you want to test, you should have a custom build that uses <a href="https://msdn.microsoft.com/en-us/library/...
Turbolinks wipes out jQuery Mobile classes <p>When I load a page in my rails app using Turbolinks, the DOM lacks the styles that are normally applied by <a href="https://jquerymobile.com/" rel="nofollow">jQuery Mobile</a>. All of my JavaScript files run; the only problem is that I lose some of the styles I need for the...
<p>The "answer" is that Turbolinks and jQuery Mobile do many of the same things (both replace full page loads with AJAX), and <a href="https://forum.jquery.com/topic/using-pjax-or-turbolinks-with-jquery-mobile-on-a-rails-app" rel="nofollow">one does not need to use both</a>, and they are not designed to work together. ...
Is it possible to use something like @RequestParam for JSON in spring rest services? <p>I use Spring boot and i am writing rest services server in Spring I have a lot of different requestmappings, and i need to accept content in json</p> <p>I can do that with <code>@RequestBody</code> annotation But in this case i wil...
<p>I am not aware of anything like that which spring offers. But I have some suggestions, if you will :)</p> <ol> <li>You can generate the Spring model classes from the contract (a json schema, or swagger spec). Even though this adds classes, at least you are not manualluy maintaining it</li> <li>If you are so concern...
Databases won't update after upgrade to MAMP Pro 4 <p>After upgrading to MAMP Pro 4, I see two issues.</p> <hr> <h2>1. Hosts can't be found</h2> <p>Opening sites in the browser fail - sites can't be found. This isn't a database issue and looks to be an apache error</p> <hr> <h2>2. Mysql upgrade scripts fail</h2> ...
<p>In the end, I had to use these steps to downgrade to 3.5.2.</p> <p><a href="https://appsolute.zendesk.com/entries/111595586-I-want-to-revert-back-to-MAMP-PRO-3-52-" rel="nofollow">https://appsolute.zendesk.com/entries/111595586-I-want-to-revert-back-to-MAMP-PRO-3-52-</a></p> <p>Very frustrating but as others have ...
Design Service Manager Class which uses external services using GUICE <p>In my application I have a Service Manager that handles all my requests. Now this Service Manager uses external services in order to fulfill some particular kind of requests.</p> <p>For example,consider below sample code:</p> <pre><code> Class S...
<p>Constructor injection has following advantages over setter injection:</p> <ul> <li>Explicitly declare dependencies to whoever is reading the code.</li> <li>Unit testing becomes cleaner.</li> <li>Dependencies can be marked ‘final’, thereby increasing immutability.</li> </ul> <p>A good documentation that discuss...
Python regex issue. Validation works but in two parts, I to extract each valid 'part' separately <p>My code is:</p> <pre><code>test1 = flight ###Referencelink: http://academe.co.uk/2014/01/validating-flight-codes/ #Do not mess up trailing strings p = re.compile(r'^([a-z][a-z]|[a-z][0-9]|[0-9][a-z])[a-z]?[0-9]{1,4}[a-z...
<p>Try this maybe.</p> <pre><code>p = re.compile(r'^([a-z][a-z]|[a-z][0-9]|[0-9][a-z])([a-z]?[0-9]{1,4}[a-z]?)$') m = p.findall(test1) </code></pre>
Why additional memory allocation makes multithread Python application work few times faster? <p>I'm writing python module which one of the functions is to check multiple IP addresses if they're active and write this information to database. As those are I/O bound operations I decided to work on multiple threads:</p> <...
<p>In order to give you an exact explanation it would help to know what version of Python you're using. For instance if you're using PyPy then what you've observed is the JIT kicking in after you call your loop 5 times and it just returns a pre-calculated answer. If you're using a standard version of Python then this s...
VBA excel English 2007 cause error msg on excel 2016 french <p>I have this Macro used to invert the order of the selected row. This Macro run smooth on my english pc with excel 2007 but doesn't work on my french pc with excel 2016. When i run it in the french pc, this line <code>For j = 1 To UBound(Arr, 2) / 2</code...
<p>You will need to change , to ;</p> <p>It is a regional setting causing the problem, the reason for the semicolon is to distinguish from the decimal separator that in many countries is comma instead of dot.</p> <p>Another option is to change the separators in your Excel version (, . and ;)</p>
Got problems with replacing xml nodes within text <p>I'm working on XML-to-XML transformation (Windows 10, Oxygen XML Editor) and got this task: replace <code>&lt;xref id="id1"&gt;text&lt;/xref&gt;</code> with <code>id1</code>.</p> <p>I've done some work but can't get why doesn't scenario replace all xref-s in parenth...
<blockquote> <p>got this task: replace <code>&lt;xref id="id1"&gt;text&lt;/xref&gt;</code> with <code>id1</code>.</p> </blockquote> <p>That could be done easily by:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" version="1.0" encodin...
Design query Like Datasheet ...Ms Access <p>I have a table Exams (ID, StudentID, ExamDate, Subject, Marks)</p> <p>How can I design a query so that Subjects become headers?</p> <p>Like Student Name Math | Biology | History | Language...</p> <p>subquery or any other suggestion?</p> <p>Thanks</p>
<p>Oh, needed to do a crosstab query... Just now figuring out how best to implement it.</p>
How to tell which provider to choose <p>All:</p> <p>I am pretty new to Deepstream, when I try its example of request-response <a href="https://deepstream.io/" rel="nofollow">https://deepstream.io/</a>:</p> <pre><code>// remote procedure call for "times-three" with 7 client.rpc.make( "times-three", 7, function( err, r...
<p>Deepstream does loadbalancing by a combination of randomly selecting the order providers are selected to fulfill the RPC and giving the provider the option of rejecting the RPC if it isn't willing to process it.</p> <p>If your providers do different logic it would be best to name them differently to distinguish th...
4 Floating DIVs that respond symmetrically on narrowing screens with CSS <p>[ 1 ] [ 2 ] [ 3 ] [ 4 ]</p> <p>I have four DIVs floating left (above), using simple CSS: float:left; width:128px;height:128px</p> <p>As I narrow the screen, the last DIV jumps correctly onto the next line:</p> <p>[ 1 ] [ 2 ] [ 3 ]</p> <p>[ ...
<p>Group [3] and [4] together in a div (and [1] and [2] if you desire). Give it a max width, but auto height. That way, when the screen narrows, the two divs should move together side by side, but jump down when the screen gets narrower.</p> <p>ex:</p> <pre><code>.contain { max-width:256px; height:auto; } &l...
R - Issues parsing JSON stream <p>I have searched a lot but unable to find a good solution to my problem.</p> <p>I am trying to automate some of my work and scrape some data from a site that my company uses. (FYI - TOS do not seem to indicate they don't want to be scraped in case anyone is wondering. So I should be go...
<p>Consider reading the string line by line with <code>readLines()</code> and building a list of <em>event</em>, <em>id</em>, and <em>data</em> items, where <em>data</em> will be json strings. But first dump your string to file with <code>writeLines()</code>. The colon-only line is used as the separator between list el...
Filehelpers WriteStream only writing the first 2048 characters to output <p>I am using the Filehelpers library and outputting my csv using the WriteStream method. It is working fine except the file is cutting off in the middle of the data and upon opening the file it only has the first 2048 characters. How do I get it ...
<p>I figured it out. </p> <p>I set the Streamwriter's Autoflush property to true and removed the "Response.Flush" line and it outputs the whole amount of data now.</p>
Sum of the difference of pairs of numbers in an array - Java <p>I'm working on an assignment for a beginning Java course and I am completely stuck on this problem. </p> <p>Write a program that computes the sum of the differences of pairs of numbers in an array. For example if the array is [2, 3, 7, 8, 9, 12] the sum o...
<p>When you use that nested cycle you're doing this:</p> <pre><code>i = 0, j = 1, sum = 3 - 4; // next cycle, i = 0, j = 2, sum = 3 - 5; // etc..., i = 1, j = 2, sum = 4 - 5, // etc..; </code></pre> <p>Which means for each value of <code>A[i]</code> you're making the difference of <code>A[i]</code> and all the values...
Object becoming null after leaving base class in C# <p>I am trying to reduce code from the data layer (Class Library) of a project by making a generic DAO class with virtual methods, this way I will have implementations of this class for the various types needed.</p> <p>For simplicity's sake I will only write the read...
<p>You cast dynamic as ReturnObject which results in null, because it cannot cast one type to another.</p> <p>Try not using dynamic, your method is generic so use T instead, so you dont have to cast</p>
train_on_batch error after first a successful first batch <p>I have the following code. This is within the class CNNEnv. </p> <pre><code> def step(self, a_t, i): self.a_t = a_t self.i = i # Batch size of 32 # 1875 * 32 = 60000 -&gt; # of training samples self.X_train = self....
<p>Solved it. User error. Variable assignment issue.</p> <p>Should use self.X_batch instead of self.X_train. This would solve the problem if anyone is facing it.</p>
Calculate the largets and smallest number fiven exp, bias, and fract <p>Give 8 bits total, where 3 bits are <code>exp bits</code>, 4 bits are <code>frac bits</code> and 1 for <code>sign bit</code>. Have to find the largest and smallest values.</p> <pre><code>0 110 1111 - largest 1 110 1111 - smallest 1) E = exponent ...
<p>I don't know why you chose your bias at 7, but that way you won't be able to get large values.</p> <p>Choose a bias of 3. And make the exponent 7, then you get:</p> <pre><code>0 111 1111 - largest </code></pre> <p>This is </p> <pre><code>M = 1 + 1/2 + 1/4 + 1/8 + 1/16 = 31/16 E = 7 - 3 --&gt; 2^4 = 16 </code></p...
Google Maps two finger pinch/stretch callbacks <p>In my map, I am trying to capture zoom in/out using <code>ScaleGestureDetector</code> but I am <strong>never</strong> receiving any callbacks to either of <code>onScale</code> or <code>onScaleBegin</code> or <code>onScaleEnd</code>.</p> <p>In my Fragment's <code>onCrea...
<p>I was able to get past the issue of getting callbacks. Essentially, two things:</p> <ol> <li>In your activity/fragment, implement, <code>GoogleMap.OnCameraIdleListener</code></li> <li>In <code>onMapReady()</code>, <code>call mMap.setOnCameraIdleListener(this);</code></li> <li>Hence, override <code>onCameraIdle()</c...
C2660: _splitpath_s fails with std::array error in Visual Studio 2013 <p>Visual Studio 2013 is a bit weird on language array that in global function it's allowed to initialize one as <code>char result[100] = { 0 };</code>, but not if it's a class's member -- referring to <a href="https://stackoverflow.com/questions/19...
<p>The 5 parameter version of <code>_splitpath_s</code> is a template function, expecting a character pointer for the input path, and C-style character arrays for the other 4. Since you are passing in C++ <code>array</code> objects, the template is not generated and, due to SFINAE it is not available so there is no fu...
Integrating COUNT into postgres query <p>I have a table titled <code>users</code> and below it is the <code>tracks</code> table and below that is the <code>likes</code> table. The <code>users</code> table has an <code>id</code> column for the users ID and the <code>tracks</code> table has a <code>id</code> column for ...
<p>I believe that PostgreSQL supports common table expressions. I assume that the query that you're writing is to drive a UI component and that you want to show the track information, the date that the current user liked the track alongwith the count of total likes. </p> <pre><code>WITH t_count AS ( SELECT track...
CMFCMenuButton not properly repainting when toggling high contrast mode <p>In an C++ MFC project I'm using <a href="https://msdn.microsoft.com/library/bb983215(v=vs.100).aspx" rel="nofollow"><code>CMFCMenuButton</code></a> using MSVC 2013.</p> <p>When I toggle the <a href="https://support.microsoft.com/en-us/instantan...
<p>Took me a while, but I was able to solve this. I'm inheriting from the <a href="https://msdn.microsoft.com/library/bb983215(v=vs.100).aspx" rel="nofollow"><code>CMFCMenuButton</code></a> class so that I can handle some events:</p> <ol> <li><p>Get the color on the button right:<br>Handle the <a href="https://msdn.mi...
Scrolling up or down from section to section automatically <p>I'm trying to implement something in JS like the following. In a page, every time I scroll up or down, the following div(section) in viewport has to be shown. For example, if I scroll down, the page has to move automatically down to the next div(section) an...
<p>Personally, I would recommend against scrolling panes into view on a scroll, they are inconsistent and awkward to use, especially on things such as trackpads or other "mice" with accelerating scrolling.</p> <p>However, a jQuery solution to scrolling one view port at a time could look like:</p> <pre><code>var lastS...
How to resolve constructor signature in factory function <p>I want to support one of two possible signatures of the constructor of the class <code>T</code> when creating its instance in the <code>create(...)</code> function below:</p> <pre><code>template &lt;class Т, typename... Args&gt; T* create(Special* s, Args&am...
<p>Just use <a href="http://en.cppreference.com/w/cpp/types/is_constructible"><code>std::is_constructible</code></a>:</p> <pre><code>namespace detail { template&lt;typename T, typename... Ts&gt; auto create(std::true_type, Special* s, Ts&amp;&amp;... args) { return new T(s, std::forward&lt;Ts&gt;(args)...); } tem...
Python runs the commented-out code <p>I have a problem that sometimes <code>docker-py</code> returns an error:</p> <pre><code>Permission denied. </code></pre> <p>I'm trying to fix it. I commented out the piece of code, and received the following picture.</p> <pre><code>File "/opt/dst/src/utils/runner.py", line 48, i...
<p>Due to an error in the script, worked two instance celery and this error occurred during the operation instance, who has worked with the old code.</p>
Search for value within a range of values in two separate vectors <p>This is my first time posting to Stack Exchange, my apologies as I'm certain I will make a few mistakes. I am trying to assess false detections in a dataset. </p> <p>I have one data frame with "true" detections </p> <pre><code>truth= ID Start St...
<p>I'll post a solution that I'm pretty sure works like you want it to in order to get you started. Maybe someone else can post a more efficient answer. </p> <p>Anyway, first I needed to generate some example data - next time please provide this from your own data set in your post using the function <code>dput(head(tr...
What Should I fix in my C code? <p>I want to start off by saying that I am not asking for the answer, however I would like some advice on what I should be looking for in the syntax. This is one of my first few C assignments. My code have an output like shown below.</p> <pre><code>How many grade items would you like to...
<p>You can use <code>for</code> loop to input a number of values:</p> <pre><code>int a, sum = 0; int n; printf("\nHow many grade items would you like to enter? "); scanf("%d", &amp;n); int i; for (i = 1; i &lt;= n; ++i) { printf("\nEnter the score for Assignment %d: ", i); scanf("%d", &amp;a); sum = sum + ...
Javascript Class Variable Scope Becomes Undefined <p>so I have a class names <code>Session</code>.</p> <p>I declare it as:</p> <pre><code>function Session() { } </code></pre> <p>I have a function called as: <code>Session.prototype.parseCommand(){}</code>.</p> <p>For some reason, if I call the function as: <code>thi...
<p>When any method in declared on prototype you cannot call them using this it has to be called directly through the object</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>f...
error in code involving while loop and removing items from string <p>I have a code that downloads tweets and I am trying to sort through it labeling it as positive or negative each time i label a tweet I want to remove it from the string so I won't be asked to label it again here is my code so far</p> <pre><code>while...
<p>You could do something like:</p> <pre><code>newList = [] for myLetter in myList: if myLetter is not 'x': newList.append(myLetter) newString = ''.join(newList) </code></pre>
Combine an array based on iteration and make it multidimensional <p>So I have two arrays. Let's call them member_ids and member_names</p> <p>So the first array (member_ids) could look like:</p> <pre><code>Array ( [0] =&gt; 572149922960422 [1] =&gt; 1586735531587728 [2] =&gt; 10844793349086...
<p>You could do something like:</p> <pre><code>&lt;?php $ids = [ 572149922960422, 1586735531587728, 1084479334908663, 9875443331682, 9291002010388, 2108382717199939, 911647002295982, 100222991929377 ]; $names = [ "John Doe", "Jane Doe", "Shawn Smith", "Jack Nickleson",...
Unable to use echo with php form <p>My PHP form seems to be operating fine. The page comes up and when I click on the submit button, the isset($_POST['submitted']) condition at the start is hit and the code run.</p> <p>The only issue is that I have a couple of echo lines in the code to produce a JS alert box. Neither ...
<p>I've tried your code and it seems to work fine in my case. </p> <pre><code>&lt;?php if (isset($_POST['submitted'])) { $output = "done"; //even if this line is not equal to 'done', the code still works fine if ($output != "done") { echo '&lt;script type="text/javascript"&gt;alert("' . $output . '");&lt;/script&g...
Javascript making image rotate to always look at mouse cursor? <p>I'm trying to get an arrow to point at my mouse cursor in javascript. Right now it just spins around violently, instead of pointing at the cursor. </p> <p><strong>Here is a fiddle of my code: <a href="https://jsfiddle.net/pk1w095s/" rel="nofollow">https...
<p>In the first instance, get rid of the conversion to degrees - both the <code>Math.atan2</code> and the <code>ctx.rotate</code> functions take radians.</p> <p>That fixes the wild rotation - you still then have some math errors, which are most easily sorted out by splitting out the drawing from the math.</p> <p>The ...
Pattern for asking Javascript to pay attention to multiple element events? <p>I'm writing a Javascript library to monitor how the user interacts with form fields. It will have to monitor multiple events for a given element, so I can't use an onblah handler.</p> <p>I would like the HTML author to decide what fields are...
<p>You have many options. Maybe try going with a <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes" rel="nofollow">data</a> tag:</p> <pre><code>&lt;textarea name="blah" data-monitored="true"&gt; </code></pre> <p>and in your JS you collect all these elements using a method like so:...
Docker compose extra hosts with wildcards <p>I'm trying to create a container based on PHP:5-apache with many virtual hosts like</p> <ul> <li><p>account.site1.local</p></li> <li><p>account.site2.local</p></li> <li><p>account.site3.local</p></li> </ul> <p>I can add all the vhosts with a wildcard on the apache conf. Is...
<p>Docker sets up the <code>hosts</code> file when you run a container, so you don't want to manually edit it. Instead you can use the <code>add-host</code> option:</p> <pre><code>&gt; docker run --add-host 1.local:127.0.0.1 alpine ping 1.local PING 1.local (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: seq=0 ttl...
Power BI DAX Calculating Last week Sales for All the Filter Options <p>I have following Data Structure</p> <pre><code>Date | Category | Sales Amount ---------------------------------------------------- 01-Sep-2016 | Food | 100 02-Sep-2016 | Food | 120 03-Sep-2016 | Food ...
<p>If I understand your question, the problem is that you have a <code>Category</code> column so you need to get the sales two weeks back in the time in the current category value evaluated in the expression. You just have to add an additional condition in the <code>FILTER</code> function to take the current <code>Cate...
Command pattern for restaurant use case <p>I just start to learn design patterns, one is the command pattern. After reading some materials and some documentations, such as </p> <p><a href="http://www.oodesign.com/command-pattern.html" rel="nofollow">http://www.oodesign.com/command-pattern.html</a> <a href="https://www...
<p>I believe you're not thinking about the restaurant example correctly. A customer doesn't give it's order directly to the cooks, a waitress takes the order to the kitchen and puts it in the queue where the cooks can take an order to make when they're available.</p> <p>In code, this would look like a shared queue tha...
html javascript - onclick() reference error: function not defined <p>Given my html file, the console gives an error code: </p> <blockquote> <p>Reference Error: loadData not defined.</p> </blockquote> <p>Based from other answers I've rechecked mine where, </p> <ol> <li>My function is declared just before the <code>...
<p>I've tested your html and everything seems to be working properly. The only error that I found was that $ajax is not a function. It is missing a dot $ajax => $.ajax</p> <p>Try using:</p> <pre><code>function loadData(documentId){ $.ajax({ url:"/load", data: {'documentId': documentId}, type: 'GET', ...
How to write unittest for variable assignment in python? <p>This is in <code>Python 2.7</code>. I have a class called <code>class A</code>, and there are some attributes that I want to throw an exception when being set by the user:</p> <pre><code>myA = A() myA.myattribute = 9 # this should throw an error </code></p...
<p>You can also use <code>assertRaises</code> as a context manager:</p> <pre><code>with self.assertRaises(AttributeError): myA.myattribute = 9 </code></pre> <p>The <a href="https://docs.python.org/3/library/unittest.html#basic-example" rel="nofollow">documentation shows more examples for this if you are intereste...
How to get max of the rows above in each group(Sql or SAS) <p>Data:</p> <pre><code>ID step order 100 1 1 100 2 2 100 3 3 100 1 4 200 2 5 200 3 6 200 1 7 </code></pre> <p>Desired Result( I want to get the max of the rows above in each group)</p> <pre><code>ID step max_step 100 1 ...
<p>If your database supports windowed aggregate then</p> <pre><code>SELECT id, step, Max(step) OVER( partition BY ID ORDER BY "order") as max_step From yourtable </code></pre> <p>If you want to max step from above rows irrespective of <code>ID</code> then remove the <code>partition by</code></p> <pre><...
Where is the memory allocated for p <pre><code>package main import ( "io" "os" "strings" ) type rot13Reader struct { r io.Reader } func (rot *rot13Reader) Read(p []byte) (n int, err error) { n, err = rot.r.Read(p) //&lt;---- where allocated the mem for p? for i := 0; ...
<p>io.Copy will call the method Read() of the io.Reader, take a look to the implementation <a href="https://golang.org/src/io/io.go?s=12490:12550#L349" rel="nofollow">https://golang.org/src/io/io.go?s=12490:12550#L349</a> and if you keep reading just a few lines below you'll find the method copyBuffer() and inside you ...
updateTabsetPanel now, without delay <p>In the following minimal example, note that while the <code>file.choose()</code> line is commented out, the code works as expected: clicking the OK button on the <em>Input</em> tab switches to the <em>Results</em> tab.</p> <p>However, uncomment the <code>file.choose()</code> lin...
<p>You can do it in two steps: 1. Switch the tab; 2. Based on the tab switching event, open the file choose window.</p> <pre><code>ui &lt;- fluidPage(fluidRow( tabsetPanel(id="main", tabPanel("Input", actionButton("okButton", "OK")), tabPanel("Results", h3(textOutput("results"))) ))) s...
What is the symbol for the integer modulo operation in ATS? <p>For instance, how to write in ATS the following C code:</p> <pre><code>int intmod(int m, int n) { return m % n; } </code></pre>
<p>There are mod and nmod in ATS. You can also use % for mod.</p> <p>Note that mod is given a non-dependent types while nmod is given a dependent type. For details, please visit:</p> <p><a href="http://ats-lang.sourceforge.net/DOCUMENT/ATS-Postiats/prelude/HTML/SATS/integer_sats.html" rel="nofollow">http://ats-lang.s...
Iterating through list in reverse <p>Assume the following (non-functioning) code, that takes a predicate such as <code>(==2)</code> and a list of integers, and drops only the last element of the list that satisfies the predicate:</p> <pre><code>cutLast :: (a -&gt; Bool) -&gt; [Int] -&gt; [Int] cutLast a [] = [] cutLas...
<p>Borrowing heavily from <a href="http://stackoverflow.com/questions/40030460/haskell-split-string-on-last-occurence/40032635#40032635">myself</a>: the problem with this sort of question is that you don't know which element to remove until you get to the end of the list. Once we observe this, the most straightforward ...
TabLayout change selected TabSize <pre><code>TextView title = (TextView)(((LinearLayout ((LinearLayout) mTabLayout.getChildAt(0)).getChildAt(tabPosition)).getChildAt(1));title.setTextSize(...); </code></pre> <p>I got the tabs <code>Textview</code> in <code>Tablayout</code> by this method,but this method is strange,i...
<p>You could try this one.. You can set each tabs text size and other properties.. You can take a look here for more info <a href="https://programmingcode4life.blogspot.my/2016/07/custom-tablayout-android.html" rel="nofollow">Custom tablayout</a></p> <pre><code> ViewGroup vg = (ViewGroup) tabs.getChildAt(0); ...
Looking for an explanation for the following code regarding loops in Java <p>I needed to create a program in Java using loops to print the following numbers 5,13,17. My professor gave us the following solution for the program </p> <pre><code> public class nowtry { public static void main(String[] args){ ...
<p>First,</p> <pre><code>x = 2 i = 1 print 5 * 1 = 5 </code></pre> <p>Second,</p> <pre><code>x = 3 i = 2 print (5 * 3) - 2 = 13 </code></pre> <p>Third,</p> <pre><code>x = 4 i = 3 print (5 * 4) - 3 = 17 </code></pre>
Google Maps V3 API - Center on a category pulling from xml file <p><a href="http://www.geocodezip.com/v3_MW_example_categories.html" rel="nofollow">I'm working with this example from Geocodezip</a></p> <p>The markers on the map change depending on which category is selected. I would like them to automatically center o...
<p>To zoom to the last "shown" category, add the markers to a <a href="https://developers.google.com/maps/documentation/javascript/reference#LatLngBounds" rel="nofollow">google.maps.LatLngBounds</a> object, then call <a href="https://developers.google.com/maps/documentation/javascript/reference#Map" rel="nofollow">map....
Selenium printing <pre><code>public void Check() { String[] List = new String[3]; PageSource = driver.getPageSource(); List[0]= "Test1"; List[1]= "Test2"; List[2]= "Test3"; for (int count = 0; count &lt; List.length; count++) { if (PageSource.equals(List)) { System.out.println(List); } ...
<p>i think if your Page Source contains the specific value you are searching, your integer code is always going to print a numeric value. code is printing value of "foundKey" which is a integer in your case, you can change the below line code according to your need: </p> <pre><code> System.out.println(foundKey) </cod...
str.replace function raise erorr that an integer is required <p>I wanna ask the problem I encountered. At first, Let me show you my whole code</p> <pre><code>df1 = pd.read_excel(r'E:\내논문자료\골목상권 데이터\이태원로 54길 내용뺀거.xlsx' , sheetname='first_day_datas') df1.registerdate= df1.regis...
<pre><code>df2 = pd.to_datetime(df1['registerdate'].str[0:10]) # \____________/ # returns a series </code></pre> <hr> <pre><code>df2['registerdate'].str.replace('-', '').str.strip() #\_______________/ # is only something # if 'registration # is in the index # this is probably the source of your error </code></...
Why does chunk_while return Enumerator Class object <p>Why does chunk_while return Enumerator Class object</p> <p>This code</p> <pre><code>array = [0, 1, 2, 3, 4, 5, 7, 8, 9, 15, 16] p array.chunk_while {|i,j| i + 1 == j } </code></pre> <p>print this</p> <pre><code>#&lt;Enumerator::Generator:0x00000002bef0a8&gt;:ea...
<p>Methods in the <a href="http://ruby-doc.org/core-2.3.0/Enumerable.html" rel="nofollow">Enumerable</a> module, such as <code>chunk_while</code>, require that receivers be enumerators, that is, instances of the class <a href="http://ruby-doc.org/core-2.3.0/Enumerator.html" rel="nofollow">Enumerator</a>. Therefore if a...
Creating a New Variable in SPSS with a Value Equal to Another Variable <p>I apologize for the confusing title. Essentially, the intended functionality in SPSS is working with the following data file:</p> <pre><code>Monday Tuesday Wednesday Day of Interest Temperature on Day of interest 72 78 ...
<p>Creating some fake data to demonstrate on:</p> <pre><code>data list list/Sunday Monday Tuesday Wednesday Thursday Friday Saturday Day_of_Interest . begin data 41 42 43 44 45 46 47 2 51 52 53 54 55 56 57 6 61 62 63 64 65 66 67 4 71 72 73 74 75 76 77 7 81 82 83 84 85 86 87 1 end data. </code></pre> <p>Now it is ...
Bluetooth BLE programming import error <p>everyone !</p> <p>I am designing a <strong>Bluetooth BLE 4.0</strong> application and I firstly copied a sample application from the internet to see how to develop it.<br> I expect to see somebody else to write search and display and do some works on BLE device. And everything...
<p><a href="https://developer.android.com/reference/android/bluetooth/le/ScanCallback.html" rel="nofollow">ScanCallback</a> and <a href="https://developer.android.com/reference/android/bluetooth/le/ScanResult.html" rel="nofollow">ScanResult</a> were only added in API 21.<br> Make sure that API 21 is installed and also ...