input
stringlengths
51
42.3k
output
stringlengths
18
55k
Space separated integers to array <p>I'm new to C, and I have an assignment where I get an input of <code>n</code> space separated integers, and <code>q</code> integers separated by new lines. I would like to save the <code>n</code> integers in an array <code>a</code>, and the <code>q</code> integers in another array <...
<p>I'm not sure but when i run your code i get segmentation error because instead of:</p> <pre><code> int n, q; int a[n]; int m[q]; scanf("%d %d", &amp;n, &amp;q); </code></pre> <p>You should first read n,q and then declare a[n],m[q] like this:</p> <pre><code>int n, q; scanf("%d %d", &amp;n, &amp;q);...
Bitmessage as basis for open-source alternative to WhatsApp? <p>Is it possible to use <a href="http://www.bitmessage.org" rel="nofollow">Bitmessage</a> as basis for an open-source alternative to WhatsApp?</p>
<p>The following links might be useful for you. I do not know anything about this topic.</p> <ul> <li><a href="https://whispersystems.org/blog/facebook-messenger/" rel="nofollow">https://whispersystems.org/blog/facebook-messenger/</a></li> <li><a href="https://github.com/whispersystems/" rel="nofollow">https://github....
How to loop array <p>I have a table, from this table I want to select all, where array(). My array:</p> <pre><code>Array ( [0] =&gt; 3 [1] =&gt; 4 ..etc.. ) </code></pre> <p>I use this:</p> <pre><code>$db-&gt;where('id',array(***,***),"IN"); $db-&gt;get('cars'); </code></pre> <p>How can I loop the array...
<p>To solve this, this should be:</p> <p><code>$db-&gt;where('id',$search-&gt;cars,"IN");</code></p>
Fetching value from table and passing it in url <p>How can i use in table field values in the url</p> <p>SQL Query wherein all 3 tables are joined</p> <pre><code>select * from nfojm_usedcar_variants cv inner join nfojm_usedcar_products cp inner join nfojm_usedcar_categories cc on cc.id=cp...
<p>If you have multiple tables in a join that share a common column name, and you need them, then alias them. Such as:</p> <pre><code>select a.id as aid,a.theName,b.id as bid,b.year from tableA a join tableB b on b.id=a.id </code></pre> <p>then refer to those columns as <code>aid</code> and <code>bid</code> in your c...
Rstudio: Changing origin for git version control of project <p>I originally set up git in Rstudio while enrolled in the <a href="https://www.coursera.org/learn/data-scientists-tools" rel="nofollow">Data Scientist's Toolbox</a> course at Coursera. Unfortunately, I did this in my phd project. The repository no longer exi...
<p>Git, Github and Rstudio are different things. You could use git as local version control tools. You might connect your local repo to Github account which is based on git by push/pull. Rstudio just makes a user interface for git and supplies the function to push the repo into remote server based on git to make versio...
Materializecss Toasts with PHP <p>So I'm making this web control panel but I'm not good with <code>JS</code>. I'm using <code>MaterializeCSS</code> + <code>HTML</code> + <code>PHP</code> for the <code>DB</code> login and so on.</p> <p>I would like to have the following simple functionality but for some reason I'm fail...
<p>I had 2 problems. Most importantly, I was testing the code in an IF that wasn't even executed. Stupid me. Secondly, I wasn't using onDocumentReady - <code>$(function(){});</code></p> <p>The document referrer is just to check which page sent me there but here's my working code to create a MaterializeCSS <code>Toast<...
Using a constant inside of a service - AngularJS <p>I am trying to use two constants inside a service, but the constants are undefined. I also included these constants in different controllers and there isn't the problem with undefined variables. Why is this the case?</p> <pre><code>var app = angular.module("angularJs...
<p>Your factory Should be like this,</p> <pre><code>app.factory("databaseService", ["user1Constant","user2Constant", function(user1Constant,user2Constant) { console.log(user1Constant); } </code></pre>
SAS: Plotting overlayed graphs without time series <p>I think the plotting engine in SAS is not really straight forward. I hope someone can help me on that:</p> <p>I want to plot the volumes of 4 different stocks´ orderbooks. But it just draws weird dots. I have the following sample dataset:</p> <blockquote> <p>St...
<p>The problem is that you are trying to use y*x=z plots with the overlay option. This is not supported, as per the documentation page: <a href="http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#gplot-plot.htm" rel="nofollow">http://support.sas.com/documentation/cdl/en/graphref/63022/HT...
How to structure Firebase Database <p>I am using Firebase Database for my mobile and web application. I wanted to get advise for how to structure the JSON Tree. I have the following use case in mind:</p> <p>Mobile app user logs in and gets all nearby restaurants in a list. User sets order on one restaurant. The restau...
<p>Consider a data structure like this, you don't want to retrieve all the request when you get a restaurant and this way, you can get all the requests for a restaurant and all the requests from a particular user.</p> <pre><code>{ "requests": { "req1": { "status": 0, "time": 1473593...
How to view default data from the table before ajax search takes place using php and sql server <p><strong>This is my index.php file</strong></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...
<p>If I understand correctly you want to show all results when the page is first loaded up, then filter with keystroke content when the user is typing.</p> <p>To do this, you need to have a condition in search.php that when the value of the 'search' parameter passed to it is null (or empty string, or whatever you choo...
Redirect www.sub.domain.com to https://sub.domain.com <p>I've tried several rewrite rules trying to make this work, but it would still redirect to <code>https://www.*</code>.<br> What I want to achieve is to redirect, <code>www.sub.domain.com</code> to <code>https://sub.domain.com</code>.</p> <p>This is the code I tri...
<p>Your rule doesn't work for two reasons</p> <ul> <li><code>RewriteCond</code> restricts the rule to requests for sub.domain.net and ignores requests for www.sub.domain.net</li> <li>The <code>RewriteRule</code> uses <code>%{HTTP_HOST}</code> in the substitution. So even if it would apply for www.sub.domain.net, it wo...
Calculate sum of values in tree(recursive query) <p>I have tree structure in table employees (id,name,parentid) and this table can be nested.employees is one-to-many relation to another table Sales with columns(id, employeeid, quantity). Each employee has Sales Quantity. I want to calculate sum of quantity for each emp...
<p>If your "Employees" table occasionally changes, I recommend you to implement <a href="https://en.wikipedia.org/wiki/Nested_set_model" rel="nofollow">Nested set model</a>. Writing will be more complex, but reading will be simplier and faster.</p>
Java Midi Controller LED's <p>I'm building a small remote control app for x32 Mixing Console, now i have a problem with the midi controller im using as the remote control input device on my raspberry pi . Its a Behringer XTouch mini <a href="https://media.music-group.com/media/PLM/data/docs/P0B3M/X-TOUCH%20MINI_QSG_WW....
<p>The <code>ShortMessage</code> class has fields such as <a href="https://docs.oracle.com/javase/7/docs/api/javax/sound/midi/ShortMessage.html#NOTE_ON" rel="nofollow">NOTE_ON</a> that help you construct a message with the correct values.</p> <p>And "CC" would be a control change message.</p> <p>And you have to use t...
Transforming string output to JSON <p>I'm getting some data from an external system (Salesforce Marketing Cloud) over API and I'm getting the data back in the format below:</p> <pre><code>Results: [(List){ Client = (ClientID){ ID = 113903 } PartnerKey = None CreatedDate = 2013-07-29 04:43...
<p>To convert your array, you could use var jsonString = JSON.stringify(yourArray);</p>
How to capture Storage.Objects.Insert request failure/errors? <p>Here is my code to upload file into Google cloud storage,</p> <pre><code>public static void uploadFile(String name, String contentType, File file, String bucketName) throws IOException, GeneralSecurityException { InputStreamContent contentStr...
<p>Errors won't exist in the response object. Instead, you'll see an exception be generated. You can <code>catch (GoogleJsonResponseException e)</code> and inspect the <code>GoogleJsonError</code> from <code>e.getDetails()</code>. See <a href="https://github.com/google/google-api-java-client-samples/blob/master/storage...
Replace DataSource bean with H2 DataSource at runtime <p>I'm working on a test framework. </p> <p>I want to replace a MySQL <code>DataSource</code> bean with one for H2 (that isn't configured as a bean in XML) when some use cases require H2.</p> <p>Some use cases still use MySQL, so I can't modify the <code>DataSourc...
<p>One option is to use Spring's support for <em>bean definition profiles</em> and <code>@ActiveProfiles</code> in your test classes.</p> <p>However, if you are not willing or able to do that, another option would be to implement a custom <code>BeanFactoryPostProcessor</code> that <em>replaces</em> the bean definition...
What's wrong in this SQL Query with NOT LIKE statement? <pre><code>SELECT * FROM combinazioni WHERE ( sesso = '3' OR sesso = 'f' ) AND ( menopausa = '3' OR menopausa = '1' ) AND ( ipert_a = '3' OR ipert_a = '1' ) AND ( obesita = '3' OR obesita = '1' ) AND ( LOWER( i_alimento ) NOT L...
<p>I'm pretty sure you want <code>and</code> instead of <code>or</code>. But, you should use <code>in</code> and simplify the whole <code>where</code> clause:</p> <pre><code>WHERE sesso IN ('3', 'F') AND menopausa IN ('1', '3') AND ipert_a IN ('1', '3') AND obesita IN ('1', '3') AND (LOWER(i_a...
Hive Avro external table query - IOException: Not a data file <p>I am having an issue with Hive external table creation with Avro data / schema:</p> <p>Steps followed:</p> <ol> <li>Imported data from MySQL - HDFS as AVRO.</li> <li>Transferred the .avsc file from local to HDFS [ Opened the file and the schema is as e...
<p>Are you using the same folder where you imported data from sqoop?</p> <p>If yes, as all the mapreduce job sqoop also creates _SUCCESS file in the output folder which is not identified by the Avroserde. So, remove the _SUCCESS file from the folder you are pointing in hive create query, then the select query will wor...
Setting a temporary environment variable for Batch from C++ <p>I am implementing a small pack of programs for batch users to use. Almost all things in this pack is made in C++ and is called from Java.</p> <p>How would I set a environment variable for the Batch file to use?</p> <p>I have tried using this:</p> <pre><c...
<p>After some research I came to the conclusion that a child process cannot modify the parent process' environment.</p>
Setting scan coordinates in device options on pyinsane <p>I use Sane's command line utility (<code>scanimage</code>) in order to scan films from the transparency unit of my scanner. Here is the command that I have been using with success:</p> <pre><code>scanimage --device-name pixma:04A9190D \ --source 'Transparency U...
<p>pyinsane's option descriptions actually say the values are in milimeters: </p> <pre><code>Option: br-x Title: Bottom-right x Desc: Bottom-right x position of scan area. Type: &lt;class 'pyinsane.rawapi.SaneValueType'&gt; : Fixed (2) Unit: &lt;class 'pyinsane.rawapi.SaneUnit'&gt; : Mm (3) Size: 4 Capabi...
Not able to select value - error "Select only works on <select> elements, not on <a>" <p>I am trying to retrieve all possible year, model and make from [<a href="https://www.osram-americas.com/en-us/applications/automotive-lighting-systems/Pages/lrgmain.aspx]" rel="nofollow">https://www.osram-americas.com/en-us/applica...
<p>The problem with your current approach is that you are finding the <code>a</code> element and trying to use it as a <code>select</code> element. <a href="http://selenium-python.readthedocs.io/api.html#selenium.webdriver.support.select.Select" rel="nofollow"><code>Select</code> class</a> will only work with <code>sel...
TextArea text style does not change to plain from italic in Java <p>I have two <code>RadioButton</code> to select either Italic or Plain Style for a <code>TextArea</code>.(They are added to ButtonGroup so only one can be selected)</p> <p>I have the actionPerformed method as</p> <pre><code>public void actionPerformed(...
<p>change your code to </p> <pre><code>public void actionPerformed(ActionEvent ae) { Font currentFont = taText.getFont(); //taText is TextArea Font fontToSet; String command = ae.getActionCommand(); if (command.equals("Italic")) { System.out.println("Italic clicked"); fontToSet =current...
Cannot close ng-bootstrap Modal <p>So I have a <code>NgbModal</code> with a form in it, and what I want to achieve is closing it on successful submit.</p> <p>This is my ModalComponent:</p> <pre><code>@Component({ selector: 'create-update-transaction', templateUrl: './CreateOrUpdateTransaction.html', provi...
<p>This should work for you:</p> <pre><code>open(content) { this.modalRef = this.modalService.open(content); this.modalRef.result.then((result) =&gt; { this.closeResult = `Closed with: ${result}`; }, (reason) =&gt; { this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; }); } </code></pre>...
How to find in a list what thats number python3 <p>Im trying to find out the number of where X is in the list e.g: if i had a list like: <code>['a','b','c','d']</code> and i have 'c' how would i find where it is in the list, so that it would print '2' (as thats where it is in the list) thanks</p>
<p>Use the built-in method <code>list.index</code></p> <p>If you wanna know where is 'c': <code> l = ['a','b','c']</code></p> <p><code>l.index('c')</code></p>
How can I group table after inner join? <p>I am using SQL Server 2012.</p> <p>I have this table called <code>InspectionReviews</code>:</p> <pre><code>|Id | SiteId| IsNormal| DateReview | ObjectId |FrequencyId|InspectItemId | |3379| 5| True | 2016-09-08 00:00:00.000| 1019 | 1 | ...
<p>You can use query like this:</p> <pre><code>; with cte as ( SELECT InspectionReviews.Id, InspectionReviews.SiteId, InspectionReviews.IsNormal, InspectionReviews.DateReview, InspectionReviews.ObjectId, InspectionReviews.FrequencyId, InspectionReviews...
C++ implementation of abstract method not satisfied <p>In an Android project I have a quite messy inheritance situation that I can't fully understand. This is the error I get compiling:</p> <pre><code>proprietary/external/audioATCmdHandlerServer/AudioCmdHandler.cpp:4458:51: error: cannot allocate an object of abstract...
<p>The compiler is telling you that in the following statement of <code>AudioCmdHandler.cpp</code>: </p> <pre><code> m_MediaRecorderClient = new MediaRecorder(); </code></pre> <p>there is an attempt to instantiate the class <code>MediaRecorder</code> which is an abstract class. An abstract class means that it ha...
TypeError: unorderable types: str() <= int() error <p>Could you guys help me out with finding the wrong part of the code? I tried some things and searched on this site, but I couldn't find the solution.. If you guys know something, please let it know :D</p> <pre><code>print("Uw formule is ax**2+bx+c") a= float(input("...
<p>At the end of your for loop you reassign <code>D</code> to the result of calling <code>format</code>. That will always make it a string.</p> <p>I'm not sure why you're doing that, but you should remove that line.</p>
In SQL Server I did't find any examples how to convert int data type to date data type <p>I have a table with <code>INT</code> datatype column and my data is something like this</p> <pre><code>valid_to_day(int) ------------ 20150301 20150101 </code></pre> <p>I want to get previous date of this column, if I perform -1...
<p>You shouldn't store dates like that.</p> <p>The <code>Date</code> datatype is more compact, ensures you have no invalid dates, and can be used with date functions.</p> <p>Hopefully you need this so you can fix your schema.</p> <p>One method which does not rely on casting to string would be</p> <pre><code>SELECT ...
Bourne shell script, finding highest value in column 1 for specific value in column 3 <p>As the title puts it, i want to find the highest value in column 1 for each specific value in column 3. Then i want to print out column 2 for that line which has the ip-address, and column 3 with the errorcode.</p> <p>My code:</p>...
<p>Ignoring your code snippet, which seems totally unrelated to your description of the problem (I do not understand the presence of <code>$9</code>), I think you want:</p> <pre><code>sort -s -k3,3 -k1,1r $NAME | awk '$3 != l{print $2, $3; l=$3}' </code></pre> <p>All of the specific values in column 3 appear in conti...
Menu content does not overflow it's parent in Safari for iOS <p>I have created a menu using Bootstrap 3 on a website. This menu works fine in every browser I have tested in, and at any screen size. </p> <p>Except Safari on iOS, where the menu did not appear at all. </p> <p>Using CSS, I forced the container of the me...
<p>Try explicitly setting the navbar positioning to relative. There seems to be a recurring bug with positioning elements for Safari on iOS.</p>
Angular 2 RC5 Testing Promises in ngOnInit Not Working <p>I am trying to test a structural directive named MyDirective with Jasmine. The Angular version used is RC5.</p> <pre><code>// Part of the MyDirective class @Directive({selector: '[myDirective]'}) export class MyDirective { constructor(protected templateRef...
<p>It because a <code>Promise</code> (the one returned from <code>getData</code>) is asynchronous. So all the synchronous activity gets handled ahead of the <code>Promise</code> activity. Even though <code>ngOnInit</code> is called, the <code>Promise</code> is resolved asynchronously.</p> <p>There are a couple options...
Automatically cleaning specific files between checkouts <p>Our project is on git, but our compilation product is not. Now, we need a way to automatically delete the compiled product (lets say <code>kuku.exe</code>) from the folder when we're checking out a new branch (because it became irelevant, and we want our script...
<p>If your binary is correctly ignored by Git (<code>.gitignore</code>), the checkout can proceed.</p> <p>Upon successful completion, a <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#Client-Side-Hooks" rel="nofollow"><code>post-checkout</code> hook</a> can then delete/clean the working space, in ord...
Android: How to get JSON object from Zomato API? <p>My goal is to display a list of nearby restaurants using the Zomato API. I first need the JSON object to get the names of these restaurants. I've already got the API key and I know that the request URL would look like this</p> <pre><code>https://developers.zomato.com...
<p>You can use a Rest Client to call the request with the header and URL. I suggest using <a href="http://%20https://developer.android.com/training/volley/index.html" rel="nofollow">Volley</a> or <a href="https://github.com/square/retrofit" rel="nofollow">Retrofit</a> to do it. Here is an example using Volley:</p> <pr...
Writing ASP.NET frameworks other than WebForms or MVC? <p>I want to know what "clean" ASP.NET looks like. For example, I want to build my own framework on ASP.NET, and I don't know what assembly I should include. </p> <p>All books discussing ASP.NET describe either WebForms or MVC, but none explain the ASP.NET layer o...
<p>Both WebForms and MVC are implemented through a handler, see the <a href="https://msdn.microsoft.com/en-us/library/bb398986.aspx" rel="nofollow">ASP.NET Page Handler</a> and <a href="https://msdn.microsoft.com/en-us/library/system.web.mvc.mvchandler(v=vs.118).aspx" rel="nofollow">MvcHandler Class</a> on MSDN.</p> <...
Cannot connect Impala-Kudu to Apache Kudu (without Cloudera Manager): Get TTransportException Error <p>I have successfully installed kudu on Ubuntu (Trusty) as per the official kudu documentations (see <a href="http://kudu.apache.org/docs/installation.html" rel="nofollow">http://kudu.apache.org/docs/installation.html</...
<p>According to the log, impalad quits because the default filesystem is configured to be LocalFileSystem, which is not supported. You have to set a distributed filesystem, such as HDFS as the default.</p> <p>Although Kudu is a separate storage system and does not rely on HDFS, Impala still seems to require a non-loca...
System "Pin to this list" and "Remove from this list" jump list context menu actions don't do anything for items in custom jump list grouping <p>I've created a custom jump list grouping of items for my UWP:</p> <pre class="lang-cs prettyprint-override"><code>_jumpList = await JumpList.LoadCurrentAsync(); var mru = Wi...
<p>Unfortunately it seems that this functionality was not yet implemented by Microsoft into UWP apps and is currently available only for the system-managed default group of items.</p> <p>You can create named groups of jumplist items, but that will cause the pin button to be displayed albeit it is not functional.</p> ...
Grafana not picking up collectd metrics from graphite ui <p>I installed, graphite using pip on a system with the graphite ui, I installed collectd on the systems whose metrics I need, and everything shows up very well in the graphite ui.</p> <p>I then installed grafana on a system and did an import of graphite, but in...
<p>Make sure the collectd metrics naming convention matches what the dashboard expects.</p>
Enforce one describe per file <p><strong>The Story:</strong></p> <p>We have a rather big test codebase with Protractor+Jasmine tests. </p> <p>One of the current problems we have is that <em>some of the test/spec files contain more than one describe</em> which causes troubles from time to time - for example, when debu...
<p>The tricky part is flagging only describe blocks that are not nested, or "top-level" describes. Luckily, this is totally possible with ESLint!</p> <p>ESLint "visits" the nodes two times while traversing the abstract syntax tree (AST, for short) of your JavaScript code: once while going <strong>down</strong> the tre...
ng-repeat duplicate issue, when there are not any duplicates <pre><code>$scope.subjects = [ "Computer Security", "Graphics and Multimedia", "Networks", "Computer Science and Engineering", "Game Design", "Programming", "Information Technology", "Software Engineering", "Technology Management", "Tele...
<p>Try to add a track in your ng-repeat:</p> <pre><code>&lt;label class="concentration-label3" ng-repeat="subject in subjects track by $index"&gt; </code></pre>
Encoding issue when writing to CSV file in Python <p>I have some encoding issue while writing an array to CSV.</p> <p>Code:</p> <pre><code>import csv a = [u'eNTfxfwc', 'Pushkar', 'Waghulde', 'pushkar.waghulde@gmail.com', 'Los Angeles', '', 'UNITED STATES', '2652 Ellendale Pl # 9', '', 'Los Angeles, UNITED STATES', u'...
<p>Just encode the elements in a before writing them</p> <pre><code>a = [i.encode('utf-8') for i in a] f3 = open('test.csv', 'at') writer = csv.writer(f3,delimiter = ',',lineterminator='\n',quoting=csv.QUOTE_ALL) writer.writerow(a) </code></pre>
Lowest common ancestor, how to build the tree from command line input? <pre><code># Python program to find LCA of n1 and n2 using one # traversal of Binary tree # def build_graph(): # n = input() # ex1, ex2 = raw_input(), raw_input() # d = {} # for i in xrange(n-1): # e1, e2 = map(str, raw_inpu...
<p>I'd recommend you use a dictionary or some other way to keep track of the members of the tree. </p> <p>According to the way you build the tree, this is what I came up with: When you parse each ordered pair, </p> <ul> <li>Check whether the parent is in the tree or not. If the parent is present, check if there alrea...
`node` api getting error on `post` - body param being as labels how to solve this? <p>I am posting the data to back-end using postman, which works fine. Using the same api I am trying to post the data through angular gives me the issue. But I understand that something going on wrongly between my <code>form</code> data ...
<p>I have removed header from <code>$http</code> request, and it works fine.</p> <p>my code with issue is : with header</p> <pre><code>vm.createNewFamily = function() { $http({ method : 'POST', url : '/api/family', data : vm.form, he...
Symfony2 Form EntityType Datagrid view <p>Using Symfony2, is it possible to display an EntityType as a datagrid type of view? I want the user to be presented the data view so they can see other properties other than what I would jam into the __toString() method. The datagrid would best be displayed with a checkbox at ...
<p>Symfony has no such functionality out of the box.</p> <p>You can either <a href="http://symfony.com/doc/current/form/create_custom_field_type.html" rel="nofollow">extend</a> EntityType and define a separate template for each entity you have, or you can make your app based on <a href="https://sonata-project.org/bund...
Flex working on web but not mobile <p>Here is my code: </p> <pre><code>&lt;li class="new"&gt; ... &lt;div id="left-content"&gt; &lt;span id="right" class="btn btn-primary label"&gt;0&lt;/span&gt; &lt;span class="btn btn-primary label"&gt;0&lt;/span&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p...
<p>The issue here are <code>align-items</code> and <code>justify-content</code> properties set for <code>#left-content</code> element.</p> <p>You set them both to <code>left</code> which is not even a correct value for those properties. Possible values are:</p> <p><code>align-items: stretch|center|flex-start|flex-end...
Redefining a corrupted reference <pre><code>class A { }; int main() { A *a= new A(); // variable "a" must be pointer, I can't edit this line A&amp; b = *a; //b must be a reference delete a; //deletion a= new A(); //re-definition //b is now corrupted. } </code></pre> <p>In a piece of code that I...
<p>You can do this, subject to some constraints:</p> <pre><code>A* a = new A(); // variable "a" must be pointer, I can't edit this line A&amp; b = *a; // b must be a reference a-&gt;~A(); // destroy first object new (a) A(); // create second, new object in its place delete a; // destroy second ...
Model error in ASP.NET MVC 5 <p>I am currently trying to do an update on a specific row of the table. For instance, on one page, I retrieved all data and displaying it on a <code>WebGrid</code>. </p> <p>In the <code>WebGrid</code>, I added a column with a<code>button</code> called <code>Update</code>. User will click ...
<p>Change your action method </p> <pre><code>public ActionResult ResponseFeedBack(int responseID) { var responses = Response(); using (ACIFYPJEntities aci = new ACIFYPJEntities()) { responses = (from c in aci.Responses where c.responseID == responseID ...
Need to make code all modular. Goal is to calculate gross and bonus pay contributions based on user input <pre><code>#global variable CONTRIBUTION_RATE = 0.05 def main(): #if these are set to 0 they do not calculate contribution but it does run the program. grossPay = 0 bonusPay = 0 #gets gross pay fr...
<p>Should be what you're looking for. Try this</p> <pre><code>#global variable CONTRIBUTION_RATE = 0.05 def main(): gross = GetGrossPay() bonus = GetBonusPay() sum = GetSumContribution(gross, bonus) showGrossPayContrib(gross) showBonusContrib(bonus) showSumContrib(sum) def GetGrossPay(): ...
value of textarea in loop <p>html and php:</p> <pre><code>foreach($questions as $question) { ?&gt;&lt;br&gt;&lt;textarea class="answer"&gt;Answer here...&lt;/textarea&gt;&lt;button data-id="&lt;?php echo $question-&gt;id;?&gt;"class="addanswer"&gt;Post&lt;/button&gt;&lt;?php } </code></pre> <p>jquery:</p> <pr...
<p>This is your problem:</p> <pre><code>var answer=$('textarea.answer').val(); </code></pre> <p>This will always give your the value of the first <code>$('textarea.answer')</code> element that jQuery encounters; it not linked to the clicked button in any way.</p> <p>You want the value of the element next to the butt...
PHP Personality Insights <pre><code>&lt;?php $curl = curl_init(); $post_args = array('body' =&gt; $data ); $header_args = array( 'Content-Type: text/plain', 'Accept: application/json' ); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_arg...
<p>In this php code what is <code>$data</code> variable you just assign to <code>$post_args['body']</code>. i think you are using in post filed so just try if you get somthing from url than </p> <pre><code>$post_args = array('body' =&gt; $_POST['data']) ; </code></pre> <p>or just set some value if you sending to the...
Why drag and drop is not working in Selenium Webdriver? <p>I am trying to drag an element into another element using Selenium WebDriver but it's not working. I tried all the solutions which I can find on internet but none of the solutions seems to be working for me. </p> <pre><code>WebElement sourceelement = driver.fi...
<p>In your code 1: Not calling perform() method, it should be </p> <blockquote> <p>Actions builder = new Actions( _controls.getDriver());</p> <p>builder.dragAndDrop(sourceelement, destelement).perform();</p> </blockquote> <p>In your code 2: I don't think you need to call release()</p> <p>Please search for <a...
Angular template view with utf-8 chars doesn't work <p>I try to use "ngroute" to load html templates.<br> Everything works fine, but when I try to show words in Hebrew in the "ng-view", I get only question marks instead of the Hebrew chars (???????????).<br> in the <code>&lt;head&gt;</code> tag I added <code>&lt;meta c...
<p>I added the <code>&lt;meta meta charset=utf-8&gt;</code> tag to the all the templates html and not just to the <code>&lt;head&gt;</code> and it fixed the problem.</p>
Getting error "cannot resolve symbol getInstance" in firebaseAuth <pre><code> protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ... firebaseAuth = new FirebaseAuth.getInstance(); </code></pre> <p>getting error in -> g...
<p>Change:</p> <pre><code>firebaseAuth = new FirebaseAuth.getInstance() </code></pre> <p>to</p> <pre><code>firebaseAuth = FirebaseAuth.getInstance() </code></pre>
get attribute value from xsd node using LINQ <p>I have below xsd file .</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xs:schema xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" elementFormDefault="qualified" targetNamespace="http://allegrodevelopment.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;!--W...
<p>Use</p> <pre><code>XNamespace xs = "http://www.w3.org/2001/XMLSchema"; </code></pre> <p>and</p> <pre><code>List&lt;string&gt; values = data.Descendants(xs + "element").Attributes("name").Select(a =&gt; (string)a).ToList(); </code></pre> <p>gives you all name attribute values of all <code>xs:element</code> eleme...
Ionic 1 with Angular JS 1 or Angular JS 2 <p>I am a beginner in hybrid app development. I know there is Ionic version 1 and 2(unofficial release). There is also a Angular JS version 1 and 2 (unofficial release). The following are my questions</p> <ol> <li><p>Can I use Angular JS 2 with Ionic version 1 instead of Angul...
<p>My 2 cents,</p> <p><strong><em>1) Can I use Angular JS 2 with Ionic version 1 instead of Angular JS 1?</em></strong></p> <p>No you cant, Ionic2 is build from ground up for Angular2/Typescript</p> <p><strong><em>2) Do companies use Ionic 2 and/or Angular JS 2 as it is not an official release yet?</em></strong> </p...
Can't get any definition working - Scheme *beginner* <p>I can't seem to get any definition working in my scheme code - I'm new to the language so I'm not sure where I'm going wrong.</p> <p>I'm trying to define a cube function and I've got this written:</p> <pre><code>(define (cube (* x (* x ...
<p>That's not the correct syntax for declaring a procedure parameter. Also, you can pass several arguments to a multiplication at once. Try this:</p> <pre><code>(define (cube x) (* x x x)) </code></pre>
No mouse cursor in d3d9 GetFrontBufferData <p>I' writing a screen capturing application. The screen is captured using Direct3d 9 API and the output media file is written using Windows Media Foundation h264 codec.</p> <p>The app must work on all Windows versions starting from 7. Therefore, d3d9 API was chosen.</p> <p>...
<p>This is to be expected (the cursor isn't rendered into the display surface referenced in the call to <code>GetFrontBufferData</code>). You have to do the composition manually:</p> <ol> <li>Retrieve the current cursor shape by calling <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms648388.aspx" r...
How I do alternate color row in listView programmatically? <p>I need put an alternative color some rows in listView:</p> <p><img src="http://i.stack.imgur.com/dNz7g.jpg" height="350"/></p> <p><strong>My actual code</strong></p> <pre><code>public class Agenda { List&lt;Schedule&gt; tabelaAgenda = new List&lt;...
<p>I solved! I changed from arrayList to BaseAdapter. Based on this print attached here.</p> <p>Thanks @Orkhan Alikhanov and @user1230268 :)</p> <p><a href="http://i.stack.imgur.com/T5fNC.jpg" rel="nofollow">Screen 1</a> <a href="http://i.stack.imgur.com/bM3zP.jpg" rel="nofollow">Screen 2</a></p>
wm_title("message") is getting cut off by the tkinter window? <p>I am creating a simple tkinter window pop up (pastebin link : <a href="http://pastebin.com/kvv0G4rM" rel="nofollow">http://pastebin.com/kvv0G4rM</a>). The problem I am facing is the title message ("Enter expenses") is cut off from the tkinter window which...
<p>As discussed in the comment section, I incremented the height and width of the tkinter window for every add new row function call . This increased the responsiveness of the tkinter window size. I am pasting a dummy code that shows the increase of the window size for every "Add Expense" button click. Any kind of cod...
Php - Store credit card information off server? <p>This might be quite a long read, because there is a bit if relevant back story. Of you just wanted to see the question summarized I have it written at the end.</p> <p>Edit: I realize hiding the type of business isn't useful, it's a maid/cleaning business.</p> <p>I'm ...
<p>Yes of course there is a solution.</p> <p>There are companies (Payment processing companies) that are doing exactly this, they charge a fee and offload all of the responsibility from you.</p> <p>They invest a lot of money to be able to validate all of the security measures required by the law, including PCI compli...
How can I see my uploaded images? <p>Ruby version 2.2.4 Rails version 5.0.0.1 Carrierwave </p> <p>Hello people</p> <p>I am a totally beginner in RoR and after long hours I finally uploaded an picture from my android app to ruby on rails. I have the code from a tutorial which provides the upload function. However the ...
<p><code>&lt;td&gt;&lt;%= item%&gt;&lt;/td&gt;</code></p> <p>should be something like :</p> <h2>edit sorry I forgot the image tag...</h2> <p><code>&lt;td&gt;&lt;%= image_tag item.picture %&gt;&lt;/td&gt;</code></p>
getimagesize returns warning if file size is more than 2 MB <p>I am trying to get images from users. Now if file size is more than 2 MB, my script should return a message to the user saying that there is a file size restriction of 2 MB. For this I have kept a check as follows -</p> <pre><code>if($_FILES["QuestionImage...
<p>This solution was posted by somebody else, which was then deleted. It works. But I need to understand the fundamental problem </p> <pre><code>if(filesize($_FILES['QuestionImage']['tmp_name']) &gt; 2097152){ echo "File size is more than 2 MB"; }else{ $check = getimagesize($_FILES["QuestionImage"]["tmp_name"...
Why doesn't my Spinner update it's binded property the first time it is initialized? <p>I have a <code>Spinner</code> in controller:</p> <pre><code>@FXML private Spinner&lt;Integer&gt; spnMySpinner; </code></pre> <p>and a <code>SimpleIntegerProperty</code>in controller:</p> <pre><code>private static final SimpleInte...
<p>You are running into the "premature garbage collection" problem. See a description of this <a href="http://tomasmikula.github.io/blog/2015/02/10/the-trouble-with-weak-listeners.html" rel="nofollow">here</a>. You will likely find that it's not always every other time you show the spinner that it fails, but is just sp...
Context switching executes same statement twice <p>I am trying to learn how context switching works and how to make your process switch context after receiving a particular signal. Here is my code</p> <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;ucontext.h&gt; #include&lt;signal.h&gt; #inclu...
<p>Although minor, the uc_link member of ucontext_t should be assigned a value before passing to <a href="http://linux.die.net/man/3/makecontext" rel="nofollow">makecontext</a>.</p> <p>Otherwise, from the Linux man page, <a href="http://linux.die.net/man/2/setcontext" rel="nofollow">setcontext</a> will call the funct...
Passing value over to next viewController <p>I am currently writing an app in <code>Swift</code> and I implemented all my UI programatically. I would it kind of exhausting, so recently I decided to use <code>storyboard</code> but I am stuck with a bug.</p> <p>When passing over the <code>mainContext</code> from the <co...
<p>You're not accessing the rootViewController, you're creating a new view controller and not doing anything with it, to access the rootViewController replace this</p> <pre><code>let storyboard = UIStoryboard(name: "Main", bundle: nil) var vc = storyboard.instantiateViewControllerWithIdentifier("FirstView") as! First...
Varnish 4.1 - Call a restart according to the backend response <p>Prior to Varnish 4, One could call a restart from vcl_fetch to start another flow reaching vcl_recv.</p> <p>In version 4, logic was separated to client and backend, I need to be able to call a restart according to the backend response. One direction I t...
<p>You cannot restart a request during <code>vcl_backend_*</code> in Varnish 4.x.</p> <p>You could <code>return (abandon)</code> during <code>vcl_backend_*</code> and then restart the request in <code>vcl_synth</code> if <code>resp.status == 503</code>, but you cannot transport any information from <code>vcl_backend_*...
Deleting a bootstrap thumbnail with jQuery <p>I have many thumbnails like the one pasted below on my page. What I am trying to do is to delete one of them using the delete button (<code>id=del</code>).</p> <p>I tried using this code </p> <pre><code>$(this).parents('div'); </code></pre> <p>but this code deletes all ...
<p>This should do it: (This onclick method works for dynamic content)</p> <pre><code>$(document).on('click', 'div.thumbnail #del', function() { $(this).parent().parent().parent().find('.imgProduct').remove(); }); // $(this) DEL Button // .parent() P Tag // .parent() Div.ca...
Column not lining up <p>I am trying to achieve a column-style for converting celcius to fahrenheit.</p> <p>My question: When I run it, the numbers are lining up nicely. However the c and f are aligned left and are not above the numbers. Why is this?</p> <p>Here is my code:</p> <pre><code>def convert(celc): fahr ...
<p>Use <code>&gt;</code> in your format to always align to the right:</p> <pre><code>format_str = '{0:&gt;10} {1:&gt;10}' </code></pre> <p>The default is for strings to be left-aligned, numbers to be right-aligned.</p> <p>From the <a href="https://docs.python.org/3/library/string.html#formatspec" rel="nofollow"><em>...
javascript eventlistener not working <p>I want to make a startscreen with the function to start the game when the user presses SPACE but my code doesn't work.</p> <pre><code>var level1 = false var keys = []; window.addEventListener("keydown", function(e){ keys[e.keyCode] = true; }, false) window.addEventListener...
<blockquote> <p>but when i press SPACE the variable level1 is still on false</p> </blockquote> <p>Yes. Why would it be anything else? Nothing in your event handlers is updating it.</p> <p>If you want to update it when an event occurs, update it in the event handler.</p> <p>Perhaps have a function that updates the ...
on item click, items re-renders and scroll comes to the top which is undesired <p>I have made a component where I am rendering grids of items. On clicking one item, the item is being selected. However there are many items present so there is scroll bar. Whenever I click on an Item, the component is re-rendered (as I am...
<p>Try changing your <code>handlePostClick</code> definition to </p> <pre><code>handlePostClick = (e, adCreativeAsset, id) =&gt; { e.preventDefault(); //blah blah what you want } </code></pre> <p>and in your JSX change <code>onCreativeTileClicked={this.handlePostClick}</code> to <code>onCreativeTileClicked={...
project euler qn 23 <p>A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.</p> <p>A number n is called deficient if the sum of its proper diviso...
<p>It seems the mistake lies in the last break you've entered into the code (the longest line).</p> <p>sumOfAbundance is a sum of two abundant numbers, and indeed you want to limit the search to make the program run faster. But - you should break the loop only in case sumOfAbundance is greater than limit. That's when ...
react pagination for sections <p>Im using NodeJS with React and I have a problem. I didnt find a npm module or a code that allowed me to create a pagination for a list of results. </p> <p>I have a variable called "jobs", that contains a list of job ads. In my render function I call:</p> <pre><code>{this.state.jobs.m...
<p>I would save the page in a state,</p> <p>and do something like that (say each page has 10 jobs ) - </p> <pre><code>{this.state.jobs.slice(this.state.page * 10, this.state.page * 10 + 10) .map(this.renderClass)} </code></pre>
How to pass a variable from one frame to another frame in HTML <p>Let's say I declared the variable <code>var = 5;</code> in <em>frame1</em>. Now how do I pass this variable to <em>frame2</em>? I'd like to pass it using a hyperlink. Are there any other ways to do that?</p> <p>Also, how do I access that variable after...
<p>You could use a query string. You could set the link in JavaScript like this:</p> <pre><code>var a = document.getElementById('linkId'); a.href = "link?var=" + var; </code></pre> <p>You would have to run this code each time you change your variable.</p> <p>If you need to parse the query string I would refer to thi...
Specify element ID in Ruby on Rails submit button form helper <p>I'm trying to apply an ID attribute to the form's submit button using the following code:</p> <pre><code>= form_for @guild do |f| = f.file_field :image = f.text_area :description = f.submit "speichern", id: "message_button" </code></pre> <p>Here i...
<p>First off, the HAML snippet you've included <em>should</em> be creating a submit button with the desired ID.</p> <p>Secondly, it appears that the HTML you've included is being generated by some different code: the image and description fields aren't present in the provided HTML and your code snippet wouldn't be gen...
CSS element changes taking no effect <p>Usually when I go to write custom CSS for a site, I use Inspect Element to view the contents of certain, well, elements. And it usually I just add the identifier for that line, and punch in some custom commands like "border: none;" but I keep coming across elements that don't app...
<p><code>element</code> is the DOM inspector's way of telling you that the styles are being applied inline, to the element itself - either directly in the HTML or via JavaScript.</p> <p>You can work around this by doing the following (inspired by <a href="https://css-tricks.com/override-inline-styles-with-css/" rel="n...
I have 3 elements with tabindex set, there is an invisible 4th element before it loops back to the first one. What is it? <p>I can't find what is taking the focus before the loop begins again after the third element in the index. Example:</p> <pre><code>Input 1 - tabindex="1" --&gt; Press tab --&gt; Input 2 - tabindex...
<p>Turns out it's the body element, which I suspected but didn't know how to prove. I was able to prove it in console with: </p> <pre><code>document.activeElement </code></pre> <p>Still not sure how to prevent focus on it though.</p>
How to set up a git repository in Windows VPS? <p>I have a VPS - Windows Server 2012 R2 and I already install GIT on the server.<br/> <br/> Now I want to set up a repository on it and our team can clone that repository to local computer and work on it. <br/> <br/> I try to find the way to set up but I have not found an...
<p>You need a listener (Apache or ssh) in order for Git on your VPS to listen to Git queries (clone/pull/push)</p> <p>You can use:</p> <ul> <li>ssh (with an <a href="http://serverfault.com/questions/8411/what-is-a-good-ssh-server-to-use-on-windows">ssh server</a>)</li> <li>IIS (with <a href="https://bonobogitserver.c...
How can i make widget of any ListView item? <p>I am working on the Note's application. In my appication i want to add the functionality like ColorNotes and Notes app. <strong>When i long click to any listview item then it should become the widget on main screen.</strong> </p> <p>How can i build such functionality ?</p...
<p>you can use below link to Learn App Widget <a href="https://developer.android.com/guide/topics/appwidgets/index.html" rel="nofollow">https://developer.android.com/guide/topics/appwidgets/index.html</a></p> <p>Use this Example for Sample this will help you to understand how will use list in Widget <a href="https://g...
Why is Ruby failing to connect to my Tor network? <p>I’m using Ruby on Rails 4.2.7 on Mac El Capitan and just installed the Tor browser (v 6.0.4). I fired up my Tor browser, have verified its running by viewing a couple of web pages, but using this gem — <a href="https://github.com/dryruby/tor.rb">https://github.c...
<p>Here is how you can make <code>brunogh/tor_requests</code> work with Tor Browser (easy):</p> <pre><code>require 'tor_requests' Tor.configure do |config| config.ip = "127.0.0.1" config.port = "9150" config.add_header('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/...
Are rewrite conditions required? <p>I have the following in my .htaccess file and it works perfectly on XAMPP, but does not work on my web host:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; Options All -MultiViews RewriteEngine on RewriteRule ^content/tagged/(\w+)/?$ content.html?tagged=$1 [NC,L,QSA] ...
<p>It would appear that Apache or mod_rewrite versions are not PCRE compatible. When I changed <code>(\w+)</code> into <code>([a-z]+)</code> the rewrite started working. I'll have to avoid the regex shortcuts and instead use their longer equivalents.</p> <p>EDIT: Modified the html to include <code>&lt;base href="/" /&...
How to set a property once it has been saved and re-save a child property? <pre><code>factory :user do company phone "123-123-1234" . . end </code></pre> <p>The company model has a property that I need to set also:</p> <pre><code>company.owner_id = -1 </code></pre> <p>But I need to set the owner_id to the u...
<p>You can use <a href="https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#callbacks" rel="nofollow">callback</a></p> <pre><code>factory :user do company phone "123-123-1234" . . after(:create) { |user| user.company.update(owner_id: user.id) } end </code></pre>
Rolling Window RccpRoll - end of sequence values not NA <p>In r, I am using RcppRoll rollings sum function I have a sequence stored in a column vector as <code>0 1 0 1 1 1 1 0 1 0 1 0</code> I want the rolling sum of 3 periods with a right align. <code>1, 2, 2, 3, 3, 2, 2 , 1, 2, 1, 1, 0</code> Instead I am getting <c...
<p>zoo package worked great: library(zoo) rollapply(df1$data, 3, sum, partial = TRUE, align = 'right')</p>
jQuery "$.cookie" not a function <p>I can't figure out why I'm getting this simple error in the console:</p> <pre><code>Uncaught TypeError: $.cookie is not a function </code></pre> <p>Here is where I implement JavaScript and jQuery:</p> <pre><code>&lt;script src="jquery.js"&gt;&lt;/script&gt; &lt;script src="cookies...
<p>The library you're using is not a jquery plugin. Use an older version - <a href="https://github.com/carhartl/jquery-cookie/blob/master/src/jquery.cookie.js" rel="nofollow">https://github.com/carhartl/jquery-cookie/blob/master/src/jquery.cookie.js</a></p> <p>As I didn't find any cdn source of this plugin I've copy-...
How to import project from git in AIDE? <p>I've created private repo on bitbucket and added public key from <code>PuTTY Key Generator</code>.</p> <p>Using TortoiseGIT I've managed to push my project from PC and then I wanted to pull it from AIDE. So I've created .ssh folder on /sdcard and made sure that this location ...
<p>So I've figured it out. In case someone gets the same problem here's the solution</p> <p>After generating a key in <code>PuTTY Key Generator</code> save files in the following way:</p> <ol> <li>public key: <ul> <li>copy content of <code>Public key for pasting into OpenSSH authorized_keys file</code></li> <li>past...
Meteor on Heroku not working <p>I create a simple Meteor app:</p> <pre><code>meteor create test-meteor-app cd test-meteor-app meteor </code></pre> <p>meteor starts</p> <p>Then I create a Heroku server.</p> <pre><code>git init heroku git:remote -a remote-test-meteor-app git add . git commit -am "make it better" git ...
<p>You should try using the <a href="https://github.com/jordansissel/heroku-buildpack-meteor" rel="nofollow">Meteor buildpack</a>, which includes all of the system dependencies a Meteor application needs to run (node, the meteor binary, etc.).</p> <pre><code>heroku buildpacks:set https://github.com/jordansissel/heroku...
How to Return Git Files to Original Folders <p>So I am fairly new to Git, and I did something quite stupid. I added git to a directory which contained many other directories. I then used add *.CPP to add files, not realizing it would pull them out of the subdirectories. Everything is now disorganized and I need to se...
<p>Assuming you committed your work before 'using add *.CPP', <code>git reset --hard</code> will restore your files and directories.</p>
Java Mail Api, delete mails from gmail <p>For testing reasons, I want an email account to be empty every day, I have this code but isn't deleting the emails.</p> <pre><code>public class EmailService { private String HOST = "imap.gmail.com"; private String USERNAME = "mail@gmail.com"; private String PASSWORD = "...
<p>You have to first copy the message to the folder <code>[Gmail]/Trash</code>, which will cause it to be immediately expunged from the current folder. Then you have to open <code>[Gmail]/Trash</code> and delete the message. That will make the message go away for good.</p> <p>I added this information to the <a href=...
Want to convert a function from Mysql to PDO <pre><code>function get_country($code){ $query = mysql_query("SELECT country FROM `list_countries` WHERE `code`='".$code."' LIMIT 1"); $country = mysql_fetch_array($query); return $country['country']; </code></pre> <p>}</p> <p>Very new to PDO and have absolutely no idea ...
<p>You need to take PDO database connection handler with you :) From your code I would suggest setting it as global, or you can add additional parameter to all the functions.</p> <pre><code>$dbconn = new PDO("mysql:host=localhost;dbname=your_db","your_user","your_password"); // this line is important - throw an excep...
get all child views inside linear layout <p>I have a linearlayout,I have dynamically created child views, which contains edittext,checkbox,spinner,radio button. I am getting value of all edittext but I dont know how will I get values of all checked checkbox and selected item of radio button and spinner dynamically,plea...
<p>try this for get value of selected RadioButton:</p> <pre><code>radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { radioButton = (RadioButton) findViewById(checkedId); Toast.makeText(ge...
Python Error message when opening .txt file / change in working directory <p>I’m a new python user and have written a python script that prompts for the name of a text file (.txt) to be opened and read by the program. </p> <pre><code>name = raw_input("Enter file:") if len(name) &lt; 1: name = "test.txt" handle ...
<p>It's very simple, your input is wrong:</p> <p>Incorrect:</p> <pre><code>$ python /test123.py Enter file:'test.txt' </code></pre> <p>Correct:</p> <pre><code>$ python /test123.py Enter file:test.txt </code></pre> <p>do not include the <code>'</code> characters. It is not code, it's just standard input</p>
Mybatis-Spring Java Configuration @MapperScan Annotation <p>I am trying to set up my mybatis-spring like shown in the following examples:</p> <p>1)Code from a previous answer on stackoverflow, a few answer down (<a href="http://stackoverflow.com/questions/8999597/mybatis-spring-configuration-cant-autowire-mapper-beans...
<p>I figured it out. I added a dependency</p> <pre><code> &lt;!-- https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-core --&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.ibatis&lt;/groupId&gt; &lt;artifactId&gt;ibatis-core&lt;/artifactId&gt; &lt;version&gt;3.0&lt;/version&gt...
How to create a bar chart in jasper studio? <p>I am completely new to jasper report. I am trying to create a bar chart with this data structure but unable to achieve.</p> <pre><code>Name Q1 Q2 Q3 Q4 abc 60 96 79 85 def 83 77 83 73 ghi 94 69 67 87 </code></pre> <p>is it possible to create t...
<p>The chart you like to display have <strong>4 category series</strong> (Q1,Q2,Q3 and Q4), which means you need to add all these category series separately.</p> <pre><code>&lt;categoryDataset&gt; &lt;categorySeries&gt; &lt;seriesExpression&gt;&lt;![CDATA[$F{name}]]&gt;&lt;/seriesExpression&gt; &lt...
ASP.NET Core Environment Variable Not Set <p>I'm trying to use Environment variables in my application so I don't have to bother maintaining config files across different systems. Maybe I just have a misunderstanding about where these variables are coming from.</p> <p>First, I created a Windows System variable called...
<p>Ok, my misunderstanding.</p> <p>According to this post: <a href="http://stackoverflow.com/questions/36994077/accessing-environment-variables-from-asp-net-core-1-rc1-iconfiguration">Accessing environment variables from ASP.NET Core 1 RC1 IConfiguration</a></p> <p>These are Web Application, Environment Variables fro...
Thank You message not displayed after Form submission <p>I was trying to display a thank you message in the same page after the submission of a form. However, even though the form gets submitted correctly, the message does not gets displayed.</p> <p>I'm using the following javascript to cater to this:</p> <pre><code>...
<p>I think that you should try this code if your sample data is right :</p> <pre><code>if(result.result.indexOf("success") &gt; -1){ document.getElementById("thankyou_message").style.display = "inline"; } </code></pre> <p>You are doing indexOf in JSON object you should do this on the string</p> <p><a href="http://w...
Left Div has uneven height because of text on the right Div, looking for fix with html/css <p>I have this layout. As explained inside the image I want the left box to follow the height of the right box, which changes because of the text I am putting inside the article(To clarify it is ok for the right to change height ...
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-css lang-css prettyprint-override"><code>body { display: flex; } body * { margin: 0; } #left{ width: 15%; background-color: b...
My Activity is restarts when i press back button <p><strong>*UPDATE</strong>! About this link - <a href="http://stackoverflow.com/questions/19109529/">Android close app on back button</a> - I have tried code from answers, but nothing is changing. I think my problem is in Activity A. When user open my app, Activity A c...
<p>You need to "finish" each activity right after you call to start a new activity. </p> <p>So after every <code>startActivity(intent)</code> you should add <code>finish()</code> right below it.</p> <p>That should take care of your problem.</p>
Instaling Rails on Linux Os <p>I am going through the process of installing Rails on my Linux OS. I have gone through most of the process but it appears something went amiss. I am using this tutorial: <a href="http://installfest.railsbridge.org/installfest/deploy_a_rails_app" rel="nofollow">http://installfest.rails...
<p>The error is caused by the sqlite3 gem that cannot be installed on Heroku (I don't know why). This was already solved here:</p> <p><a href="https://stackoverflow.com/questions/13083399/heroku-deployment-failed-because-of-sqlite3-gem-error">Heroku deployment failed because of sqlite3 gem error</a></p>
Interceptor for EJB 2.x <p>I want to log every incoming EJB call into DB.EJB 3 provides @AroundInvoke to intercept the incoming call and outgoing. Do we have similar thing for EJB 2.x?</p> <p>Need suggestion how can i achieve it?</p> <p>Thank you </p>
<p>It depends what you mean by "EJB 2.x".</p> <p>If you mean an EJB module without an ejb-jar.xml deployment descriptor or with ejb-jar.xml deployment descriptor declared that declares version="3.0" (or higher) but using EJB 2.x-style component interfaces, then yes, interceptors can be applied to any EJB regardless of...
Is there a way with ESS (Emacs Speaks Statistics) to get the *R* buffer where commands are sent actually be persisted to disk? <p>One of the advantages that Jupyter has these days when running with an R kernel seems to be the fact that your notebook command and output is saved. When I run <code>M-x R</code> from emacs ...
<p>Yes, you can save the buffer just as you would any other buffer in emacs.</p>
Why does haskell's `fix` seem to have trouble with tuples? <p>I'm trying to bend my head around fixed points and recursive definitions.</p> <p>This works:</p> <pre><code>&gt;&gt;&gt; take 10 $ let x = (0:x) in x [0,0,0,0,0,0,0,0,0,0] </code></pre> <p>This does the same thing, which makes sense given the definition o...
<p>You want</p> <pre><code>take 10 $ fst $ fix (\ ~(u,v) -&gt; (0:v,1:u)) ^^^ </code></pre> <p>so as to make the pattern matching lazy. In <code>let</code>, the LHS pattern is implicitly lazy/irrefutable.</p> <p>With the plain <code>\(u,v) -&gt; ...</code> the argument of the lambda will be dem...
WatchServiceDirectoryScanner not pulling new files created after first poll <p>I am reading root directory in FileReadingMessageSource from Spring Integration to retrieve ongoing file creations. Scenario is that there could be multiple sub-directories under root directory ongoing basis. WatchServiceDirectoryScanner fro...
<p>I've just wrote some test-case very close to your code:</p> <pre><code> @Bean public MessageSource&lt;File&gt; fileReadingMessageSource() { CompositeFileListFilter&lt;File&gt; filters = new CompositeFileListFilter&lt;&gt;(); filters.addFilter(new SimplePatternFileListFilter("*.watch")); ...