input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to handle mousepressed event along action command <p>How to move to various <code>JFrame</code> with handling mousepressed event along action command and get action command. Java swing code:</p> <pre><code>//this code belongs to home jframe class mntmPublicSector= new JMenuItem("Public Sector"); mntmPublicSec...
<p>Don't use a MouseListener on a JMenuItem.</p> <p>To handle the click of the menu item you should be using an Action.</p> <p>Read the section from the Swing tutorial on <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html" rel="nofollow">How to Use Menus</a> for more information and working ...
Two custom multiselect drop down dependent on each other <p>Two custom multiselect drop down dependent on each other and based on combined result need to show items and when selecting one then in other dropdown value should be disabled if combination is not found</p> <pre><code>&lt;div class="firstdrop"&gt; &lt;sp...
<p>The way I've done this in the past (loosely based on your example):</p> <pre><code>if($('#firstdrop').val() == 'some value') { var oldval = $('#seconddrop').val(); // In case the chosen option exists in the new option set var opts = '&lt;option value="val1"&gt;Val 1&lt;/option&gt;'; opts += '&lt;option...
Angularjs Dynamic Text Fields and multiply two field <p>Hi I have a Json Like this</p> <pre><code>[ { "id": 1, "name": "Furniture &amp; Fixture", "choices": [ { "req_goods": "", "qty": "10", "rate": "", "total": "" } ] }, { "id": 2, "name": "Mis...
<p>One way to accomplish this would be to create a method in your controller to do the calculation and then just call it on a change of <code>qty</code> or <code>rate</code>. </p> <p><em>controller:</em></p> <pre><code>$scope.updateTotal = function(choice) { if(!choice.qty || !choice.rate) { choice.total ...
Git blame commit changes for specific file of specific range of code <p>I would like to find out the commits for a specific file from line x to y. The following command outputs the commit changes but I would like to know how to retrieve just the first 8 characters of the commit changes using git blame?</p> <pre><code>...
<p>To get just the short commit from <code>git blame</code> you can pipe it through <code>awk</code> like so:</p> <pre><code>git blame -L 50,60 filename.txt | awk '{print $1}' </code></pre> <p>This will print the first field from the blame command, which in this case is the commit.</p> <p>For your second question:</...
Scrolling vertically and horizontally in Collection View - embedded flow layouts vs custom layout <p>Problem: I want to have a grid which scrolls vertically and horizontaly and is updated via CoreData's <code>NSFetchedResultsController</code></p> <p><strong>Solution 1: Nested Collection Views in Flow Layout</strong> ...
<p>Here is my custom CollectionViewLayout in Swift 2.3. You have to implement TwoWayCollectionViewLayoutDatasource to use it.</p> <p>Hope it can help you.</p> <pre><code>protocol TwoWayCollectionViewLayoutDatasource: NSObjectProtocol { func twoWayCollectionViewLayout(layout: TwoWayCollectionViewLayout, colectionV...
haskell - chain up elements with an associative binary operation <p>I am an intermediate schemer, but only a haskell beginner. Here is my problem: </p> <p>Suppose you have an associative binary operation, says <code>(&gt;&gt;=)</code>. Is there a polyvariadic function <code>p</code> such that <code>p (&gt;&gt;=) h g f...
<p>Yes, you can create such a function. It is very ugly however, and you will need to explicitly type every argument you are going to pass to make the compiler find the correct instance.</p> <p>Starting from <a href="http://stackoverflow.com/a/3467806/1048572">the polyvariadic function template</a> you linked, I arriv...
How to populate and display all images dynamically through a placeholder using a for loop in asp.net? <p>I am working on an asp.net C# webforms project. I have to debug an issue where once in a while I get "A generic error occurred in GDI+" error. This may be due to too many people accessing the site at the same time. ...
<pre><code>The problem is that, the loop runs and only the last image shows up. </code></pre> <p>This is because you actually create only one control outside of your loop. Add the image creation inside the loop as:</p> <pre><code>protected void btnGenerateBarCode_Click(object sender, System.EventArgs e) { var cod...
Matlab: Create RGB matrix depending on values in 2 other matrices <p>sorry for the stupid question. I want to define an RGB image in matlab depending on the values in two matrices. e.g.:</p> <pre><code> A B comparision RGB |1 0| |1 0| --&gt; |green red | |1 0| |0 1| --&gt; |purple cyan | <...
<p>You can convert the values <code>A, B</code> to indices and then use <code>ind2rgb</code> to map those indices to colors:</p> <pre><code>indImg = uint8(A.*2 + B); % generate indices [0..3] cMap = [1, 0, 0; % red 0, 1, 1; % cyan 1, 0, 1; % magenta 0, 1, 0]; % green comparison = ind2r...
Use Google Sheet Authentication for application, not for end user <p>I am trying to use Google Sheet in my application. This google sheet is not related to end user but will be under my own account. As per some tutorial on <a href="https://developers.google.com/sheets/" rel="nofollow">Google Sheets API</a> I have creat...
<p>Are you looking to publish the article publicly? </p> <p><a href="https://support.google.com/docs/answer/37579?hl=en" rel="nofollow">https://support.google.com/docs/answer/37579?hl=en</a></p> <p>You can use this method, then embed the sheet in an iframe on your site</p>
Web Application: View Layer PHP Vs Javascript <p>I'm developing a web application using PHP. I am creating a custom MVC framework. I have a few large forms which have to be loaded with data. I have to decide whether I use Javascript code to render this data or PHP like below. I know the syntax, I just want to know the ...
<p>Depends on overall architecture. If yo have cached form template at the client side, you can just make request for data and render form at client side. In case you plan to request template and then data, then, I guess, go for server side rendering.</p>
React & Draft.js - convertFromRaw not working <p>I'm using Draft.js to implement a text editor. I want to save the content of the editor to a DB and later retrieve it and inject it in an editor again, e.g. when revisiting the editor page.</p> <p><strong>First, these are the relevant imports</strong></p> <pre><code>im...
<p>Seems that MongoDB/Mongoose didn't like the raw content from the ContentState. Converting the data to a String before sending it to the DB did the trick:</p> <p><strong>Saving the ContentState to the DB</strong></p> <pre><code> saveBlogPostToStore(blogPost) { const JSBlogPost = { ...blogPost, content: JSON....
The value '2016-09-17' is invalid according to its datatype - how to fix? <p>I am working with an API integration to E-conomic using SOAP. The documentation for the SOAP call is listed here:</p> <p><a href="https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=CashBookEntry_CreateFromData" rel="nofollow">ht...
<p>The issue were fixed with date time class:</p> <p>$d = new \DateTime();</p> <p>$d->format('c')</p> <p>This gives us the standard W3 datetime format.</p>
Setting Slim parameters in order to debug <p>I enjoy using Slim, but am frustrated on how to debug it. Lets say I have the following routing. I can do a cURL request, and see the output, but instead I wish to go through the script line by line with my IDE debugger which happens to be NuShere's phpED. While I haven't...
<p>Based on Blake's comments, I created the following method, and call it in a constructor. After each request, a new test file is created which can be debug.</p> <pre><code> private function createTest($params,$method) { $inputs=print_r($params,1); $method=strtolower($method); $method2...
How to handle regular expression in ubuntu batch script that deal with IPv6 <p>I used radvd to generate 64-bit prefix in a format 3002:0200:00bc:098a::/64, but it appears in the eth0 of a client device in the form of 3002:200:bc:98a::/64. Now i have script that extracts this address and saves to file for eg "temp"as 30...
<pre><code>$ cat ip.txt 3002:200:bc:98a 20:1:ad:8b $ perl -F: -le 'foreach (0..$#F){$F[$_] = sprintf "%04s",$F[$_]} print join":",@F' ip.txt 3002:0200:00bc:098a 0020:0001:00ad:008b </code></pre> <ul> <li><code>-F:</code> split input line on <code>:</code></li> <li><code>$F[$_] = sprintf "%04s",$F[$_]</code> modify e...
<form> and Jquery ajax error <p>I got the following HTML form</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> function FormSubmit (){ $.ajax({ url:'do...
<p>Firstly, there is no <code>&lt;submit&gt;</code> element, and inputs are self-closing.</p> <p>Secondly, a button inside a form will submit the form and redirect the page, so the alert is never shown.<br> The reason it works when you don't type anything in the input, is because the input is <code>required</code> and...
mysql column auto update issue <p>Here is my table columns</p> <p>id----time_created----time_updated----db_user</p> <p>when a row is added to this table, or any updated occurred, the db_user should auto updates to the database username who insert/modify the row</p>
<p><a href="http://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_user" rel="nofollow">MySQL's <code>USER()</code> function</a> will yield the username provided when connecting to the data base. You can include that in an INSERT or UPDATE statement. There's no way to do it completely automatically...
python - import namespace <p>If I have a library like:</p> <p>MyPackage:</p> <ul> <li><p><code>__init__.py</code></p></li> <li><p>SubPackage1</p> <ul> <li><code>__init__.py</code></li> <li>moduleA.py</li> <li>moduleB.py </li> </ul></li> <li>SubPackage2 <ul> <li><code>__init__.py</code></li> <li>moduleC.py</li> <li>...
<p>In <code>MyPackage/__init__.py</code>, import the modules you want available from the subpackages:</p> <pre><code>from __future__ import absolute_import # Python 3 import behaviour from .SubPackage1 import moduleA from .SubPackage2 import moduleD </code></pre> <p>This makes both <code>moduleA</code> and <code>mo...
How to check if sqlite database file is writable by the web process in my Yii2 application? <p>I am developing an Yii2 application and at times, the Sqlite3 file which I use for database, becomes "read only" (due to other stuff happening on the server) and users are getting nasty PHP exception errors instead of a nicel...
<pre><code> public function attemptDBWrite() { try { $connection = \Yii::$app-&gt;db; if (is_writable($database_source_path)) { return false; } } catch (\yii\db\Exception $e) { \Yii::$app-&gt;getSession()-&gt;setFlash('error', var_dum...
Looping Object javascript <p>How can I build a loop in JavaScript?</p> <pre><code>var input = {0:['S','M','L','XL'],1:['Red','Blue','Black']}; var output = { 0:['S','Red'], 1:['S','Blue'], 2:['S','Black'], 3:['M','Red'], 4:['M','Blue'], 5:['M','Black'], 6:['L','Red'], 7:['L','Blue'], 8:['L','Black'], 9:...
<p>You are trying to mix object and array. Hope you want something similar to the following.</p> <pre><code>var ina = ['S','M','L','XL'], inb= ['Red','Blue','Black']; var c=[]; ina.map(x=&gt;inb.map(y=&gt;c.push([x, y]))); c.map(x=&gt;console.log(x)); </code></pre>
Blinking 3 LEDs using PIC 18F4550 <p>I'm trying to get myself started with the PIC 18F4550 using the C, MPLAB X (both IDE and IPE) and using the PICKit 3. I've managed to blink one LED without any problems, but as I try to blink more than one LED at simultaneously, it doesn't work.</p> <p><em>Please note that I will p...
<p>This could be a LATCH issue. I have had this problem a few times when I started up. Try writing to the LATB (output latch) register instead of the PORTB register. I always use the LATx for output and the PORTx for input.</p>
Get "Could not open input file: composer.phar" when calling composer.phar in terminal <p>I am working on a PHP development project that includes Composer. I am relatively new at this so I thank you in advance for your patience with my question, and ask that you reply in as simple of language as possible. </p> <p>I am ...
<p>You have downloaded <code>composer.phar</code> file successfully. Great job. Now the second steps is to make ti globally accessible like <code>php</code> or <code>git</code>. </p> <p><a href="https://www.abeautifulsite.net/installing-composer-on-os-x" rel="nofollow">This article about installing composer in Mac</a>...
Node UDP dgram sending too many packets in recursive function <p>Having a tricky problem with the code I'm currently working on. Basically, the purpose of this code is to send a UDP broadcast, listen for a response (that isn't the broadcast it just sent), and connect via socket.io. The recursion is there to ensure that...
<p>The problem is that you're adding a new <code>message</code> event listener every time you send a message (<code>client.on('message', ...)</code>). Instead, just add a <code>message</code> event listener once after calling <code>.bind()</code>:</p> <pre><code>var client = dgram.createSocket('udp4'); client.bind(con...
Bootstrap modal using angularjs works in plunker or jsfiddle but doesn't work in local <p><em>Hi everyone , I'm working on angularjs which preforms a form filling with validation ,after the submission the data goes into the table . I have an option to edit it . To edit i have used bootstrap modal to edit . Everything i...
<p>There are some references which won't load when you run it on your machine, change them as below,</p> <pre><code>&lt;script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js'&gt;&lt;/script&gt; &lt;script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.4/angular-messages.min.js'&g...
How do i npm publish a "unstable" or "develop" package <p>In our workflow we have two git branches master and develop. We keep the master stable and the develop branch has untested work in it.</p> <p>We'd like to let teams pull down the develop work with npm to test/ or if they need it and are happy with it.</p> <p>H...
<p>One common pattern is to explicitly set the version in package.json to be something like <code>4.2.0-beta</code>, and then run <code>npm publish --tag=develop</code>. That way you're not essentially taking <code>4.2.1</code> forever. What you're doing above means that when you want to publish the "final" 4.2.1 you w...
What is a multithreading program and how does it work? <p>What is a multithreading program and how does it work exactly? I read some documents but I'm confused. I know that code is executed line by line, but I can't understand how the program manages this.<br> A simple answer would be appreciated.c# example please (onl...
<p>A simple analogy might be found in the kitchen.</p> <p>You've probably cooked using a recipe before -- start with the specified ingredients, follow the steps indicated in the recipe, and at the end you (hopefully) have a delicious dish ready to eat. If you do that, then you have executed a <em>traditional (non-mul...
Issue compiling FFTW <p>I am trying to install FFTW on my mac with OpenMP enabled. I initially had trouble configuring, but that issue was solved <a href="http://stackoverflow.com/questions/39542979/configure-error-installing-fftw/39546224#39546224">here</a>.</p> <p>Now after configuring I type "make" and I get the fo...
<p>You could try passing the location of the gcc compiler its absolute path rather than the binary name, just as</p> <pre><code>CC=/usr/local/gcc-6.1.0/bin/gcc-6.1.0 ./configure --enable-mpi --enable-threads --enable-openmp </code></pre> <p><strong>EDIT</strong> After having a brief chat with OP, it looks like he omi...
Change background url dynamically in paper-scroll-header-panel <p>So I have this style that when the header condenses it change its background into red and when the header is at its full size it display a backgroun</p> <pre><code>paper-scroll-header-panel { position: absolute; top: 0; left: 0; right: 0...
<p>You can use <code>css3 variables</code> and <code>updateStyles</code> API to dynamically load the value of any css property.</p> <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-html lang-ht...
PHP - How convert chracters like "\xea" to correct "ê" character? (ISO-88591 - accented) <p>I have many characters in a text / json like:</p> <pre><code>\xea = ê \xaa = ª (I think) </code></pre> <p>How convert to correct character in PHP?</p> <p>Thanks a lot.</p>
<p>You could try something like this:</p> <pre><code>$text = preg_replace_callback('/\\\\x([0-9a-fA-F]{2})/', function ($matches) { return chr(hexdec($matches[1])); },$text); </code></pre> <p>Edit: Sorry, I just copy/pasted an old code - the <code>e</code> modifier is deprecated.</p>
How to read integers from a text file and store them in an array? <p>I have a file named example.txt with 7 integers formatted as such,</p> <blockquote> <p>1</p> <p>2</p> <p>3</p> <p>4</p> <p>5</p> <p>6</p> <p>7</p> </blockquote> <p>My code is, </p> <pre><code>#include&lt;iostream&gt;...
<p>you were almost C++ compliant there.</p> <p>So I took the time to change a few lines of your code replacing the C-style array by a <code>vector</code>. That was the only thing missing to make it really C-free :). See the <code>****</code> comments when I changed stuff.</p> <p>Use <code>vector</code> everytime, spe...
How to pass a value (which i got from ui-router) to a modal/view through state.js? <p>My state. js is like this </p> <pre><code> .state('lab.new-equip', { parent: 'lab', url: '/{labId}/new-equipment', data: { authorities: ['ROLE_USER'] }, onEn...
<p>Try with the following code:</p> <pre><code>function ($stateParams, $state, $uibModal) { $uibModal.open({ templateUrl: 'app/entities/lab/lab-equipments-dialog.html', backdrop: 'static', size: 'lg', resolve: { selectedRow: function () { ...
Can Authorize API by scope in identityserver3? <p>I'm very new in Identityserver and as far as I know scopes are identifiers for resources that a client wants to access and I’m wondering if I can Authorize my API by scope? For Ex: I have 2 APIs "Employee" and "student" To CRUD employee and student, Client require sc...
<p>When the access token is presented to the API and you use the IdentityServerAccessTokenValidation middleware to validate it, then the scopes in the access token are expressed as claims in the User's claims collection. For authorization you can then check for the scope required and issue a 403 if the scope is not pre...
Java - Search List of Strings if contains another List of Strings <p>I have list of user tweets (<code>usersTweets</code>), i need to find tweets which contain specific keys words (<code>listOfkeyWord</code>), and add matches to (<code>includeKeyWord</code>) List.</p> <pre><code> String keyWord = "one,two"; Lis...
<p>Basically you want to check if tweet has all the words, so you need to iterate through list of those words and check if your tweet has them all, you can do this:</p> <pre class="lang-java prettyprint-override"><code>public boolean hasAllTheWords(String yourString, List&lt;String&gt; words){ for(String word : word...
(Neo4j Unmanaged extension API) Why the speed of query depends on the size of dataset in Neo4j? <p>I'm trying to build a simple unmanaged extension for a Neo4j server (Community Edition). </p> <p>I have several versions of the same dataset (a small one with 11k nodes, and a larger one with 85k nodes). The small one is...
<p>If you don't create an index on the label/property combination,then neo4j has to go through every single node and check its <code>id</code> property. If you index it, it can go through the inverse process (knowing the <code>id</code> property, it can find all the corresponding nodes) which makes it way faster, and n...
Parameter entities in internal DTD <p>I have the following <code>simple.dtd</code>:</p> <pre><code>&lt;!ENTITY % placeholder "my, element, list"&gt; &lt;!ELEMENT root (%placeholder;)&gt; &lt;!ELEMENT my (#PCDATA)&gt; &lt;!ELEMENT element (#PCDATA)&gt; &lt;!ELEMENT list (#PCDATA)&gt; </code></pre> <p>and the <code>sim...
<p>In the <em>internal subset</em> of DTD, references to parameter entities are not allowed within markup declarations. You have to use an external DTD, i.e. the separate file. This is documented as a well-formedness constraint in the XML specification <a href="https://www.w3.org/TR/xml/#wfc-PEinInternalSubset" rel="n...
SSRS - Group Header will not repeat on the top of each page <p>I have read every post i could find regarding this issue and had no luck. I would like the County, Status, ID and Name rows to repeat on each page. I have reformatted the report since my original post but it's still not working. There is a parent group (Co...
<p>I removed the existing tablix and created a new one with the same grouping and setting and it rendered correctly, repeating the headers as desired.</p>
significant change location delegate methods not being called <p>All of my code is in AppDelegate.m:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]]; _locat...
<p>It is a problem with your delegate method please replace below one </p> <pre><code>- (void)_locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { } </code></pre> <p>with</p> <pre><code>- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)l...
EditText field not taking input <p>I have an EditText field in an xml layout and I am setting that xml as the layout of a dialog box. When I click on the EditText field, it shows no response. The keyboard does not show up and cursor does not show. Here is the dialog_layout.xml</p> <pre><code>&lt;?xml version="1.0" enc...
<p>i usually use AlertDialog to achieve the same effect.</p> <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.dialog_layout, null)) .setPositiveButton(R.string.okay, new DialogI...
Convert Spark Dataframe to XML files <p>Dose anyone know how to convert Spark DataFrames to XML format? If you could provide some example codes, that would be awesome! Thanks in advance!</p>
<p>take a look at this package as it includes the code needed for conversion from a dataframe to xml. <a href="https://github.com/databricks/spark-xml" rel="nofollow">Spark-xml</a></p>
How to check if an ID exists in the result of a sub-query? <p>Let's say I have the following query to list the average value of a house people own:</p> <pre><code>SELECT PERSON.NAME, AVG FROM PERSON, ( SELECT HOUSE.PID AS PID, AVG(HOUSE.VALUE) as AVG FROM HOUSE GROUP BY PID ) HOUSES WHERE PERSON.PID = HOUSES.PID...
<p>Simple rule: <em>Never</em> use commas in the <code>FROM</code> clause. <em>Always</em> use explicit <code>JOIN</code> syntax. For instance, in this case, you want a <code>LEFT JOIN</code>, but cannot express it.</p> <pre><code>SELECT p.NAME, AVG_VALUE FROM PERSON p LEFT JOIN (SELECT PID , AVG(VALUE) as AVG...
Can not compile google test with MinGW on Windows <p>I tried to compile google test framework with MinGW on Windows following instructions from <a href="http://stackoverflow.com/questions/5248237/how-to-compile-googletest-on-windows-using-mingw-with-msys">this post</a>, but I got errors when executing <code>make</code>...
<pre><code>cmake -G "MSYS Makefiles" --with-pthreads=no </code></pre> <p>I don't think <code>--with-pthreads=no</code> is a valid cmake option. CMake tries to interpret it as the source directory. Remove that option. I think google test needs pthreads anyways, that is why <code>OpenThread</code> is not declared, becau...
Can't make element 100% height when using 'display:table' and 'masonry' <p>I am using masonry to display images. I wish to have text appear in the middle of each image and to do this I have displayed a parent as table and the child as table-cell. I can't get the parent wrapper to 100% height.</p> <pre><code>&lt;div cl...
<p>I may suggest you another approach, without using tables. Add absolute position to your text wrapper add transform it like so:</p> <pre><code>.title { display: inline-block; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color:#fff; } </code></pre> <p>Here <a href="ht...
The target set to std::function is lost <p>The target I set for std::function is lost, I don't know why perhaps I am overlooking some minor bug in this program. Can someone help.</p> <p>class Test registers a lambda to a singleton class, but when tried to invoke the callback, the target set in std::function is lost.</...
<p>I think problem is the way you implemented your singleton class. </p> <pre><code>public: static callback_store instance() { static callback_store instance; return instance; } </code></pre> <p>You are returning the copy of the of static object instead you should use </p> <pre><code>public: static callback_...
Clean all selected option after ajax request <p>Selecting values from drop-down according to the data that retrieved from Ajax request to database by clicking on update link and when i console.log the response i can see data has been retrieved and i am successfully able to compare it with drop-down list and if there is...
<p>No need to compare using loop. Just try like following. </p> <pre><code>$('.semester').val(respond.semester_id); </code></pre>
select dno from employee where (select count(*) from employee where gender='f' group by dno) = 1 ; <p>The question is :You have a employee table.and you have to select the department where only one female is working.</p> <p>table attribute are fname,lname,ssn,gender,dno,salary.</p> <p>my code is: </p> <pre><code> ...
<p>You can use group by with a <code>having</code> clause</p> <pre><code>select dno,count(*) as theCount from employee where gender='f' group by dno having theCount=1 </code></pre>
Firebase: Get New Child Added <p>When my application starts I do an initial fetch to Firebase to pull down all my data. When I later add data to my Firebase, I only want it to get the new child that's been added.</p> <p>I'm currently achieving this like this. Is there a better way, or a built in way to do this in Fire...
<ol> <li><p>If you need both new data and subsequent data, use <code>child_added</code>. It will fire immediately for all existing children and subsequently for any child that is added.</p></li> <li><p>if you only want new data, add a timestamp to your children and <code>ref.orderByChild('timestamp').startAt(Date.now()...
Isset still not doing its job <p>I've seen this issue all over stack overflow but none of the methods helped.</p> <p>Form:</p> <pre><code>&lt;form action="login.php" method="POST"&gt; &lt;input name="username" type="text" placeholder="User Name"&gt; &lt;input name="rawpassword" type="password" placeholder...
<pre><code>if (isset($_POST['username']) &amp;&amp; isset($_POST['submit'])) { $username=$_POST['username']; } </code></pre> <p>Please try checking submit too as username and other field are not always set. I'm expecting this to be the problem as The quesion is unclear without html.</p>
C# Decorating Console class <p>I came across an assignment to decorate a Console class (in C#), and implement some custom things inside Write and WriteLine methods.</p> <p>I had no problem with decorating streams to provide additional functionality, but I have no idea, how to decorate a Console, mostly because of it's...
<p>You can replace the streams <code>Console</code> writes and reads to using the <a href="https://msdn.microsoft.com/en-us/library/system.console.setout(v=vs.110).aspx" rel="nofollow"><code>Console.SetOut(TextWriter)</code></a>, <a href="https://msdn.microsoft.com/en-us/library/system.console.setin(v=vs.110).aspx" rel...
What's the difference between a macro and a compiler plugin? <p>What can a macro do that a compiler plugin can not, and vice-versa?</p> <p>By "can not", I mean that it is impossible to achieve the same purpose, not that it can be achieved in a different way.</p> <p>For example, a macro can <code>impl</code> some trai...
<p>Compiler plugin macros can do everything <code>macro_rules!</code> macros can do, plus a whole lot more. Compiler plugins can register derivation macros, synthesise new identifiers, deconstruct AST nodes, parse strings, do file IO, <em>etc.</em>, <em>etc.</em> Listing everything would be pointless, as it would amo...
Calling multiple subroutines repetitively or simply calling an extensive subroutine once <p>In my CFD Solver, several extensive computations must be applied throughout the domain on each node depending on indices i, j, k, and l. The domain is 3-D and have a resolution of IMAX + 1 by JMAX + 1 by KMAX + 1.</p> <p>My pro...
<p>If your subroutines <code>sub_1</code>, <code>sub_2</code>,... are in the same file as the driver routine, then the compiler (with no specific option) has all the info to choose to inline or not the functions. If you inline the subroutines yourself, you will let the compiler any choice. In the best case, it will be...
swift fatal error: unexpectedly found nil while unwrapping an Optional value with Any Array <p>I realize there have been several 'similar' errors posted about this, but they don't seem to be helping me in my case. It's also possible the syntax isn't working how I'm expecting it to work in Swift:</p> <p>There are no co...
<p>The array is declared but not initialized. At the moment you are going to append something to the array it's <code>nil</code> and causes a runtime error.</p> <p>Initialize the array this way:</p> <pre><code>var allPlayerSpawnState = Array&lt;Array&lt;Any&gt;&gt;() </code></pre>
JavaScript beginner stuck on unexpected error <p>I'm learning JavaScript through code academy, and am currently creating a simple rock, paper, scissors game. However, I am stumped by a little error message that says there is an unexpected keyword: else. I have combed through this small block of code dozens of times, bu...
<p>Remove the semicolon at the end there:</p> <pre><code>else if (choice1 === "scissors"); </code></pre> <p>And please indent your code normally.</p>
Error in parsing strings to ints <p>I have these two and it seems that bytes2integer is wrong, but I eliminated all the other issues. What is wrong? <a href="https://github.com/construct/construct/blob/master/construct/lib/py3compat.py" rel="nofollow">p3compat</a> provides some helper functions. On side note, <code>-in...
<p>Bytes were reversed wrongly, and then it parsed the sign bit into number. Two bugs fixed.</p> <pre><code>def onebit2integer(b): if b in (b"0", b"\x00"): return 0 if b in (b"1", b"\x01"): return 1 raise ValueError(r"bit was not recognized as one of: 0 1 \x00 \x01") def bits2integer(data...
Cleanest way to reassign the value of the variable when the condition is met in Kotlin <p>Let's say that I have Long variable which is decremented by some method. I want to set it to 60 after its decremented to 0. I tried apply function</p> <pre><code> private var tempTime = interval.apply { if (this.equals(0L)) ...
<p>In Kotlin <code>if</code> statement <a href="https://kotlinlang.org/docs/reference/control-flow.html#if-expression" rel="nofollow">is an expression</a> therefor you can write:</p> <pre><code>var tempTime: Long = 60 ... val interval = 60L tempTime = if (tempTime == 0L) { interval } else { tempTime - 1 } </co...
Android: Calling a method which is not in an Activity by clicking a Button <p>I have 2 Java classes with 2 XML layout files in my Android Studio Project. The first class is my MainActivity class and container for the map which the second class displays. The layout works fine, but I have a Button in the XML File of my s...
<p>Create an object of your second class in the Mainactivity. Then use the object to call the function of second class. </p> <p>Edited - </p> <p>I see that you dont need to create a function like fragment_obj.updateTextView();. I set all my view as class level objects and was able to update the textview directly.</p>...
nonnull-compare warning for pointer to reference <p>I've written following code:</p> <pre><code>void foo(int&amp; x) { bool b1 = (&amp;x) == nullptr; bool b2 = &amp;x == nullptr; int* ptr = &amp;x; bool b3 = ptr == nullptr; } </code></pre> <p>For the code above, I'm getting following errors:</p> <p>For b1 va...
<p>Reason for the extra message for b2: Because the left-hand-side of the '==' is the address of x - <em>directly</em> - the compiler can tell that one of the terms of the comparison is an immediately-evaluated pointer, and so can issue the warning. By contrast, the use of parentheses for b1 adds a level of indirectio...
Understanding the { } /dev/null \; when using find with -exec <p>I am trying to understand this line:</p> <pre><code>find $HOME -name "*.c" -exec grep "find this string" {} /dev/null \; </code></pre> <p>I understand the majority of it, but I am not sure about the <code>/dev/null</code> that appears after the <code>{}...
<p>It's used to force grep to print the matching file name, only useful in greps that don't have a specific option to do so. Look:</p> <pre><code>$ cat file 1 2 3 $ grep 2 file 2 $ grep 2 file /dev/null file:2 </code></pre> <p>It used to be required to get that output but with GNU grep (and others?) these days you ...
Modify an Array Perameter <pre><code>import java.util.Scanner; public class ModifyArray { public static int [] swapArrayEnds(int [] sortArray, int numElem) { int temp = 0; int i = 0; for (i = 0; i &lt; numElem - 1; ++i){ temp = sortArray[0]; sortArray[0] = sortArray[numEl...
<p>If you want to swap last and first element of the array, you don't need to pass the length yourself, you can get it like this:</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-html lang-html prettyprint-overrid...
unable to send mail using laravel php <p>I am unable to send a test mail. I am using laravel php.</p> <p>my .env file:</p> <pre><code>MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=ca**********4b MAIL_PASSWORD=04**********7b MAIL_ENCRYPTION=tls </code></pre> <p>my mail.php:</p> <pre><code>'driv...
<p>I believe it's gonna be firewall issue, have you tried to connect to <code>gmail</code> provider ? it's a good way to catch the error </p>
Is there a way to represent variables as int instead of double to calculate correct percentage? <p>I am doing exercise 2.3 on page 23 of Think Java (<a href="http://www.greenteapress.com/thinkapjava/thinkapjava.pdf" rel="nofollow">http://www.greenteapress.com/thinkapjava/thinkapjava.pdf</a>).</p> <p>The program conver...
<p>The int throws what's after the period. You may want to duplicate in 10 more. Get the first numeral to check if it greater than 5 add one to your percent. Sorry for not writing code. I'm on iOS now and my java rusty... Good luck</p>
What should i do in order to print level also in Breadth first search Algo. <p>What can be done in the below algo in order to print values level wise in binary tree.</p> <pre><code>BinarySearchTree.prototype.breadthFirstTraversal = function() { console.log("Breadth First Traversal"); var q = [] q.push(thi...
<p>Store level for each node, and print them only when level changes:</p> <pre><code>BinarySearchTree.prototype.breadthFirstTraversal = function() { console.log("Breadth First Traversal"); var q = []; var prevLevel = -1; // monitor level switch var byLevel = []; // store node values for printing ...
SELECT FOR UPDATE returns zero rows <hr> <p><strong>UPDATE: Problem solved!</strong></p> <p>That was a <a href="https://www.postgresql.org/message-id/24622.1474558607%40sss.pgh.pa.us" rel="nofollow">bug</a> in PostgreSQL. Tom Lane fixed it in this <a href="http://git.postgresql.org/pg/commitdiff/96dd77d349424f270d129...
<p>Interesting question! With <code>explain verbose analyze</code>, I get the following query plan:</p> <pre><code> QUERY PLAN ---------------------------------------------------------------------------------------...
Android ListView doesn't show first item <p>I have gone through <a href="http://stackoverflow.com/q/24303266/4291272">this</a> &amp; <a href="http://stackoverflow.com/q/35387851/4291272">this</a> SO questions but unable to figure out why the first item of my list view is not visible. I have checked the size of arraylis...
<p>check whether toolbar dont get overlap on listviews first item</p>
Socket.io socket.broadcast.to not working <p>I have in my <code>Express</code> server </p> <pre><code>userbase = {'Fitz': '84Iw3MNEIMaed0GoAAAD'}; //Exapmle user to receive message and associated socket id //Sending message to Example user socket.on('send_msg',function(data_from_client){ //Testing f...
<p>Do you have users join a namespace on connection?</p> <pre><code>socket.join(userbase[data_from_client.to_user]); //'84Iw3MNEIMaed0GoAAAD' </code></pre> <p>You can try:</p> <pre><code>socket.in(userbase[data_from_client.to_user]).emit('get_msg', {msg:data_server.msg}); </code></pre>
How to perform input redirection in python like the bash >? <p>I want to feed text files to a C program, with bash I can do <code>./prog &lt;file</code>, how would you do the same in python ?</p>
<p>You can do that via <a href="https://docs.python.org/3/library/subprocess.html#subprocess.check_call" rel="nofollow"><code>subprocess.check_call</code></a>:</p> <pre><code>import subprocess subprocess.check_call(["prog"], stdin=open("/path/to/file")) </code></pre>
How to block direct download file <p>My website contains some download content. I want to access download this file only for logged in user.</p> <p>If user type direct file url in browser it show forbidden page if user not logged in. Am not using any CMS. Direct File Link: localhost/files/questions/20160917070900-w2Cd...
<p>Put the files you want to protect in a separate directory and add an .htaccess file with the following:</p> <pre><code>Order deny,allow Deny from all </code></pre> <p>The server and scripts that accesses files in this directory will still work but direct access by url will not.</p>
Java: Difference between Streams and I/O stream explained <p>I'm looking for a good explaination of the difference between the "new" Streams in Java 8 and the "old" I/O Streams we had before in Java 7. For someone without any knowledge of functional programming, it's hard to get that those are complete different things...
<p>It has nothing to do with each other and I agree, it's bad luck that IO Streams had their name before the "new" Streams have arrived. The I/O streams were meant as connections to external resources, mostly files, but also others. The new Streams are for functional programming and should be treated separately.</p> <...
I want to delete a row of information from jtable right after i save all the info can i do so? <p>I want to delete a row of information from jtable right after i save all the info can i do so?</p> <pre><code>private void buyButtonActionPerformed(java.awt.event.ActionEvent evt) { ...
<p>It really comes down to which implementation of <code>TableModel</code> you are using. I would suggest creating your own implementation and injecting that into your <code>JTable</code> so that you have full control over how rows are removed.</p>
connect volume slider to player <p>Im running a player with howler.js and trying to connect a volume slider that i can't get to work. Any help appreciated</p> <p>This is what i have</p> <pre><code>&lt;script&gt; function createHowl() { var number = Math.floor((Math.random() * 14) + 1); return new Howl({ src: ...
<p>You need to assign the Howl object return by your function to a variable if you want access to it. </p> <p>i've never used Howl but I don't think you want to use that onend handler.</p> <p><a href="https://jsfiddle.net/denov/ct32a3fd/1/" rel="nofollow">https://jsfiddle.net/denov/ct32a3fd/1/</a></p> <pre><code>&lt...
Return functions recursively to form nested functions - Javascript <p>I'm trying to build a function in JS that has a return composed of different nested functions based on a parameter passed by the user.</p> <pre><code>function addA(otherFunction) { //gets the result from some base function and modifies it //e.g. +1 ...
<p>Your function <code>abc</code> is supposed to return a function that can process lists, like <code>a</code> or <code>d</code>. However, you match that signature only in 2 out of 7 cases:</p> <ul> <li><code>return a</code>, <code>return d</code> are fine</li> <li><code>return null</code> - that's not a callable valu...
if a ball is hitting a box from every side, how to know which side hittest is true <p>i am creating a brick breaker game in which ball is hitting a square object. i want to change the direction of ball when he hit square object. square is of 15 px. and ball is of 10 px. for example</p> <p>if hits on the right side, S...
<p><strong>edit</strong></p> <p>To turn my two point example into a one-ball-moving version, the main thing you need to do is to declare the <code>p1</code> then move the ball and then declare <code>p2</code>.</p> <pre><code>p1.x = ball.x; p1.y = ball.y; moveBall(); p2.x = ball.x; p2.y = ball.y; </code></pre> <p>Now...
Subqueries for aggregation needs in sql <p>I have a table like this:</p> <pre><code>Id Date Price Item Type 1 2009-09-21 25 1 M 2 2009-08-31 16 2 T 1 2009-09-23 21 1 M 2 2009-09-03 12 3 T </code></pre> <p>I try to receive the output of ID and column of sum pric...
<p>Perhaps this will help</p> <pre><code>Declare @YourTable table (Id int,Date date,Price money,Item int,Type varchar(25)) Insert into @YourTable values (1,'2009-09-21',25,1,'M'), (2,'2009-08-31',16,2,'T'), (1,'2009-09-23',21,1,'M'), (2,'2009-09-03',12,3,'T') Select ID ,sum(case when Type='M' then Price*Item el...
My app getting Crash <p>I am creating app like , which will take photos and shows the taken photos in thumbnail as scrolling part below the camera view .it is taking photos.but if i take more than 30 pictures my app is getting crash .So i connect my iPod with Xcode and i run ,<a href="http://i.stack.imgur.com/MigVl.png...
<p>Try this code to Reduce the size of image</p> <pre><code>- (UIImage )imageWithImage:(UIImage )image convertToSize:(CGSize)size { UIGraphicsBeginImageContext(size); [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContex...
Equivalent of $requireAuth in Firebase 3.0 <p>What is the equivalent way of doing <code>$requireAuth</code> in Firebase 3.0. I searched it everywhere but couldn't find an answer.</p> <p>Help would be much appreciated.</p>
<p>There is a migration guide for moving from <strong>AngularFire</strong> 1.x.x to 2.x.x <a href="https://github.com/firebase/angularfire/blob/master/docs/migration/1XX-to-2XX.md#firebaseauth-method-renames--signature-changes" rel="nofollow">here</a>.</p> <p>Note that there have been a considerable number of <a href=...
Putting a quote in a string <p>I have an assignment for intro to programming and finished everything put putting in quotes with in a string.</p> <pre><code>string movie_name; cout&lt;&lt; "Movie Name: "; cout&lt;&lt;"\"" &lt;&lt;movie_name &lt;&lt; "\""; getline(cin, movie_name); </code></pre> <p>The output ...
<p>Try this </p> <pre><code>string movie_name; getline(cin,movie_name); cout&lt;&lt; "Movie Name: "; cout&lt;&lt;"\"" &lt;&lt;movie_name &lt;&lt; "\"\; </code></pre> <p>This will ask the user for the name of the movie then print it out. In your post movie_name is empty when you try to display it.</p>
Kendo-ui angular directive on editor <p>I'm trying to attach an angular directive to `</p> <pre><code> { field:"stateID", hidden: true, title: "State", editor: function (container, options) { var _statesDirective = $('&lt;div&gt;&lt;my-states&gt;&lt;/my-states&gt;&lt;/div&gt;'); _statesDirective.appe...
<blockquote> <p>You need to compile your html before appending it (using $compile service).</p> </blockquote> <p>So in your <code>editor: function</code>,</p> <pre><code>// Specify what it is we'll be compiling. var to_compile = '&lt;div&gt;&lt;my-states&gt;&lt;/my-states&gt;&lt;/div&gt;'; // Compile the tag, retri...
Why two $push inside one update is not working in mongodb <p>when i am updating two arrays separately, its working fine. But when i am updating together, only 2nd array is updating</p> <pre><code>var selection = { _id : {$in : membersIds} }; var update = { $push : { notifications_Array_Object : newNotif...
<p>You have to change your query</p> <p><strong>From:</strong></p> <pre><code>var update = { $push : { notifications_Array_Object : newNotification }, $push : { groups_Array_Object : ObjectID(groupId) }, $inc : {unreadNotifications_Integer : 1} }; </code></pre> <p><strong>To:</strong>...
Async lambda: "a task was cancelled" <p>Here's the workflow:</p> <ol> <li>Incoming HTTP request to WebApi2 endpoint.</li> <li>Make synchronous (e.g. not async) call to get some data.</li> <li>Map response from DB entity to API model. a. Executes AutoMapper mapping. b. Includes the following snippet (see below). c. If ...
<p><a href="http://dotnetapis.com/pkg/AutoMapper/5.1.1/netstandard1.3/doc/AutoMapper.IMappingExpression/AfterMap(System.Action(System.Object,System.Object))" rel="nofollow"><code>AfterMap</code> takes an <code>Action</code></a>, which is a <a href="http://blog.stephencleary.com/2014/02/synchronous-and-asynchronous-dele...
javascript not working inside email <p>I am sending an email from my SAP System to gmail. The body is html and javascript based content. Now, the requirement is to create a new url window onclick of a button or a link inside the email which will open a web page in a popup window.</p> <p>So, when i am testing it within...
<p>All email clients have (and must have) a strict policy against running any Javascript found in emails.</p> <p>This is a strong security requirement, you will not get around it. Which is good. You can only place Javascript on the target site, not in the email. </p>
How can I shorten these value checks? <p>I'm making a system to randomly generate stars based on type. The first part is of course telling the system what type of star it is based on rarity. I am having difficulty shortening the actual assigning part based on a random number generator. Here is my current solution.</p> ...
<p>Preload an array with the values and loop through breaking on the first false condition:</p> <pre><code>int[] nums = new int[] { 228000, 36000, 22500, 9000, 3750, 1875, 10 }; for (int i = 0; i &lt; nums.Length; i++) { if (Rng &gt; nums[i]) break; StarType++; } </code></pre>
J-Link GDB debugging in CLion <p>Not long ago CLion <a href="https://blog.jetbrains.com/clion/2016/07/clion-2016-2-eap-remote-gdb-debug/" rel="nofollow">added support for Remote GDB debugging</a> and I'm trying to set it up with Seggers's J-Link GDB server. </p> <p>My setup:</p> <ul> <li>VM VirtualBox running Ubuntu ...
<p>You're probably confusing GDB server and GDB itself. Those are GDB options that should be set in the GDB Remote Debug Configuration in CLion, not GDB server settings.</p> <p>That is, you first run JLinkGDBServer manually, for example, from terminal, just as you've done already, and leave it waiting for GDB to attac...
Load a .json file asynchronously with webpack <p>I am trying to load a .json file asynchronously. There is example for .js file but I am using typescript and can't seem to find a solution.</p> <p>webpack.config.js</p> <pre><code>var webpack = require('webpack'); module.exports = { entry: "./src/app.ts", outp...
<p>It looks like webpack doesn't know where to find your bundles.</p> <p>You have to set <code>output.publicPath</code> in your config once you start using bundle splitting. If your <code>dist</code> directory is available in the browser as <code>localhost/dist</code>, you have to set <code>output.publicPath</code> to...
Python - download video from indirect url <p>I have a link like this</p> <pre><code>https://r9---sn-4g57knle.googlevideo.com/videoplayback?id=10bc30daeba89d81&amp;itag=22&amp;source=picasa&amp;begin=0&amp;requiressl=yes&amp;mm=30&amp;mn=sn-4g57knle&amp;ms=nxu&amp;mv=m&amp;nh=IgpwcjA0LmZyYTE2KgkxMjcuMC4wLjE&amp;pl=19&a...
<p>You can use <a href="http://pycurl.io/docs/latest/quickstart.html" rel="nofollow">pycurl</a></p> <pre><code>#!/bin/usr/env python import sys import pycurl c = pycurl.Curl() c.setopt(c.FOLLOWLOCATION, 1) c.setopt(c.URL, sys.argv[1]) with open(sys.argv[2], 'w') as f: c.setopt(c.WRITEFUNCTION, f.write) c.perf...
Why is my first roll out of my program not random? <p>This program is a game of craps. The program runs perfectly fine, with the exception that every time the program starts up, it gives me the same random number, but if you keep on playing the game and start a new game without exiting the console, the first roll numbe...
<pre><code>class DiceClass{ public: DiceClass(){ srand(time(0)); } int firstdiceroll = 2+rand()%11; // etc. }; </code></pre> <p>The member variables of the class are initialized <em>before</em> entering the body of the constructor. So the <code>firstdiceroll</code> is set just before changing the r...
Cannot call value of non-function type 'Any?!' :- Firebase,Swift3 <p>This is my code <strong>before</strong> moving to Swift 3:</p> <pre><code>ref.observeEventType(.ChildAdded, withBlock: { snapshot in let currentData = snapshot.value!.objectForKey("Dogs") if currentData != nil { le...
<p>See the issue is that when you are instancing and initialising your variable you are telling it that the value its gonna receive will be a <strong><code>value</code></strong> for the object named <code>Dogs</code> present in this snapshot whose type is <code>AnyObject</code>.</p> <p>But <strong><code>snapshot.value...
Use `next` with an accumulator argument in a `reduce` <p>There is a cop: <a href="http://www.rubydoc.info/gems/rubocop/0.36.0/RuboCop/Cop/Lint/NextWithoutAccumulator" rel="nofollow"><code>RuboCop::Cop::Lint::NextWithoutAccumulator</code></a>.</p> <p>Is anyone able to explain what this cop is for, how is it supposed to...
<p>Lets consider sample code from the documentation:</p> <pre><code># bad result = (1..4).reduce(0) do |acc, i| next if i.odd? acc + i end </code></pre> <p>If you try this in the console, you will get <code>NoMethodError</code> exception for the <code>nil</code> object. This is because <code>next</code> "returns"...
SQL - Join two tables without a key <p>Given two tables (<code>count(Table1) &lt;= count(Table2)</code>):</p> <p>Table1:</p> <pre><code>record-1 record-2 ... record-k </code></pre> <p>Table2:</p> <pre><code>promo-1 promo-2 ... promo-j </code></pre> <p>Is it possible to join them into the following table? I.e. a...
<p>You could create a fake key using the <code>rownum</code> pseudo-column, and join according to that:</p> <pre><code>SELECT t1.col1, t2.col2 FROM (SELECT col1, ROWNUM AS rn FROM table1 ORDER BY col1) t1 JOIN (SELECT col2, ROWNUM AS rn FROM table2 ORDER BY col2) t2 ON t...
Extract column using grep <p>I have a data frame with >100 columns each labeled with a unique string. Column 1 represents the index variable. I would like to use a basic UNIX command to extract the index column (column 1) + a specific column string using a grep. </p> <p>For example, if my data frame looks like the fol...
<p>You need to use awk:</p> <pre><code>awk '{print $1,$3}' &lt;namefile&gt; </code></pre> <p>This simple command allows printing the first ($1) and third ($3) column of the file. The software awk is actually much more powerful. I think you should have a look at the man page of awk.</p> <p>A nice combo is using grep ...
How to make a sticky footer and header with a tableview? <p>I have a <code>UITableView</code> in the storyboard with also a header and a footer defined as can be seen in the picture.</p> <p><img src="http://i63.tinypic.com/293j7ll.png" alt="screenshot"></p> <p>However, the header disappears when I move the cell (it s...
<p>Don't confuse the section header and footer with the table header and footer.</p> <ul> <li><p>The section header and footer, in a non-grouped table, are <em>pinned</em> to the top and bottom of the table while you scroll.</p></li> <li><p>But the table header and footer, as you rightly say, are sort of like cells: t...
Incomplete reads from file written by Popen()-based subprocess <p>i'm trying to read the output from one function into another one.</p> <p>if i break things down into two steps, call the first function(journal.py) from the command line, and then call the second(ip_list.py) i get the results that i'm looking for.</p> ...
<p>You should wait for <code>Popen()</code> to finish. Assign its return value to a variable and call <code>wait()</code> on it:</p> <pre><code>p = Popen('journalctl ...') p.wait() </code></pre> <p>When you run the journal script separately, the parent process will only return when all of its children have terminated...
Pausing and resuming UIView animation with alpha doesn't work when user presses Home button <p><strong>Question:</strong></p> <blockquote> <ol> <li>How can I pause a nested UIView animation that animates alpha/opacity when the user presses the Home button and returns back to the app?</li> <li>What have I missed ...
<p>You do not need to use UIView Animation to accomplish a simple fade.</p> <p>You could use an Timer object and a little Math to manually animate it.</p> <pre><code>class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = colorSchem...
Detecting `<Enter>` and `<Leave>` events for a frame in tkinter <p>I have a menu which when the user moves their mouse off I want to disappear. The menu consists of a <code>Frame</code> packed with several <code>Label</code>/<code>Button</code> widgets. I can detect the user moving their mouse off a <code>Label</code>/...
<p>If you're just trying to simplify maintenance of the callbacks on the widgets, then I don't think binding events to the containing frame is the best approach. (I guess it's possible to generate virtual events in the callbacks on the buttons and labels, and bind the virtual event to the frame, but it seems rather co...
changing only one part of the template with angular 2 routing <p>I have a template wit three sections one is the top navigation followed by left navigation and the content section which is the right div or element </p> <pre><code>&lt;nav&gt;top navs goes here &lt;/nav&gt; &lt;div class="container&gt; &lt;div class="ro...
<p>If you are changing just one part of your page one router-outlet is enough. On the place that router-outlet is, component is injected. <strong>What component is injected is defined by your routing configuration.</strong> <br/> Also change:</p> <pre><code>&lt;div class="col-md-9"&gt; id="content"&gt; to &lt;div cl...
how to create a controller based on auto configuration spring boot 1.4.0 <p>I am using spring boot 1.4.0</p> <p>I want to create a Controller in my spring boot application only in certain condition. Ex If There is bean with somename "neededBean.</p> <p>This "neededBean" is in a AutoConfiguration class and it will be ...
<p>The <code>@Controller</code> is only being detected due to a component scan. You can remove the overall component scan or exclude that package by default. Then setup a <code>@Configuration</code> class that has a conditional on the other bean existing. Within that configuration you tell it to scan that controller pa...
How to Copy contents in a directory to my current directory in shell? <p>Let's say I have a directory called A. </p> <p>Directory A has a bunch of c files, and I want to cp all of these files to the directory the script is running in (in the case it would be Home in the linux system). </p> <p>To make sure it successf...
<p>You should either be in the parent directory of A to copy it somewhere or mention the full path of the files to be copied.</p> <p>Eg. if B is the parent of A.</p> <p>You should already be in directory B to execute the command</p> <pre><code>cp -R A &lt;your_destination_folder_path&gt; </code></pre> <p>Eg. cp -R ...
Does Watir-webdriver use goto method? Because url seems to open to data; <p>I'm new to to test automation and I'm having an issue getting started. I am using ruby 1.9.3, watir-webdriver 0.9.3, chromedirver 2.24, yosemite osx and sublime 2 / terminal to execute. I am trying to get the method 'goto' to take me to google....
<p>data; is a default string that is set in the url when the browser starts. Seems that goto method is not found. You might have a config issue.</p> <p>One possible issue might be that you used @Browserc instead of @Browser when you called goto.</p> <p>try <br></p> <pre><code>@Browser.goto("http://google.com") </cod...
Parse Migration - Client to Client Push Notifications <p>We are trying to implement client to client push notifications as we migrate from Parse. Through other platforms, discussions, etc it seems that they way to do this is through cloud code - a couple of questions for the community - </p> <ol> <li>Will we have to e...
<ol> <li><p>No. The master key will be used only in your cloud code on the server side and will not be exposed to your clients so when you are calling the push api from cloud code you need to set <strong>useMasterKey: true</strong></p></li> <li><p>In order to send a push to your Y you need to do the following: </p> <u...
How do I get the UserId at login using asp.net Identity? <p>I want to get the UserId of the user successfully logging in so I can write it to a database with a timestamp for auditing purposes. This is the code fragment from the Login cs file</p> <pre><code>if (Page.IsValid) { // Validate the user password var manager ...
<p>You can always find your user by name. Since the login was successful, there is no problem usint the UserName.</p> <pre><code>var userName = ((this.LoginView1.FindControl("username") as TextBox).Text; //... switch (result) { case SignInStatus.Success: var loggedInUser = manager.FindByName(userName); ...
How do I put this long formula as my data validation list? <p>How do I put this long formula as my data validation list?</p> <blockquote> <p>=IF(P2="SUML01", SUML01, IF(P2="SUML02", SUML02, IF(P2="SUML03", SUML03, IF(P2="SUML04", SUML04, IF(P2="SUML05", SUML05, IF(P2="SUML06", SUML06, IF(P2="SUML07", SUML07, IF(P2...
<p>In case that the last <code>IF(P2="SLAL01", SLAL03,</code> is not an error, you can use the following formula inside your Data Validation List Formula bar:</p> <pre><code>=IF($P$2="SLAL1",SLAL3,INDIRECT($P$2)) </code></pre> <p>See image below how I've writte it into P4 cell:</p> <p><a href="http://i.stack.imgur.c...
How to pass 'y' or 'n' to shell script only when required from Java program? <p>I have a java code which calls shell script. Sometimes my script asks for y or n, I looked up online and found:</p> <pre><code>yes y| path/to/script/script.sh </code></pre> <p>I assume above will also work fine when:</p> <pre><code>yes y...
<p>You need to write 'y' to stdin of the process.</p> <p>So something like that.</p> <pre><code> PrintWriter writer = new PrintWriter(p.getInputStream()); writer.println("y"); </code></pre>
Loading multiple PNGs in pyglet window <p>If I loaded two partially transparent PNGs in succession (onDraw), would I still be able to see the first image if the second image was transparent in that area? These images would be drawn into a window. I would use Sprites but I couldn't get them to work. Thanks!</p>
<p>There's no code in your question and quite frankly there's so many solutions to what I think is your problem that you could have at least 10 different answers here.</p> <p>I'll vote to close this question but seeing as these are so rare and they usually don't get much response on either closing requests or down vot...