input
stringlengths
51
42.3k
output
stringlengths
18
55k
sort a table based on the column values <p>I want to sort a table when some button is clicked. If the button with id "easy" is clicked I want to sort by easy levels, if the button with id hard is clicked I want to sort by hard levels, in a descending order.</p> <p>Im trying to do this for the easy button case and I al...
<p>You can achieve this using <a href="http://tablesorter.com/" rel="nofollow">tablesorter</a> jquery plugin:</p> <pre><code>$(document).ready(function() { $("#myTable").tablesorter(); } ); </code></pre>
How to get equal spaces within each property in JSON using GSON? <p>I am using Gson to play with JSON. In my below code:</p> <pre><code>JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("fname", "john"); jsonObject.addProperty("lname", "cena"); System.out.println(jsonObject.toString()); </code></pre> <...
<p>You can use Gson's pretty printing. JSON.org's library has something similar as well. (I'm sure Jackson does as well). Note: this will also format it so it's very readable.</p> <pre><code>Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(obj); System.out.println(json); </code><...
Nested Attribute Form Validation Bugs <p>I'm seeing an odd bug with a nested attribute form. I have two models, <strong>Parties</strong>, and <strong>Guests</strong>. Party has_many Guests, and Guest belongs_to Party. I have a form that creates Guests through Party.</p> <p>The bug I'm seeing is as follows:</p> <ul...
<pre><code> &lt;%= form_for [@event, @party] do |f| %&gt; &lt;/ul&gt; </code></pre> <p>Why is your open-form tag half inside the <code>ul</code> ? Where is the matching end? A form is a block-level component - it should be fully contained within the outer block - not half in one tag and half in another.</p> <p>I d...
Changing ASP.NET Identity Password <p>I have a class that creates a user by searching for the email and making sure it doesn't exist and it creates a user:</p> <pre><code>public async Task EnsureSeedDataAsync() { if (await _userManager.FindByEmailAsync("test@theworld.com") == null) { //...
<p><code>FindByEmailAsyc</code> returns the user object, you need to save it to a variable and pass that to the other userManager calls. Also, the <code>RemovePassword</code> and <code>AddPassword</code> methods take the key value of your <code>User</code> object as a parameter, not the whole <code>User</code> object....
Error with picker view swift <p>I'm trying to change text font and color of picker view. But when i do that i get an error, please help. </p> <pre><code>func pickerView(pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -&gt; NSAttributedString? { let attributedString = NSAttrib...
<p>i did something like that by providing a view like this </p> <pre><code> func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -&gt; UIView { let pickerLabel = UILabel() pickerLabel.textColor = UIColor.black pickerLabel....
JS Regex: Remove anything (ONLY) after a word <p>I want to remove all of the symbols (The symbol depends on what I select at the time) after each word, without knowing what the word could be. But leave them in before each word.</p> <p>A couple of examples:</p> <p><code>!!hello! my! !!name!!! is !!bob!!</code> should ...
<p>You need to use capture groups and replace:</p> <pre><code>"!!hello! my! !!name!!! is !!bob!!".replace(/([a-zA-Z]+)(!+)/g, '$1'); </code></pre> <p>Which works for your test string. To work for any generic character or group of characters:</p> <pre><code>var stripTrailing = trail =&gt; { let regex = new RegExp(`...
I have 4 sets of two numbers [1x2]. How do I add each corresponding row? <p>Here are the four [2x1] variables.</p> <pre><code>A1 = 0.5653 0.5648 phi1 = 5.3637 5.3951 A2 = 0.6063 0.6057 phi2 = 3.1646 3.1961 </code></pre> <p>I need to add all rows together.</p> <p>I wrote the function below</p> <pre><code>function...
<p>Found it!</p> <p>function [At] = somme_signaux(A, phi) At=sum(plus(A,phi),2); end</p>
MySQL PHP Undefined offset Error <p>I have a table called <strong>lynked_v1</strong> and a column in MySQL called <strong>probability_single_free</strong></p> <pre><code> +----------------------------------+ | id | probability_single_free | | ---------------------------------| | 0 | 100.00 ...
<p>Use this code:</p> <pre><code>&lt;?php error_reporting(-1); ini_set('display_errors', true); require_once ('/var/www/html/MySQL/mysqli_connect.php'); echo "Connected successfully"; $query = "SELECT probability_single_free FROM lynked_v1"; $response = @mysqli_query($dbc, $query); while($row = mysqli_fetch_array...
Converting url encode data from curl to json object in python using requests <p>What is the best way to convert the below curl post into python request using the requests module:</p> <pre><code>curl -X POST https://api.google.com/gmail --data-urlencode json='{"user": [{"message":"abc123", "subject":"helloworld"}]}' </...
<p>As the comment mentioned, you should put your <code>url</code> variable string in quotes <code>""</code> first.</p> <p>Otherwise, your question is not clear. What errors are being thrown and/or behavior is happening?</p> <p><a href="http://stackoverflow.com/questions/17936555/how-to-construct-the-curl-command-from...
Angularfire2 AuthGuard Explanation <p>I am fairly new to Angular and I am trying to understand setting up an AuthGuard for blocking certain routes when a user is logged in or not. I found this code while searching around and it does work. However I do not fully understand what the code is doing. If anyone could just ex...
<p>When the Angular 2 router tries to access a route, it evaluates the 'canActivate' method on all the guards added to the route in your configuration. </p> <p>If one of these guards return false, or return an observable that evaluates to false when you subscribe to it, it prevents the router from accessing this page....
Why is ServicePointManager.SecurityProtocol different in console application and IIS website on the same machine? <p>I am trying to update a set of projects to .NET 4.6.1 in order to get TLS 1.2 support. The solution contains a mix of class libraries, console applications, WebForms websites, and MVC websites.</p> <p>I...
<p>OK - I worked it out.</p> <p>To change a website's target framework, you right-click it, click "Property Pages", then change "Target Framework" on the "Build" page.</p> <p>If you do this, then in will change the "targetFramework" attribute on the "compilation" node under the "system.web" node:</p> <pre><code>&lt;...
Can I modify a variable within a string with another variable in PHP? <pre><code>$pet ='dog'; $action='My '. $pet . 'likes to run.'; //The part I would like to modify $pet ='cat'; //Modify the $pet variable inside the $action variable //after it has been defined. echo $action; </code></pre> <p>This will output: My...
<p>Well, I know that you probably weren't looking for this, but it is late and I am bored. </p> <p>Disclaimer: this is a <em>bad idea</em>.</p> <pre><code>class MyString { private $format, $pet; public function __construct($format, &amp;$pet) { $this-&gt;format = $format; $this-&gt;pet = ...
I want to check object code with two versions of libQtCore.a <p>I am also making static library of Qt (qt.4.3.3) , the steps to do the same are</p> <p>I downloaded a open source of qt-all-opensource-src-4.3.3. I built static libraries using following steps. The gcc version I am using is gcc 5.2.0</p> <pre><code>cd qt...
<p>You're facing the error because the very old Qt code that you're using is not valid C++: the old compilers were more permissive and accepted that invalid code. You have to patch your copy of Qt to fix the bug.</p>
Riotjs (Riot typescript) can't overwrite method on typescript class <p>This is weird. What am I doing wrong?</p> <pre><code>class Store extends Riot.Observable { trigger():void { // shouldn't this be completely overwriting the trigger method on riot.observable? console.log("my trigger...."); } } let store ...
<p>Based on the <a href="https://github.com/nippur72/RiotTS/blob/master/riot-ts.js" rel="nofollow">source</a>, riot observables do not take advantage of prototypical inheritance. They work as mixins instead. The typescript wrapper class just calls the original riot mixin. To overwrite a function, you have to assign it ...
Global connection to 3rd party api Flask <p>I have a Flask app running on Heroku that connects to the Google Maps API during a request. Something like this:</p> <pre><code>client = geocoders.GoogleV3( client_id=self.config['GM_CLIENT_ID'], secret_key=self.config['GM_SECRET_KEY'] ) clie...
<p>Turns out it's as simple as storing the client instance in a global variable.</p>
Delphi Application Main Form temporarly flicking to the front <p>We have a Delphi 2007 application and have recently enabled MainFormOnTaskBar for better support of Windows Aero. However because the main form would not come to the top of all child forms when clicked we added the following code.</p> <pre><code>procedu...
<p>The observed behavior is the result of VCL's accelerator support for a possible main menu on the main form, so that you can select menu items from the main form's menu even when another form is active. </p> <p>The activation of the main form takes place by a <code>SetFocus</code> call on the main form's handle whil...
PDO Loop in the Loop - How to make it proper way? <p>I'm shifting to PDO from MySql_ AND/OR MySqli_ and I need some advice on how to get the things right. (Learning Process). In this case I have to loop thru categories (links_cat) and return all the records responding to this category from another table.(links). Code i...
<p>Try changing your code like this</p> <pre><code>// ensure record is ordered by category name $links_cat = "SELECT links_cat.name AS linkcat, links.link AS linkname FROM links_cat INNER JOIN links ON links.category=links_cat.id ORDER BY links_cat.name"; $prevCat = ''; foreach($pdo-&gt;query($links_cat) as $row) { ...
Redirect HTTP to HTTPS in Azure (With Load Balancer) <p>We have 2 Web servers in Azure that are Load balanced. We just installed SSL in our these azure websites to convert it to HTTPS. </p> <p>Now we want that any request coming in as HTTP should be changed/redirected to HTTPS connection. </p> <p>So, I for testing I ...
<p>Try this, taken from <a href="http://stackoverflow.com/questions/9823010/how-to-force-https-using-a-web-config-file">How to force HTTPS using a web.config file</a></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration&gt; &lt;system.webServer&gt; &lt;rewrite&gt; &lt;r...
C++11: Segfault with std::thread and lambda function <p>I've written a small application to demonstrate the issue, it is not pretty, but it does the job.</p> <pre><code>#include &lt;functional&gt; #include &lt;iostream&gt; #include &lt;mutex&gt; #include &lt;queue&gt; #include &lt;thread&gt; class A { public: A() ...
<p>I reduced your reproduction to:</p> <pre><code>#include &lt;functional&gt; #include &lt;iostream&gt; #include &lt;queue&gt; struct foo { using Task = std::function&lt;void()&gt;; void Test() { std::cout &lt;&lt; "In Test, this: " &lt;&lt; this &lt;&lt; std::endl; AddTask([this] { std::cout &lt;&lt; "I...
Do Javascript promises block the stack <p>When using Javascript promises, does the event loop get blocked? </p> <p>My understanding is that using a await &amp; async, makes the stack stop until the operation has completed. Does it do this by blocking the stack or does it act similar to a callback and pass of the proce...
<p>An <code>await</code> blocks only the current <code>async function</code>, the event loop continues to run normally. When the promise settles, the execution of the function body is resumed where it stopped.</p> <p>Every <code>async</code>/<code>await</code> can be transformed in an equivalent <code>.then(…)</code...
What methods or actions we should avoid when build a wordpress site? <p>There are many tutorials talk about how to build wordpress site from a theme or scrath.</p> <p>But I want to know what's the worst way to build a wordpress site? I heard people saying: Using hooks instead of override. I am not sure if this is true...
<p>The best way to build custom themes is to get a book and learn the right way to use template hierarchies and custom post types. Make use of the loop using <a href="https://codex.wordpress.org/Class_Reference/WP_Query" rel="nofollow">wp_query</a>. Use WordPress template tags , methods and functions if they exist rath...
Testing ZK applications with Selenium Webdriver <p>I've recently started working on Selenium Webdriver (Chrome) for Java language. My application is developed using zk framework, hence its ID's are randomly generated. Eg:</p> <pre><code>/div[@id='z_j0_7!cave']/form[@id='loginForm']/table[@id='z_j0_9']/tbody/tr[@id='z_...
<blockquote> <p>I'm looking for the xpath of login and password input fields. Programming language is java and I using Chromedriver. </p> </blockquote> <p>There is no need to do extra stuff and use <code>xpath</code> to locate desire element, you can use <a href="https://seleniumhq.github.io/selenium/docs/api/jav...
ReflectionTestUtils not working with @Autowired in Spring Test <p>I am trying to add mock object in CourseServiceImpl's courseDao field but it is not working.</p> <pre><code>@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( locations = {"file:src/main/webapp/WEB-INF/config/servlet-config.xml"} ) @Acti...
<p>Your <code>CourseServiceImpl</code> class has <code>@Transactional</code> annotation which means that bean instance wrapped with <code>"Transational"</code> proxy before it injected as dependency in <code>CourseServiceTest</code> and all other beans in Spring context. Such proxy instance hides all the <code>private<...
Django: Template Does Not Exist Error <p>In My django app I have a view called 'StatsView' given below:</p> <pre><code>class StatsView(LoginRequiredMixin, View): login_url = '/signin/' def get(self, request, template='app_folder/ad_accounts/pixel_stats.html', *args, **kwargs): #Code return ren...
<p>Silly mistake. Solved it by adding a <code>$</code> at the end in my <code>url</code>.</p> <pre><code>url( r'^ad_accounts/(?P&lt;ad_account_id&gt;[^/]+)/pixel_stats/$', StatsView.as_view(), name="pixel_stats" ), </code></pre>
C# Inserting last 5 lines from a .csv file into datagrid <p>I am trying to pull that last 5 lines from a .csv file and display them in a datagrid on my form. How would I insert the data onto the datagrid? </p> <p>Here is my current Code, </p> <pre><code> int x = 5; var buffor = new Queue&lt;...
<p>You can do this,</p> <pre><code> public Form1() { InitializeComponent(); int x = 5; var buffor = new Queue&lt;string&gt;(x); foreach (var headerLine in File.ReadLines("C:/NewMap.csv").Take(1)) { foreach (var headerItem in headerLine...
Redisplay div after display none <p>I'm hoping to do something simple and googling hasn't yielded results I could understand (I'm still something of a rookie.) I'm hoping to set display to none for a div, but then later make that div come back. I'm failing to do so. See the snippet attached, I've tried "Initial" and "R...
<p>Use this for a div:</p> <pre><code>innerBlock.style.display = "block"; </code></pre> <p>Or this for a span:</p> <pre><code>innerBlock.style.display = "inline"; </code></pre> <p>For more information on CSS display options, visit:</p> <p><a href="http://www.w3schools.com/cssref/pr_class_display.asp" rel="nofollow...
Home folder in Webapplication <p>Can somebody explain me what does this link mean? </p> <pre><code>&lt;?php header("Location:user/#/home")?&gt; </code></pre> <p>This line is inside index.php file, that exists at the same level as user folder and user folder has another folder called home inside. My query is what does...
<p>In PHP, the <a href="http://php.net/manual/en/function.header.php" rel="nofollow">header</a> method is how you send HTTP headers back to the user's browser. The Location header instructs the browser that the requested item has moved to a new location and thus the browser should redirect the user to the new location...
How to handle urllib2 socket timeouts? <p>So the following has worked for other links that have timed out and has continued to the next link in the loop. However for this link I got an error. I am not sure why that is and how to fix it so that when it happens it just browses to the next image.</p> <pre><code>try: ...
<p>Explicitly catch the timeout exception: <a href="https://docs.python.org/3/library/socket.html#socket.timeout" rel="nofollow">https://docs.python.org/3/library/socket.html#socket.timeout</a></p> <pre><code>try: image_file = urllib2.urlopen(submission.url, timeout = 5) except urllib2.URLError as e: print(e) ...
Redirect a URL with RewriteRule in .htaccess <p>I want to redirect a URL like</p> <pre><code>https://www.domain.com/#new </code></pre> <p>to</p> <pre><code>https://www.domain.com/new.html </code></pre> <p>How can I use <code>.htaccess</code>?</p>
<p>Unfortunately the <code>hash</code> part of the URL is not being sent by the browser to the server, so in the server you can't really use this part to do the redirect.</p> <p>You will have to use <code>javascript</code> code for that:</p> <pre><code>hash = window.location.hash if (hash.length &gt; 0) { window....
Clustered index, order on single single, without order by clause <p>I have a transaction table (single primary key) with millions of records and everyday 100s of records are getting added.</p> <p>This table is then further used in Reconciliation and Settlement which happens on newly inserted records only, without any ...
<p>It depends... For some operations, like ORDER BY, it does not matter as index is bidirectional, so sorting is not needed.</p> <p>But for other operations, like Ranking, Index Scan, etc., it matters. SQL Engine is designed to perform forward index scan with parallelism, but if query optimizer needs a reverse index s...
validating a phone number <p>How can I determine if an input is a valid home phone number (without area code)?</p>
<p>Regex is the best option for validating a phone number.</p> <p>you can use it on the html input tag like this (this may not be supported in all browsers):</p> <pre><code>&lt;input id="phonenum" type="tel" pattern="^\d{3}-\d{4}$" required &gt; </code></pre> <p>or you can test a regex string in you code like this ...
java call method in constructor and abstract class? <pre><code>public class NewSeqTest { public static void main(String[] args) { new S(); new Derived(100); } } class P { String s = "parent"; public P() { test(); } public void test() { //test 1 System.out.println(s + " parent"); } } cl...
<ol> <li><p>You've overriden the method <code>test</code> in your subclass <code>S</code> and you're constructing an object of type <code>S</code>. So in the superclass constructor, when <code>test()</code> is invoked, it invokes the overriden version of <code>test()</code> from the subclass <code>S</code>. That's the ...
Remove an XML parent node keeping child nodes <p>If I have (for example) an XML file with the following structure:</p> <pre class="lang-xml prettyprint-override"><code>&lt;Parent1&gt; &lt;listChild&gt; &lt;child&gt; &lt;listchild2&gt; &lt;child2&gt; ...
<p>Your specification is not very clear. XML itself does not have the concept of a "list". Any element can contain any number of child elements, and XML doesn't care what the name of the elements are. Using the word "list" in an element doesn't actually make it a list.</p> <p>In addition, in your example XML you show ...
Firebase returning Optional() with Swift 3.0 <p>This code is now displaying data in the app as Optional('data') since updating to Swift 3.0. Any idea? </p> <pre><code>let ring1FightRef = FIRDatabase.database().reference().child("Ring1Fighting") @IBOutlet weak var ring1Fighting: UILabel! </code></pre> <p>Here is the...
<p>You just need to unwrap the value that you recieve:- </p> <pre><code>FIRDatabase.database().reference().child("Ring1Fighting").observe(.value) { (snap: FIRDataSnapshot) in print((snap.value as! String)) } </code></pre>
How to push object to key array javascript? <p>I have an object like this:</p> <pre><code>var newService = new Service({ name: service.name, description: service.description, supplier: service.supplier, price: service.price, info_requires: [] }); </code></pre> <p>Here is modal <code>Service</...
<p>In case the "Service" is a custom Object created by you, this might do the trick</p> <pre><code>var service ={ name: "", description: "", supplier: "", price: "", info_requires: [] }; service.info_requires.push(some_object); new Service(service); </code></pre>
How can I get the google search snippets using Python? <p>I am now trying the python module google which only return the url from the search result. And I want to have the snippets as information as well, how could I do that?(Since the google web search API is deprecated)</p>
<p>I think you're going to have to extract your own snippets by opening and reading the url in the search result.</p>
How to get select value from another php file? <p>How to get <code>&lt;select&gt;</code> value from another php file. Example :</p> <p>index.php</p> <pre><code>$text = $_POST['text'] &lt;select id="text"&gt; &lt;option&gt; text 1&lt;/option&gt; &lt;option&gt; text 2&lt;/option&gt; &lt;option&gt; text 3&l...
<p>I think you only forgot to add value for options itself</p> <pre><code>&lt;form method="post" action="data.php"&gt; &lt;select name="text" id="text"&gt; &lt;option value="text 1"&gt; text 1&lt;/option&gt; &lt;option value="text 1"&gt; text 2&lt;/option&gt; &lt;option value="text 1"&g...
Android Studio NullPointerException when I click a button to start a new activity? <p>Here is my main method:</p> <pre><code>public class VideoViewDemo extends AppCompatActivity implements View.OnClickListener { private Button loginButton; private Button registerButton; /** * ATTENTION: This was auto-generated to im...
<p>It's difficult to answer this without seeing the stack trace to know exactly where the null pointer exception is happening. Some things I would refactor that might help:</p> <p>Check to make sure actionBar is not null:</p> <pre><code>Action actionBar = getSupportActionBar(); if (actionBar != null) actionBar.hi...
C++ code for improving quality of input raw image using point processing algorithm in image processing? <p>I want to enhance the image using point processing algorithm that is used in multimedia image processing </p>
<p>Perhaps the best suggestion for you is to use OpenCV to do the job.It is Open source computer vision tools. The website is: <a href="http://opencv.org/" rel="nofollow">http://opencv.org/</a></p> <p>In this webiste, you can find all you need. BTW, you can see this website:</p> <p><a href="http://docs.opencv.org/2.4...
move context on canvas <p>I need to make a web app that works like this <a href="http://courses.acs.uwinnipeg.ca/2909-001/assignments/A1Q4_drag.mp4" rel="nofollow">link </a>. I know how to produce the rectangles on random places, but my problem is how to move them by mouse? We should be able to move any of them when we...
<p>I would suggest using HTML Div Elements for this, but if you must use HTML5 Canvas here are the basic ideas:</p> <ol> <li>Create an array of boxes as objects and add boxes to them</li> <li>Draw the boxes every 16.666 (60fps) milliseconds or draw them when the user moves their mouse or drags a box, etc...</li> <li>D...
How do I get CSV output when querying for IAM Groups and Users? <p>First time poster here. </p> <p>I have created a small script that outputs group membership in AWS. </p> <p>I have got the script to the point that it outputs the desired results but I require help getting the data in a readable format into a csv file...
<p>Here's an alternative solution for powershell v3.0+ that groups the data in a way that makes extraction to CSV a bit simpler.</p> <p>Code:</p> <pre><code>$alias = Get-IAMAccountAlias Get-IAMGroups | % { $group = $_; (Get-IAMGroup -groupname $_.GroupName).Users | % { [pscustomobject]@{ Alias = $al...
TypeError: 'NoneType' object is not iterable when trying to check for a None value <p>This is the error I receive:</p> <pre class="lang-none prettyprint-override"><code>line 16, in main definition, data = get_name () TypeError: 'NoneType' object is not iterable </code></pre> <p>I check for <code>None</code> type ...
<p>You have a double negative in the part that is returning <code>None</code> for the check later. Maybe try this:</p> <pre><code>if x and new_line: return new_line, x else: return None, None </code></pre> <p>Then when checking for <code>None</code> don't actually check for <code>None</code>, check the variab...
sonarqube api/permission/add_group for project permission managenebt <p>Please advice what I did wrong with this api call for Sonarqube. </p> <p>=> To give grp1 with issueadmin permission for myproj, I ran the command below</p> <ol> <li>curl -u admin:admin -X POST '<a href="http://localhost:9000/api/permissions/add_g...
<p>Check out <code>api/permissions/add_group</code> documentation (<a href="http://sonarqube.com/web_api/api/permissions/add_group" rel="nofollow">here</a>) . The error messages you get talks about <strong>global</strong> permissions, so somehow the project key hasn't been interpreted correctly. Looking closer at the p...
Efficiently adding large group of classes to a map array in C++ <p>So I have a huge amount of classes (20+ that I want to store into a map array as such:</p> <pre><code>mapArray['ClassName'] = new ClassName(); </code></pre> <p>I thought about doing something like</p> <pre><code>App::setup() { mapArray['ClassName...
<p>Using</p> <pre><code>App::setup() { mapArray['ClassName1'] = new ClassName1(); mapArray['ClassName2'] = new ClassName2(); mapArray['ClassName3'] = new ClassName3(); } </code></pre> <p>is not a good idea (even after you fix the incorrect syntax of trying to use single quotes to define a string). It brea...
How to hide navbar when when overlay appears <p>Using code from <a href="http://www.w3schools.com/howto/howto_js_sidenav.asp">W3schools</a> 'Sidenav Overlay' I'm trying to create the same effect in Bootstrap. I have the .navbar-toggle floating left and the navbar-toggle still shows when the overlay moves right. Not sur...
<p>Add z-index as 99 instead of 1 to .sidenav class</p> <pre><code>.sidenav { background-color: #111; height: 100%; left: 0; overflow-x: hidden; padding-top: 60px; position: fixed; top: 0; transition: all 0.5s ease 0s; width: 0; z-index: 99; } </code></pre>
Output ListBox as multiple line log <p>I have run into an issue when automating some of the error checking processes on a database. I need to output a log that is identical to an output to a ListBox, however my current (FreeFile) method, will overwrite the log file each time a new line is added to the box.</p> <pre><c...
<p>Dealing with the printing file statements only, you have to:</p> <ul> <li>change n type to <code>integer</code> </li> <li>use <code>Append</code> keyword</li> </ul> <p>here's the revised code</p> <pre><code>Sub ExampleString(s As String) Dim n As Integer n = FreeFile() Open "C:\Path\TEST.txt" For App...
Bootstrap Navbar reducing height <p>I have a navbar, which is pretty standard, and I want to make it a bit thinner.</p> <p>So I tried this:</p> <p><a href="http://www.bootply.com/9VC5N55nJD" rel="nofollow">http://www.bootply.com/9VC5N55nJD</a></p> <p>But the buttons remain too big. Click the drop down, and you'll se...
<p><a href="http://www.bootply.com/B4CgVSZGMt#" rel="nofollow">Here</a> is a working fork of your code.</p> <p><strong>Bootstrap</strong> by default uses a <code>padding-top: 15px</code> and <code>padding-bottom: 15px</code> for <code>.navbar-nav &gt; li &gt; a</code>. The following CSS will take care of this:</p> <p...
conditionally look up column names to populate new column in r <p>I have a data.frame that looks like this:</p> <pre><code> A C G T 1 6 0 14 0 2 0 0 20 0 3 14 0 6 0 4 14 0 6 0 5 6 0 14 0 </code></pre> <p>(actually, I have 1800 of the with varying numbers of rows..)</p> <p>Just to explain what you are looking...
<p>In order to get my minimum function to work, I had to covert zero's to NA. For some reason, na.rm=TRUE doesn't work with which.min </p> <p>See if this is helpful for you:</p> <pre><code>A &lt;- c(6,0,14,14,6) C &lt;- c(0,0,0,0,0) G &lt;- c(14,20,6,6,14) T &lt;- c(0,0,0,0,0) mymatrix &lt;- as.matrix(cbind(A,C,G,T))...
What is the last stable version of php 5.4 <p>Im currently working on php 5.3.13, and im thinking to upgrade my system for woocommerce im wondering what is the stable version in php 5.4? Is it 5.4.44?</p>
<p>The LAST stable version of PHP 5.4 was 5.4.45, released at 09/2015.</p> <p>You can get this info or download the files <a href="https://secure.php.net/releases/" rel="nofollow">here</a>.</p> <p>The two CURRENT stable versions are PHP 7.0.11 and 5.6.26.</p>
Sorting strings with numbers in Python <p>I have this string: </p> <pre><code>string = '9x3420aAbD8' </code></pre> <p>How can I turn string into:</p> <pre><code>'023489ADabx' </code></pre> <p>What function would I use?</p>
<p>You can just use the built-in function <a href="https://docs.python.org/3.5/library/functions.html#sorted" rel="nofollow"><code>sorted</code></a> to sort the string lexographically. It takes in an iterable, sorts each element, then returns a sorted list. Per the documentation:</p> <blockquote> <p><code>sorted(ite...
Save active record object without reference id <p>I have the following migrations: </p> <pre><code> class CreateMothers &lt; ActiveRecord::Migration[5.0] def change create_table :mothers do |t| t.string :name t.timestamps end end end </code></pre> <p>and:</p...
<p>In your <code>Son</code> model, just add the <code>optional</code> param to make it work:</p> <pre><code>class Son &lt; ApplicationRecord belongs_to :mother, optional: true end </code></pre> <p>In default, rails set it to be <code>true</code>, so let use <code>false</code> instead, the detail was described <a hr...
Random generator to mix two numbers of a predetermined list into one with 100 unique results <p>I have 24 numbers (01, 02, 03, [...], 22, 23, 24). I need a generator that picks two numbers and mix them to one result (f.e.: 04 + 22 = 0422 or 2204). I need 100 unique results/combinations (no double results). Anyone knows...
<p>Make an array with values 0..575 and use <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle" rel="nofollow">Fisher-Yates shuffle</a> approach. </p> <pre><code>-- To shuffle an array a of n elements (indices 0..n-1): for i from n−1 downto 1 do j ← random integer such that 0 ≤ j ≤ i ...
Where is my below python code failing? <p>if the function call is like: backwardsPrime(9900, 10000) then output should be [9923, 9931, 9941, 9967]. Backwards Read Primes are primes that when read backwards in base 10 (from right to left) are a different prime. It is one of the kata in Codewars and on submitting the bel...
<p>Looks like your code passes the test when run manually. Maybe they range to scan over is set wrong on the test causing it to miss the last one?</p> <pre><code> backwardsPrime(1095000, 1095405) [1095047, 1095209, 1095319, 1095403] </code></pre> <p>e.g. the second parameter is set to <code>1095400</code> or somethi...
Is my UML Diagram Correct for the attached code? <p>My professor gave us this program but did not explain UML to us at all and I am wondering if I have made this diagram correctly.</p> <p>CODE:</p> <pre><code>package p1; public class MyProg { static int i = 5; private Integer j = new Integer(10); protecte...
<p>On your diagram:</p> <ul> <li>As already mentioned i and j are not string</li> <li>in main operation args parameter is some sort of array so you are missing the multiplicity indicator (asterisk in square brackets before closing round bracket). So the line should look like <code>+ main(in args: String[*])</code>. Of...
Grid Editing in shieldUI lite api <p>I have created a dynamic grid by using ShieldUI API and added dropdown boxes to each colunm. </p> <p>Initial grid: <a href="https://i.stack.imgur.com/Rr5sF.png" rel="nofollow"><img src="https://i.stack.imgur.com/Rr5sF.png" alt="enter image description here"></a></p> <p>But when I ...
<p>You can check out the following example: <a href="http://demos.shieldui.com/web/grid-editing/editing-custom-editor" rel="nofollow">http://demos.shieldui.com/web/grid-editing/editing-custom-editor</a></p> <p>To see how to initialize a custom editor. In this case it is a combo, but the same logic is applicable for a ...
Java memory leak with Strings? Why is this consuming and crashing <p>Lists of Integer, Long, execute ok. However when using String the code below consumes over 5GB of memory when an entry at most should be in the neighborhood of 8 bytes per String, equating to only ~700MB. It also runs infinitely never throwing heap ou...
<p>Memory footprint of a <code>String</code> involves the memory overhead of an object plus the fields of the object. See this answer for detail: <a href="http://stackoverflow.com/a/258150/5221149">What is the memory consumption of an object in Java?</a></p> <p>The <code>String</code> object has two instance fields in...
Importing XLSX file into SAS <pre><code>OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; PROC IMPORT OUT= Census.taxp_lookupDATAFILE="C:\Users\Dhruv\Desktop\Book1.xlsx" DBMS=xlsx REPLACE; SHEET="tax_group"; GETNAMES=YES; RUN; ERROR: Physical file does no...
<blockquote> <p>you basically need to specify the data to be read: DATAFILE=""</p> </blockquote> <pre><code>/** Import an XLSX file. **/ PROC IMPORT DATAFILE="&lt;Your XLSX File&gt;" OUT=WORK.MYEXCEL DBMS=XLSX REPLACE; RUN; /** Print the results. **/ PROC PRINT DATA=WORK.MYEXCEL; RUN; </c...
How to fix options request in node js <p>I am using react to send data to my API. Every POST request I make gives me an OPTIONS request, and I need to fix this. I think I might need to do some preflight structure but after reading about it I still do not know how to implement it.</p> <p>At the moment I am connecting t...
<p>The browser sends a preflight Options requests to the server to check if CORS is enabled on the server. To enable cors on the server side add this to yor server</p> <pre><code>app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers"...
App Store Publication and Update Process <p>I have following conditions:</p> <p>We want to <strong>change app icon</strong> and <strong>add screenshots</strong>. Can it be done without upload new binary?</p> <p>Currently no screenshots under 5.5" and 4.7" display when we want to upload new version of app. Do we need ...
<p>App screenshots (device/size doesn't matter), app previews and app icons can <strong>only be changed</strong> with a new version/binary of your app. </p> <p>Complete overview of all the fields and stuff you can edit in iTunes Connect is over here: <a href="https://developer.apple.com/library/content/documentation/L...
Uncaught ReferenceError: Searchbar is not defined <p>Sorry, i am new in React. I have 2 components in my react application. Here is the parent:</p> <pre><code>import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import './Searchbar'; const App =() =&gt; { return ( &l...
<p>The solution is really simple. You are importing the searchbar wrongly in your file. You need to import it like <code>import Searchbar from './Searchbar';</code> , since you have exported it as default you also need to import it in default manner.</p> <pre><code>import React, { Component } from 'react'; import logo...
Django join on multiple foreign fields (left join) <p>I'm using django 1.10 and have the following two models</p> <pre><code>class Post(models.Model): title = models.CharField(max_length=500) text = models.TextField() class UserPost(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) ...
<p>Then I think you need something like this:</p> <pre><code>Post.objects.all().annotate( approved=models.Case( models.When(userpost_set__user_id=2, then=models.F('userpost__approved')), default=models.Value(False), output_field=models.BooleanField() ) ) </code></pr...
Temporary Public URL for IBM Bluemix Object Storage Service with NodeJs <p>Use case: File uploaded in to IBM Object Storage. Now want to provide temporary access via a signed URL that will expire after a certain delay.</p> <p>Only SWIFT are being supported officially, need a workaround that works with JAVASCRIPT -> N...
<hr> <p>You have to install SWIFT CLI and set a temporary key for your credentials. </p> <p>This step is super important and CAN ONLY BE DONE BY USING THE SWIFT CLI as there is now way to do that currently with Bluemix Console.</p> <p>STEP 0 - ************ MANDATORY ************* INSTALL SWIFT CLI</p> <p>REF: <a hr...
Error in configuring Flume to Collect Data into HDFS from Twitter - org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -conf <p>Executed the command:</p> <pre><code>./bin/flume-ng agent -conf ./conf/ -f conf/flume.conf -Dflume.root.logger-DEBUG, console -n TwitterAgent </code></pre> <p>and got ...
<p>Change <strong>-conf</strong> to <strong>--conf</strong> , it should work.</p> <p>The below is the syntax to start Flume.</p> <pre><code>$ bin/flume-ng agent --conf conf --conf-file example.conf --name a1 -Dflume.root.logger=INFO,console </code></pre>
Not able to execute pip commands even though pip is installed and added to PATH <p>I already have pip installed and added the corresponding path to my path,however I dont seem to be able to execute any pip commands(see below),what am I missing?</p> <pre><code>C:\Python27\Lib\site-packages\pip&gt;get-pip.py You are usi...
<p>You have <code>pip</code> installed but you don't have any command named <code>pip</code>.</p> <p>try <code>python -m pip</code></p>
find the location of the cmd.exe file <p>I have built a c++ program that depends on "cmd.exe" to execute some of the tasks. For now I and for test purposes the path to that file is "c:\windows\system32\cmd.exe". My question is there any c++ API that returns the path of that file knowing that my program must work on wi...
<p><code>GetSystemDirectory</code> is one option. For a 32-bit app, it will return the 32-bit system directory. For an x64 app, it will return the 64-bit native system directory.</p> <p>You can also use <code>CreateProcess</code> or <code>ShellExecuteEx</code> with <code>cmd.exe</code> and it should find it without th...
How to implement INotifyPropertyChanged <p>I need help implementing INotifyPropertyChanged in my own data structure class. This is for a class assignment, but implementing INotifyPropertyChanged is an addition that I am doing above and beyond what the rubric requires.</p> <p>I have a class named 'BusinessRules' that ...
<p>It will be very helpful if you read tutorials on <a href="http://www.markwithall.com/programming/2013/03/01/worlds-simplest-csharp-wpf-mvvm-example.html" rel="nofollow">how to implement MVVM</a>.</p> <p>You'd wanna have a base class that implements <code>INotifyPropertyChanged</code> interface. So all your view mod...
NavigationView with DrawerLayout setCheckedItem not working <p>I want let <code>NavigationView</code> check one item when app startup. But i found <code>NavigationView.setCheckedItem(R.id.xxx)</code> not working. And i also tried <code>navigationView.getMenu().findItem(R.id.xxx).setChecked(true)</code>, same result.</p...
<p>Try this way :</p> <pre><code> menuItem.setCheckable(true); menuItem.setChecked(true); if (mPreviousMenuItem != null &amp;&amp; mPreviousMenuItem != menuItem) { mPreviousMenuItem.setChecked(false); } mPreviousMenuItem = menuItem; </...
Angularjs CRUD delete issue (GET called in DELETE method) <p>I am trying to consume my spring rest service using angularjs client following this <a href="http://websystique.com/springmvc/spring-4-mvc-angularjs-crud-application-using-ngresource/" rel="nofollow">link</a></p> <p>Create,update and read parts are working. ...
<p>Your issue could be when you call <code>Employee.get({employeeId:identity}, ...)</code> prior to deleting the employee. This will load the employee before deletion and it will do a GET request on <code>'http://localhost:8080/SpringRestExample/employee/:id'</code>. </p> <p>For this query to work properly, you need t...
How to show a dropdown inside ng-repeat <p>I am working on a project where I have a list of details. I need to give a dropdown option on Delete button click. I have tried it but unable to show the dropdown inside ng-repeat. Can anyone guide me how to achieve this.</p> <p>I want to show a dropdown list when I click on ...
<p>i have created demo for dropdown:</p> <p><strong>html:</strong></p> <pre><code>&lt;button ng-model="show" ng-click="show=!show"&gt; delete &lt;/button&gt; &lt;ul ng-show="show"&gt; &lt;li&gt;Delete all&lt;/li&gt; &lt;li&gt;Delete only selected&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>css:</strong></p> <pr...
overwrite attribute as function Django <p>I have <code>class A(models.Model)</code> with attr <code>name</code>. I use it in template and view as <code>obj_a.name</code>. I need overwrite <code>name</code> attr as function and when I write <code>obj_a.name</code> I would get response from function <code>getName</code>....
<p>You can achieve this behavior with <a href="https://docs.python.org/2/library/functions.html#property" rel="nofollow"><code>property</code></a>.</p> <pre><code>class A(models.Model): _name = Field() @property def name(self): return self._name </code></pre>
Bundle Error on macOS 10.12 Sierra <pre><code>Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2 Ignoring byebug-9.0.6 because its extensions are not built. Try: gem pristine byebug --version 9.0.6 Ignoring capybara-webkit-1.11.1 because its exte...
<p>Reinstall the version of Ruby you're using (via rbenv, rvm, etc.) and then run <code>gem pristine --all</code> to rebuild any gems using native extensions.</p>
Kendo Grid - Dynamic Column and Custom Template <p>I have a problem with kendo Grid and Custom template. The problem is, I need to check the value of the column</p> <ul> <li>if Value == 1, I need to change it to Icon Check</li> <li>If Value == 0, I need to change it to Icon Delete</li> <li>If Value == -1. I need to re...
<p>Here is a <strong><a href="http://jsfiddle.net/RajReddy/hG6zR/17/" rel="nofollow">Working Demo</a></strong></p> <p><strong>Solution</strong>: You can change your data fed into the grid by <strong>replacing the numbers with a icon</strong>. I prefer using <strong><a href="http://fontawesome.io/icons/" rel="nofollow"...
parsing csv data in javascript not working in chrome <p>I am parsing the csv file in javascript using the below logic. The logic works correctly in firefox browser but on chrome browser, the output is different.</p> <pre><code> var r = new FileReader(); r.onload = function (e) { contents = e.target.result; $s...
<p>The <code>.replace(/\r\n+/g, ",")</code> part of code replaces multiple occurrences of a CR followed with one or more LF symbols with a comma. E.g., it will replace with a comma <code>"\r\n\n\n\n\n\n"</code> or <code>"\r\n"</code>, but will never find <code>"\n\n\n\n"</code>.</p> <p>Since linebreaks can be defined ...
java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrLookup Exception While Running Spring Boot Application <p>This is my POM.XML</p> <pre><code>&lt;parent&gt; &lt;groupId&gt;com.vonage.gunify&lt;/groupId&gt; &lt;artifactId&gt;gunify-ext-services-parent&lt;/artifactId&gt; &lt;version&gt;2016.7.0...
<p>As the error message says : <code>java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrLookup</code></p> <p>That means, that apache commons-lang is missing in your dependencies:</p> <p>So you have to add the following to your pom:</p> <pre><code>&lt;!-- https://mvnrepository.com/artifact/commons-lang/c...
Python: display subarray divisible by k , how do I solve with hashtable? <p>I am looking for <strong>Python</strong> solution</p> <p>For example, For A=[2, -3, 5, 4, 3, -1, 7]. The for k = 3 there is a subarray for example {-3, 5, 4}. For, k=5 there is subarray {-3, 5, 4, 3, -1, 7} etc.</p>
<p>This is the solution. You can try to figure it out yourself.</p> <pre><code>def solve(a, k): tbl = {0 : -1} sum = 0 n = len(a) for i in xrange(n): sum = (sum + a[i]) % k if sum in tbl: key = tbl[sum] result = a[key+1: i+1] return result ...
SWIFT - Cannot assign value of type '[(String, [String : Any])]' to type '[String : [String : Any]]' <p>How do I get rid of the "()" on the first value so I can assign to the next variable?</p> <p>This is how I initialize my dictionary:</p> <pre><code>var imagedata: [String: [String: Any]] = [:] </code></pre> <p>I l...
<p><code>var imagedata: [String: [String: Any]] = [:]</code> //imagedata is an dictionary.</p> <p><code>imagedata = Array(imagedata).sort({ $0.0 &lt; $1.0 })</code> Here you have added imagedata to Array and sorted. Because we can't sort dictionary.</p> <p>The result of <code>sort({ $0.0 &lt; $1.0 })</code> will be a...
Why does python not have a awgn function like Matlab does? <p>I want to add noise to my synthetic data set in python. I am used to MATLAB but I noticed that python (nor numpy) the option of using <code>awgn</code> (which to my understanding can automatically determine the signal to noise ratio when adding Gaussian Nois...
<p>As per your link, <code>awgn</code> is part of the MATLAB Communications toolbox, <a href="https://www.mathworks.com/help/comm/ref/awgn.html" rel="nofollow">https://www.mathworks.com/help/comm/ref/awgn.html</a>. It isn't part of the basic MATLAB package.</p> <p>Similarly, in Python you'll have to go looking at som...
Show Location string using latitude and longitude <p>I am using this method to show the string of location using current location latitude and longitude but it is showing differently </p> <pre><code>NSString *urlString = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&amp;sen...
<p>Please supply the language with the API params. If language is not supplied, the geocoder attempts to use the preferred language as specified in the Accept-Language header, or the native language of the domain from which the request is sent.</p> <p>So please replace the code as with the language parameter as like t...
Is there a better way to cast a variable to 'const' after assignments? <p>I always use <code>const</code> to guard values that should not be assigned. Anyway, there are some cases that I may need to initialize a variable and then use it as a <code>const</code> value, in the same function. For example:</p> <pre><code>v...
<p>Consider making a function that returns the value you want</p> <pre><code>const int flags = getFlags(); </code></pre> <p>Or more object oriented make a flags class that does that in the constructor.</p> <pre><code>const Flags flags(condition1, ...); </code></pre>
NetBeans IDE and project setup <p>I set-up three projects in NetBeans IDE, two are html projects and another one is php project. </p> <p>When I test run, the project php's index.php (Main home page) is wanted to be loaded first. Then it will load another index.html files (two sub pages). </p> <p>But now when I run, t...
<p>Whenever you create project on NetBeans, you can specify the URL of project in the "Project URL" field. Please see the below screenshots that will help you.</p> <p><a href="https://i.stack.imgur.com/eSvim.png" rel="nofollow">Screenshot : Here you can see "Project URL" field, with the help of this you can specify yo...
Getting coordinates upon checking a checkbox <p>so I'm doing this school thingy and I'm trying to get the x and y coordinates of looped checkboxes when they are checked and display the X and Y coordinates in their respective input box, and I need help because at this point I don't really know what I'm doing.</p> <p><s...
<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>$(function() { $('.pos-input').on('click', function() { if ($(this).is(':checked')) alert( $(this).data('x')+':'+ $...
Multiple COUNT and GROUP BY in a single Statement <p>I am using DISTINCT, LEFT JOIN, COUNT and GROUP BY in single statement, like this:</p> <pre><code>SELECT distinct r.sid as sid, s.name as sname, s.image as simage, COUNT(r.sid) as scount FROM batch_request r LEFT JOIN student_info s ON s.id = r.sid WHERE r.tid='22...
<p>Try something like this:</p> <pre><code>SELECT distinct r.sid as sid, s.name as sname, s.image as simage, COUNT(r.sid) as scount, SUM(CASE r.status WHEN 1 THEN 1 ELSE 0 END) as sconfirmed, SUM(CASE r.status WHEN 2 THEN 1 ELSE 0 END) as sdeclined, SUM(CASE r.status WHEN 0 THEN 1 ELSE 0 END) as spending FROM bat...
How to create bootstrap labels like this? <p><a href="https://i.stack.imgur.com/A0nUt.png" rel="nofollow"><img src="https://i.stack.imgur.com/A0nUt.png" alt="enter image description here"></a></p> <p>I wanted to create input like this. When you click the label, a violet line appears. When you click on the success inpu...
<p>This should be a bare minumum implementation.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>input[type="text"] { outline: none; background: transparent; border:...
Why is a parameter parsed as a bool? <p>I usually use <a href="https://github.com/docopt/docopt" rel="nofollow"><code>docopt</code></a> to handle the command line parameters but I now have a case where the parameters is parsed unexpectedly (it must be a silly mistake of mine as it always works great)</p> <pre><code>""...
<p>It is because there are too many spaces between <code>--url</code> and <code>URL</code>, try:</p> <pre><code>""" API to do something Usage: api.py [options] Options: --port PORT port to listen on [default: 64645] --url URL elasticsearch address [default: http://elk.example.com:9200] """ ...
How to set the LED to turn off from the start (Arduino) <p>so am... I 'am new to Arduino and I'm currently trying to make this work.. but I'm already doing this for an hour with luck not in my side... Here is the summary of what I'm doing: I have a Gizduino + 644 (a copy of Arduino with ATmega 644 here in Phil.), a IR ...
<p>Put the line at the end of the setup():</p> <pre><code>digitalWrite(PROX_SENSOR_LED, LOW); </code></pre> <p>Also <code>if (ANALOG = HIGH)</code> is a wrong statement and you assign HIGH to your ANALOG. Change it as <code>if (ANALOG == HIGH)</code>.</p>
Toggle ViewController Views <p>I am learning iOS with few sample projects. I have two view controllers in that first VC has few buttons and a mapview and the second VC has tableview showing a set of results. I have embed the both viewcontrollers in navigationViewController.By clicking a button from First VC i am able t...
<p>Sreekanth Gundlapalli,</p> <p>All you need to do is to add the TableView controller's view as subview to your view Controller. In order to simplify the process I personally prefer using the ContainerView,</p> <p>Step 1 : Add a ContainerView to your View Controller and add the auto layout constraints to it, because...
How do I use local state along with redux store state in the same react component? <p>I have a table that displays contacts and I want to sort the contacts by first name. The contacts array comes from the redux store, which will come then come through the props, but I want the local state to hold how those contacts are...
<p>The <code>componentWillReceiveProps()</code> method is not called for the initial render. What could do, if you only intend to use the data from props as the initial data, is something like:</p> <pre><code>getInitialState () { return { contacts: this.props.data.contacts } } </code></pre> <p>In the <a href=...
Checking if an ArrayList contains a certain String while being case insensitive <p>How can i search through an ArrayList using the .contains method while being case insensitive? I've tried .containsIgnoreCase but found out that the IgnoreCase method only works for Strings.</p> <p>Here's the method I'm trying to create...
<p>The <code>List#Ccontains()</code> method check if the parameter is present in the list but no changes are made in the list elements </p> <p>use streams instead</p> <pre><code>public void leggTilOrd(String ordParameter) { final List&lt;String&gt; ord = Arrays.asList(new String[]{ "a", "A", "b" }); final bo...
how to upload a file to asp.net core backend with http <p>Now I use Asp.net core as the server framework. I want to know how to upload a file to an Asp.net core server? I use web api but not the web application. So form submit is no use. The code below doesn't work.</p> <pre><code>[HttpPost("uploadImage/{accountGuid}"...
<p>I hava just fix it! The input name in POST must be the same as method param in ASP.NET.</p>
Countdown timer not run when user close application <p>I had created countdown timer to display timeout it works well when user minimize application but it stops when user close application. i had added code below kindly help me it's an emergency. </p> <p>this is MainActivity.java</p> <pre><code>public static final S...
<p>You need to return <code>START_STCKY</code> in your <code>onStartCommand()</code> method for the service to run even when app is closed.</p> <pre><code> .... public int onStartCommand(Intent intent, int flags, int startId) { return START_STCKY; } .... </code></pre> <p>You can refer <a href="https://dev...
Querying on DATE field <p>I would like to query the details of reports which will expire between specific dates. The expiration dates are filled in manually.</p> <p>E.g. give me the reports which will expire between 01-11-2016 and 30-11-2016</p> <p>I store the expiration dates as strings in the database; however, whe...
<p>Remember never try to save the date and time in string. It creates problems later. But there is a solution, you can use converting it into date:</p> <pre><code>SELECT * FROM Table WHERE CONVERT(DATE, FromDate) &gt;= CONVERT(DATE, '2016-10-01') AND CONVERT(DATE, ToDate) &lt;= CONVERT(DATE, '2016-10-10') </code></pr...
Can't assign values to a 2d boolean array <p>I'm basically just starting with java and am struggling with a very basic porgram. I have a 2d boolean array that I want to randomly be filled with...you won't guess it... booleans! This is the method I have right now, but it seems that the array is filled with just 'false' ...
<p>As Kevin Esche stated: if you for each loop through the booleans you get value objects, but you want to set it at the reference. This means that the position in the list must be set.</p> <p>It should work with the following code:</p> <pre><code>public static void randBoard() { Random random = new Random(); ...
Create Folder on onedrive using Oauth Authentication <p>I am trying to create a folder or file on OneDrive with using OAuth authorization flow, request and response details are as below,</p> <p><strong>Request:</strong>-</p> <pre><code>POST https://graph.microsoft.com/v1.0/me/drive/root/children?access_token=${access...
<p>I've never used this API, but don't <a href="http://graph.microsoft.io/en-us/docs/platform/rest" rel="nofollow">the docs that you provided</a> state that the token should be sent in an Authorization HTTP header and not as a query param?</p> <p>Like that:</p> <pre><code>POST https://graph.microsoft.com/v1.0/me/driv...
I want to copy listview item on click to clipboard <p>I want copy text from the list view item to clipboard when the user clicks the item but I am stuck at using clipboard within the onitemclick function. How can I implement the same?</p> <pre><code>public class SmsActivity extends Activity implements AdapterView.On...
<p>I hope my answer will be help full to you</p> <pre><code>public void onItemClick(AdapterView&lt;?&gt; paramAdapterView, View paramView, int paramInt, long String s = a.getItemAtPosition(position) ClipboardManager clipboard = (ClipboardManager)CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("la...
Clickable row only works on the first page in datatable <p>I need help. I have a page that displays records in bootstrap data table. The records are displayed 10 rows per page and each row has a checkbox on the left column. What I want to do is, when user clicks on the row, it will check the checkbox and enable the but...
<p>When you use DataTables with jQuery, the plugin manages the rows that appear on the page by adding and removing elements from the DOM when you switch pages. When the table loads, the only rows that exist in the DOM are those appearing on that first page.</p> <p>This means that your handler is only ever added to the...
How to debug iOS app executed in mobile not launched by Xcode with connection USB cable <p>I'm working on Application, where I'm connecting External Device through USB female connector in iPad. Whereas I've connected external device, I can't connect my Data cable with Mac to debug the work. Anyone have idea, how can I ...
<p>Previous device logs are visible in devices tab, when selecting device, you'll see the device console.</p> <p>If that's not enough, I suggest trying a logging framework such as <a href="https://github.com/mattt/Antenna" rel="nofollow">Antenna</a>.</p>
Crm 2015 Javascript Context is not defined from fetchxml <p>I want to get values from <code>fetchxml</code> using javascript in html web resource.I use crm 2015. The code block is in the attachment on <a href="https://i.stack.imgur.com/adLH2.jpg" rel="nofollow">picture</a>. </p> <p>After the fetchxml, I try to get val...
<p>Add a reference to <a href="https://msdn.microsoft.com/en-us/library/gg328541.aspx" rel="nofollow">ClientGlobalContext.js</a> on your web resource. </p> <pre><code>&lt;script src="ClientGlobalContext.js.aspx" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>I am assuming you already have referenced the f...
PHP tree level nested menu recursive function <p>I'm trying to display a set of data in tree level </p> <p>For example this is my database record </p> <p><a href="https://i.stack.imgur.com/3y06h.png" rel="nofollow"><img src="https://i.stack.imgur.com/3y06h.png" alt="enter image description here"></a></p> <p>I wish t...
<p>If it is about how you can prepare array in required format before passing it to <code>treeOut()</code> function then try adding these line before calling <code>treeOut()</code>:</p> <pre><code>$tree = array(); $sql = "SELECT * FROM tbl_name ORDER BY companyName ASC, projectName ASC, phaseName ASC"; $result = mysq...
Golang bson structs - use multiple field names for a single field in json but only one for writing to the database <p>I have a struct like this -</p> <pre><code>type Address struct { AddressLine1 string `json:"addressLine1" bson:"addressLine1"` AddressLine2 string `json:"addressLine2" bson:"addre...
<p>You can have both fields as pointer to string:</p> <pre><code>type Address struct { AddressLine1 string `json:"addressLine1" bson:"addressLine1"` AddressLine2 string `json:"addressLine2" bson:"addressLine2"` Landmark string `json:"landmark" bson:"landmark"` Zipcode *str...
Changing slides using anchor tags or buttons from different div <p>I have a bootstrap carousel in my page and I want to change slides using anchor tags or buttons from different <code>div</code> how to do it?</p>
<p>This can be done through jQuery.</p> <pre class="lang-js prettyprint-override"><code>$('#nextButton').on('click', function() { $('.carousel').carousel('next'); }); $('#previousButton').on('click', function() { $('.carousel').carousel('prev'); }): </code></pre>