input
stringlengths
51
42.3k
output
stringlengths
18
55k
Matplotlib axis not displayed <p>The python code (python 2.7) running on windows 7 shown below results in the following inconsistent behaviour with respect to the display of axis which I do not understand:</p> <p>1 - a window is opened and a plot without an axis is displayed showing a point 2 - on closing the window, ...
<p>try </p> <pre><code>vp = VectorPlotter(interactive=False, ticks=True) </code></pre>
Localization in 2D world <p>I am struggling with the following code for the localization of robot on 2D world of red and green grid cells. I am basically getting the error which states that list index out of range.</p> <p><a href="https://i.stack.imgur.com/vZfh9.png" rel="nofollow"><img src="https://i.stack.imgur.com/...
<p>In routine sense() your program tries to access the 5th element of list <strong>w</strong> (index 4 in the list), unfortunately <strong>w</strong> only has 4 elements (only indices 0, 1, 2, 3 are valid)</p> <p><strong>range(len(p))</strong> returns [0, 1, 2, 3, 4]</p> <p>Also <strong>w[i]==z</strong> will never be...
Error installing angular-cli with NPM on a fresh ubuntu install <p>I just can't understand how to fix these peer dependencies.</p> <p>I tried to install angular-cli with NPM globally but always results in:</p> <pre><code>npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "-...
<p>i got the same error when i was installing the angular-cli with npm. but for me version was updated. 1)node v6.6.0</p> <p>2)npm v3.10.3.</p> <p>Then after i followed the following steps and the error was solved for me. Try this,it may help.</p> <p>1.npm uninstall -g angular-cli</p> <p>2.npm cache clean</p> <p>3...
$sce.trustAsHtml not working <p>I'm getting post content from my REST api. The content I'm getting: "<code>&amp;lt;p&amp;gt;test post body&amp;lt;&amp;#x2F;p&amp;gt;</code>"</p> <p>first, I'm parsing plain text</p> <pre><code>data[i].postBody = $sce.trustAsHtml(data[i].postBody); </code></pre> <p>after I'm doing thi...
<p>Have used htmlDecode function to escape HTML entities first</p> <p>HTML :</p> <pre><code>&lt;div ng-bind-html="value.postBody"&gt;&lt;/div&gt; </code></pre> <p>JS :</p> <pre><code>angular.module('ngApp', ['ngSanitize']) .controller('controller1', ['$scope','$sce', function($scope, $sce) { // Some Code ... ...
How to use intrinsics to elementwise multiply two char arrays and sum up the multiplications into int? <p>I am not familiar with x86_64 intrinsics, I'd like to have the following operations using 256bit vector registers. I was using _mm256_maddubs_epi16(a, b); however, it seems that this instruction has overflow issue...
<p>I've figured out the solution, any idea to improve it, especially the final stage of reduction.</p> <pre><code>int sumup_char_arrays(char *A, char *B, int size) { assert (size % 32 == 0); int sum = 0; __m256i sum_tmp; for (int i = 0; i &lt; size; i += 32) { __m256i ma_l = _mm256_cvtepi8_epi1...
ORA-00947: not enough values when creating object in Oracle <p>I created a new TYPE in Oracle in order to have parity between my table and a local c++ object (I am using OCCI interface for C++).</p> <p>In the code I use</p> <pre><code>void insertRowInTable () { string sqlStmt = "INSERT INTO MY_TABLE_T VALUES (...
<p>How many columns are in the table? The error message indicates that you didn't provide enough values in the insert statement. If you only provide a VALUES clause, all columns in the table must be provided. Otherwise you need to list each of the columns you're providing values for:</p> <pre><code>string sqlStmt =...
Match XPath produce Error loading stylesheet: Parsing an XSLT stylesheet failed <p>I'm getting this error while I try to put XPath into match. What do I do wrong? This is my XML example</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?xml-stylesheet type="text/xsl" href="test.xsl"?&gt; &lt;ROOT&gt; &...
<p>You can change your <code>match</code> path to a valid path with the same semantic meaning like this:</p> <pre><code>&lt;xsl:template match="*[preceding-sibling::MYELEMENT and count(.|(TAG1|TAG2|TAG3|MYELEMENT)/preceding-sibling::*) = count((TAG1|TAG2|TAG3|MYELEMENT)/preceding-sibling::*)]"&gt; </code></pre>
How to get previous value of <select> in React? <p>An example.</p> <p><code>red</code> is selected from the very start.</p> <p>Then I select <code>green</code>. That is, from <code>red</code> to <code>green</code>.</p> <p>I can get new value <code>green</code> in <code>event.currentTarget.value</code>. But how do I ...
<p><code>currentTarget</code> is a property supported by <em>browsers</em> and it doesn't have anything to do with React, in itself.</p> <p><code>SyntheticEvent</code> is just a wrapper around the browser's native event, which exposes certain browser events.</p> <p>The closest thing to what you're trying to do that c...
Child item created two times in ExpandableListView Android <pre><code>public class ExpandableListAdapters extends BaseExpandableListAdapter { private Context _context; List&lt;String&gt; group_data; List&lt;String&gt; child_data; public ExpandableListAdapters(Context context, List&lt;String&gt; listDataHeader, ...
<p>Replace this getChild method to :</p> <pre><code>@Override public Object getChild(int groupPosition, int childPosititon) { return child_data.get(groupPosition); } </code></pre> <p>Correct one :</p> <pre><code>@Override public Object getChild(int groupPosition, int childPosititon) { return child_data.get...
Libgdx Stencil & ShapeRenderer <p>I am trying to accomplish something like this:</p> <p><a href="https://i.stack.imgur.com/CkdSO.jpg" rel="nofollow">sample image</a></p> <p>The whole screen will be black, then the insides of the triangle shape are the parts that will only appear.</p> <p>I tried using SCISSOR but it ...
<p>There are a few different ways that you can render a masked image. One possible way is to use the depth buffer. I've written a small method that shows the process of setting up the buffer using a ShapeRenderer to define a triangular region of the image to render and mask out the remainder. The triangle mask could be...
need to create a configureable timer task in java via XML <p>I have a multi threaded socket server application. My requirement is to update a table every X min which i do now by running a parallel thread. The duration(in minutes) is stored in a XML file. but the parallel running thread is taking too much space on the h...
<p>Go with Spring core and use:</p> <pre><code> @Scheduled(&lt;Options&gt;) </code></pre> <p>its to much easy you can make a jar and run it will run perfect. so no need to work with thread , thread always makes to difficult to manage</p> <p><a href="http://howtodoinjava.com/spring/spring-core/4-ways-to-schedule-task...
Why are the indices of a sparse non-diagonal array inversed? <p>I have a sparse matrix file, which contains 820 lines. Sample of few lines of the file are as follows:</p> <pre><code>0 547 1 1 547 1 2 539 0.500000 2 540 0.500000 3 512 0.333333 3 515 0.333333 </code></pre> <p>I want to import this spar...
<p>You are probably following row-major (e.g. your matrix was created in C) and MATLAB is column-major. To convert from one to the other, just swap the coordinates!</p> <p><code>A = (sparse(T(:,2)+1, T(:,1)+1, T(:,3), cols, rows));</code></p> <hr> <p>Example that it works:</p> <pre><code>T=[0 547 1; 1 547 1; ...
PDFBox omits form fields when page is cloned <p>I'm trying to create a multi-page document using PDFBox and Groovy. I have a template document which contains some form text fields and everytime a new document should be created, the program uses this template.</p> <p>My problem is that whenever I try to create a new d...
<p>I managed to resolve this problem with the help of Tilman Hausherr. Here is the code located after the for loop.</p> <pre><code>PDAcroForm acroForm = new PDAcroForm(document, acroFormDict); acroForm.setFields(fields) acroForm.setDefaultResources(res); PDDocumentCatalog catalog = document.getDocumentCatalog(); cata...
Bootstrap navbar background color rules not working <p>When I try to change my navbar background color it becomes grayed out in <code>Google Chrome</code> inspector. Can't find a working solution on google.</p> <p>It does change when I removing navbar-default but then I don't get the toggle icon on smaller screens.</p...
<p>try below code, u just need to remove background image</p> <pre><code>.navbar-custom { background-image: none; } </code></pre> <p>see <a href="https://jsfiddle.net/DTcHh/26314/" rel="nofollow">fiddle</a> here</p>
How to check if LLDB loaded debug symbols from shared libraries? <p>On Linux I use</p> <pre><code>(gdb) i shared </code></pre> <p>in gdb and gdb prints a list of libraries either with a star <code>*</code> if no debug symbols are loaded or without it if loaded, e.g:</p> <pre><code>0x0000000100c18660 0x0000000100c48...
<p>If your binary was built with a dSYM, then the dSYM will show up on the line after the binary's listing in image list.</p> <p>There isn't an easy way to do this if the binary is using the "leave the debug information in the .o file" style which is the default for the Debug configuration in Xcode. I filed a bug to ...
Error in sql query Incorrect syntax near <p>I newbie in Microsoft Visual Studio 2008. I have a SQL query, which shows a time that had been spendeed on solving each request by every employee. Data base is Microsoft SQL Server on Windows Server 2008. </p> <p>I want to find a number of requests that had been solved in a ...
<p>SQL Server does not have a real boolean data type and thus does not support boolean expressions like <code>cast ( tline as int) &gt; 6</code></p> <p>You need to rewrite that into a case statement:</p> <pre><code>case when cast ( tline as int) &gt; 6 then 1 else 0 end as tv </code></pre>
Is it possible to create multiple data source objects under the same database executing a single xmla script? <p>I want to create multiple data source objects under the same database executing the single XMLA script only once.I have tried the below script but it did not work.If I define only a single node, the script ...
<p>Is there a batch element wrapper you can use? </p>
read/write to the same file (getting gmon.out) <p>My homework asks that I use a single file to output data to, send calculations to that file, and read the results from that file. The data is a series of input ages from 1-100, controlled by a decrement counter based off of a variable cin by user: totalAges.</p> <p>The...
<p>When you do</p> <pre><code>data&gt;&gt;age; </code></pre> <p>you are trying to read from the <em>output</em> stream. You should be using <code>&lt;&lt;</code> to write instead:</p> <pre><code>data&lt;&lt;age; </code></pre> <p>Before that though, you need to check if the file actually is open, or any writing to i...
Using external class methods inside the imported module <p>My python application consists of various <em>separate</em> processing algorithms/modules combined within a single (Py)Qt GUI for ease of access. </p> <p>Every processing algorithm sits within its own module and all the communication with GUI elements is imple...
<p>No. I think this approach somewhat breaks software engineering principles (e.g. <a href="https://en.wikipedia.org/wiki/Single_responsibility_principle" rel="nofollow">single responsibility</a>). In single responsibility principle, each module is only in charge of its assigned task and nothing else. If we consider UI...
Selenium/Ruby writing code to check Web Element by of way Xpath <p>I am writing in ruby code using <code>selenium webdriver</code> and I simply want to check to see if an element is properly displayed on a webpage. I am doing this by way of <code>xpath</code>. </p> <pre><code>@driver.find_element(:xpath, ' ') </code>...
<blockquote> <p>I simply want to check to see if an element is properly displayed on a webpage</p> </blockquote> <p>Actually <code>find_element</code> returns either <code>WebElement</code> of throws <code>NoSuchElementException</code>, So you can write your own method which uses try catch block and return true when...
Java vararg pass lamda and values <p>I'm trying to unite lambdas and simple values in varag.</p> <pre><code>public static void Log(String format, Object ... args) { final Object[] fmt = new Object[ args.length ]; for(int i = 0; i &lt; args.length; i++) fmt[i] = args[i] instanceof Supplier ? ...
<p>The problem is in the error message</p> <blockquote> <p>Object is not a functional interface</p> </blockquote> <p>You can only create a lambda for a functional interfaces (one with exactly one abstract method) Object is not an interface and it doesn't have any abstract methods so you can't create a lambda of th...
Android - Scan ip with send pings <p>I want to send pings between 192.168.1.0 and 192.168.2.255 due to detect machines in my network (wifi).. Is there a any function which make this? Thank you.</p>
<p>Add loop 0-254 for Ip and inside this you can check IP is reachable or not using following code </p> <pre><code>InetAddress.getByName(ip).isReachable(timeout); </code></pre>
when I am adding Long Press Gesture on uiimageview in Table View Cell .Uiimageview Is not showing With correct Image <p>I am Using the Long Press Gesture code on uiimageview the Problem is Profile Picture is not showing Correct.I have 50 values in Table View and after 5 to 6 images Further Cell image is going to be Nil...
<p>The error is in those lines:</p> <pre><code>UIImageView *cellimg=(UIImageView*)[cell viewWithTag:101]; cellimg.tag=indexPath.row; </code></pre> <p>You are changing the image view tag, and then, when cell is being reused, it doesn't have a view with tag 101, so your <code>cellimg</code> is <code>nil</code>. </p>
what is the difference between left join and left outer join? <p>I have created 2 tables as</p> <pre><code>CREATE TABLE table1(customerName VARCHAR(20),custid NUMBER ,order_id NUMBER ,price NUMBER ); CREATE TABLE table2(id NUMBER ,salary NUMBER ); </code></pre> <p>Now, I tried to use the queries </p> <pre><code>SELE...
<p>The <code>OUTER</code> keyword is optional across most popular SQL distributions, which means there is absolutely no difference between a <code>LEFT JOIN</code> and a <code>LEFT OUTER JOIN</code></p>
symfony: load many services in one service? <p>In a futur webapp, I need to retreive datas from differents API (Soap/Rest/Custom...), and sometime mix results from 2, 3, or all API at the same time.</p> <p>For each API, i will perform the sames actions, ex: getLastDatas, setOneData, putDatas2externalDB, etc...</p> <p...
<p>I would suggest to write separate services (but implementing a shared interface) for each API you want to consume, and then write a service that aggregates these individual API clients. Your aggregation service could have an API like this:</p> <pre><code>&lt;?php class MyAggregrator { /** @var ApiClientInterfa...
How to make the HTML renders before the alert is triggered? <p>The question is actually quite simple. How do I make the div's content change before the alert shows up?</p> <p>JSFiddle: </p> <p><a href="https://jsfiddle.net/n2n5drL2/1/" rel="nofollow">https://jsfiddle.net/n2n5drL2/1/</a></p> <p>HTML:</p> <pre><code>...
<p>You need to defer execution of the blocking <code>alert</code> so the browser can re-render the changed DOM. You can do this <a href="http://stackoverflow.com/questions/779379/why-is-settimeoutfn-0-sometimes-useful">with <code>setTimeout</code> and a 0ms timeout</a>:</p> <pre><code>$('#change').click(function(){ ...
How to rewrite below code so that I get expected output <p>The objective is to read list of known files from amazon s3 and create a single file in s3 at some output path. Each file is tab separated. I have to extract first element from each line and and assign it a numeric value in increasing order. Numeric value and e...
<p>Looks like all you need is <a href="https://spark.apache.org/docs/2.0.1/api/scala/index.html#org.apache.spark.rdd.RDD@zipWithIndex():org.apache.spark.rdd.RDD[(T,Long)]" rel="nofollow"><code>RDD.zipWithIndex()</code></a>:</p> <pre><code>val myRDD = sc .textFile("s3://mybucket/fileFormatregex") .map(col =&gt...
how to retrieve parent's value based on child <p>I am trying to retrieve the user's key based on the child's email, which is student@memail.com in this case. I have tried many ways but could not get a way to retrieve the key of the record. I want to retrieve the value KKTxEMxrAYVSdtr0K1NH , below is the snapshot of the...
<p>What method are you using to retrieve the node? If you are using on "child_added" then you can use: <strong>childSnap.key</strong></p> <p>If you are using on "value" then your references is the keys in the response object. So you can use:</p> <pre><code>for (var key in childSnap.val()) { console.log(key) } </code>...
Update table based on Dates in SQL Server? <p>I got below 2 tables:</p> <pre><code>if object_id('tempdb..#t1') is not null drop table #t1 create table #t1 ( ID int, opendate datetime, closedate datetime, [ADDRESS] varchar(50) ) insert into #t1 (ID, opendate, closedate) values (111, '1930-...
<pre><code>update t1 set address = tmp.address from (select t1.ID, t1.opendate, ROW_NUMBER() over (partition by t1.opendate order by t2.opendate desc) row, t2.ADDRESS from #t1 t1 inner join #t2 t2 on t1.ID = t2.ID and t1.opendate between t2.opendate and isnull(t2.closedate, t1.opendate)) tmp inner join #t1 t1 o...
perl - searching in list of objects which are an accessor of another object <p>I am a Perl-OO beginner and I am encountering a design-challenge. I hope you can give me some hints to get to an elegant solution. I am working with Mouse Object System here.</p> <p>For a minimal example lets say I have a User-Object. A use...
<p>You don't really have to write the <code>UserCache</code> class yourself. Instead, use <a href="https://metacpan.org/pod/CHI" rel="nofollow">CHI</a> to cache users you want to cache under the key you want to use for lookups. If you want, you can wrap your cache class to abstract away from the specific cache implemen...
Dynamically create page based on ListModel count <p>I am a beginner QT/QML app development</p> <p>How can I create a qml dynamically based on the ListModel count. In the view I am listing the modelObjects in a GridLayout using Repeater.</p> <pre><code>Item{ id:griditem anchors.fill:parent GridL...
<p>Try something like this:<br> <code>lm</code> is the <code>ListModel</code> that is to be split.</p> <pre><code>SwipeView { width: 200 height: 800 clip: true currentIndex: 0 Repeater { model: Math.ceil(lm.count / 6) delegate: ListView { width: 200 ...
receiving ambiguous sky screen while loading google map <p>while loading google map on device i am receiving below screen sometimes.it comes on second load as shown below.<a href="https://i.stack.imgur.com/iFBb9.png" rel="nofollow"><img src="https://i.stack.imgur.com/iFBb9.png" alt="google map"></a> otherwise it comes ...
<p>This problem occurs when your coordinates are not properly set. Make sure the coordinates that you are using is pointing in the land to get the maps correctly. Another possible reason is your API key is not working, try to generate new API key for this project.</p> <p>For more information, check these related SO qu...
Place in new div when match space in string <p>I have this html</p> <pre><code>&lt;span class="item-title"&gt;Title&lt;/span&gt; &lt;span class="item-cat"&gt;sub-text&lt;/span&gt; </code></pre> <p>I have in database string like <code>Title sub-text</code>. How can I place <code>sub-text</code> in bottom <code>&lt;s...
<p>In case of sub-text won't have any spaces you can simply use <a href="http://php.net/manual/en/function.explode.php" rel="nofollow">explode()</a> function create two strings. One for title and another one for sub-text.</p> <p>Code would look seomthing like this,</p> <pre><code>&lt;?php $mainTitle="Title sub-text"...
R add a new column to dataframe using mutate_ where column name is specified by a variable <p>I have a dataframe, that I want to add a column to, where the column is defined by a variable name:</p> <pre><code>df &lt;- diamonds NewName &lt;- "SomeName" df &lt;- df %&gt;% mutate_(paste0(NewName," = \"\"")) </code></pre>...
<p>The issue has to do with when the evaluation of the statement is occurring. By my understanding, the goal of <code>mutate_</code> is not to recreate the syntax of <code>mutate</code>, for example using <code>paste</code> to create <code>mutate(SomeName = "")</code>. Instead, it is to allow generation of functions to...
Can you use a npm package without using NodeJS <p>I found a library on github that I would like to use but the download instructions only mention using npm but I am not using a NodeJS project (just a basic html,css,javascript front-end with no back-end server). Am I still able to use that library or is it a lost cause?...
<blockquote> <p>Is there another way to download it without using npm?</p> </blockquote> <p>If it's on github, then you can checkout or fork the repository as you can with any other git repo.</p> <blockquote> <p>Am I still able to use that library or is it a lost cause?</p> </blockquote> <p>Whether or not the li...
Azure Storage and Data Management <p>I have shutdown the VM in Azure Portal and the status was "Stopped(Deallocated)" but their was a billing process alive for Storage and Data Management, Do anyone know how to Stop these to avoid Billing.</p>
<p>As you may already know, VHDs containing OS and Data disks for your VM are stored as Page Blobs in your Azure Storage account. One of the things you get charged for in Azure Storage is how much storage you're using and this is what you're getting charged for.</p> <p>Deallocating the VM will only stop the billing fo...
Lambda from API gateway VS kinesis Streams <p><strong>Background</strong></p> <p>i am studying about AWS kinesis,API gateway.</p> <p>I understand that ,whenever requests hit API gateway,i can forward the data to a stream or i can choose to trigger a lambda(which will do some processing ).</p> <p><strong>Thoughts and...
<p>It depends on frequency of client accesses and time-length of your lambda function.</p> <p>The number of concurrent executions of lambda function is limited to 100. When lambda is throttled, retrying approaches are different between API Gateway and Kinesis stream.</p> <p>See <a href="https://docs.aws.amazon.com/la...
Can i compile java for an older Java version with ant with a newer JDK so it generates output when it compiles code that uses the newer API? <p>I would like to only have JDK 8 installed on my system, and have the ant javac compile action create working classfiles for a java 6 environment.</p> <p>This sort of works if ...
<p>You write:</p> <blockquote> <p>I am aware that this generates the following warning: [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6.</p> </blockquote> <p>This warning points us toward the correct solution. In addition to the <code>-source</code> and <code>-target</code> o...
AngularJS: How do I share data accross all pages and controller of my SPA? <p>What is the best way to share some data across all controllers and scopes of my Single page application ? </p> <p>Let say i have a small set of data I want to be able to access everywhere, and I don't want to query the database every time I ...
<p>The data to be stored in $rootscope variable</p> <p>(or)</p> <p>data to be stored in services</p>
SoftLayer API: Provision Server with Basic RAID Configuration <p>How do you get the appropriate RAID configured on a server order issued through the API? </p> <p>When attempting to provision a server using the SoftLayer API, we can never get it to properly provision even basic configurations. </p> <p>After reading <a...
<p>In your payload is missing the raid configuration, it should be something like this:</p> <pre><code>{ "parameters": [{ "packageId": 271, "location": 449494, "quantity": 1, "hardware": [{ "hostname": "server-name", "domain": "domain.com", "prim...
Jquery form validation <p>I am having issues merging my currently; page separated input validation onto a single webpage. Here is my attempt but it wont call both of the functions, any idea why</p> <p>Jquery:</p> <pre><code> &lt;script&gt; function isValidPassword(Passwordreg){ var pattern = new RegExp(/^(?=....
<p>You have a syntax error n your code. So it is not working for you.</p> <p>Here is the fixed code.</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 isValidPasswor...
Handsontable: When scroll vertically up and down, I got the css style removed <p>I am using a handsontable, I customize the error in cells.</p> <pre><code>var cell = hot.getCell(rowKey, id); $(cell).css('background-color', '#ff4c42'); $(cell).text(message); $(cell).css('color', 'white'); </code></pre> <p>Now when I s...
<p>I made this example <a href="http://jsfiddle.net/car3673r/" rel="nofollow">JSFiddle</a> for you.</p> <pre><code>afterValidate: function(isValid, value, row, prop, source) { if (row == 2 &amp;&amp; hot.propToCol(prop) == 2) { hot.setDataAtCell(row, hot.propToCol(prop), 'error'); } }, invalidCellClassName: 'm...
Using automapper for mapping <p>I have a class <strong>City</strong> with properties <strong>CityID</strong> and <strong>CityName</strong> in <strong>Util layer</strong> of a project. I have another class <strong>CityVM</strong> that is present in <strong>ViewModel Layer</strong> with the same properties. I want to map...
<p>The Exception says that AutoMapper don't know the mapping that you have specified for it. As stated in the <a href="https://github.com/AutoMapper/AutoMapper/wiki/Getting-started#how-do-i-use-automapper" rel="nofollow">Getting Started Guide</a>, you can try:</p> <pre><code>var config = new MapperConfiguration(cfg =&...
Differentiate missing values from main data in a plot using R <p>I create a dummy timeseries <code>xts</code> object with missing data on date 2-09-2015 as:</p> <pre><code>library(xts) library(ggplot2) library(scales) set.seed(123) seq &lt;- seq(as.POSIXct("2015-09-01"),as.POSIXct("2015-09-02"), by = "1 hour") ob1 &l...
<p>Thanks for the great reproducible example. I think you are best off to omit that line in your "missing" portion. If you have a straight line (even in a different colour) it suggests that data was gathered in that interval, that happened to fall on that straight line. If you omit the line in that interval then it is ...
Create sandbox environment linux for c++ pc2 programming contest system <p>I want to hold a programing contest and use pc^2 <a href="http://pc2.ecs.csus.edu" rel="nofollow">Programming Contest Control System</a><br> My server is Ubuntu and when someone submit a code to the server pc2 will compile the file and run it bu...
<p>You may look into <a href="https://en.wikipedia.org/wiki/Linux_containers" rel="nofollow">Linux containers</a>, like <a href="https://www.docker.com/" rel="nofollow">Docker</a> or <a href="https://linuxcontainers.org/" rel="nofollow">LXC</a>, and <a href="https://en.wikipedia.org/wiki/UnionFS" rel="nofollow">union f...
How to add variable to header.php controller and use it in header.tpl <p>I am creating a custom theme for OpenCart 2.3 and I need to show some additional information in page header (header.tpl). So I added some variable to catalog/controller/common/header.php:</p> <pre><code>$data['some_var'] = 'some_value'; </code></...
<p>I need to see your controller to get the full picture and then i will give you the full answer, but take a look on your controller and make sure that you bind your data like the sample below:</p> <pre><code>if (file_exists(DIR_TEMPLATE . $this-&gt;config-&gt;get('config_template') . '/template/common/header.tpl')) ...
Error handling with c++ <p>I need to do some error handling in c++ that corrects user input if it's a letter or a string. I need to use .at(), .length(), and atoi to handle this. I'm not sure how/where to implement those is the problem. </p> <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;s...
<p>The best approach to input validation is to write a function that reads into a <code>std::string</code>, checks whatever is needed, and only returns a value when it passes the tests:</p> <pre><code>int get_value() { std::string input; int value = -1; while (value &lt; 0) { std::cout &lt;&lt; "Gi...
Include deployment timestamp into JSP page <p>I'm writing web applications with Java EE 7 using JSP and servlets, deploying to a local Wildfly 10 server.</p> <p>To help me developing and testing my code, it would be useful to include a little timestamp into the displayed webpage, so that I can directly see when the ve...
<p>This is not deploytime, but starttime of the application. Maybe it is useful for your purpose. You can inject the class and use it to display data on your page.</p> <pre><code>@Startup @Singleton public class Deploytime { private LocalDateTime starttime; @PostConstruct public void init() { starttime = Lo...
Why does the browser not want to place the text between the <tr> tags? <p>I want to put the table rows with javascript in the HTML. Why is <em>trRight</em> not between the <em>tr</em> tags?</p> <p>I have also tested in other browsers and it's the same issue.</p> <pre><code>&lt;!doctype html&gt; &lt;html lang="en"&g...
<p><code>&lt;tr&gt;</code> is a table row it <a href="https://www.w3.org/TR/html-markup/tr.html" rel="nofollow">doesn't allow contents</a> to be placed other than <code>&lt;td&gt;</code> or <code>&lt;th&gt;</code>, you have to place your content only inside <code>&lt;td&gt;</code> like this:</p> <pre><code>document.qu...
How to pass row $event to bootstrap modal in angular 2 <p>I am trying to delete a record from a table. The user clicks the delete button and it opens a confirmation box. The user clicks on the delete button in the box and then it should delete. I want to pass the row's $event to bootstrap modal so that I can get the ce...
<p>Better to create one Delete modal component for the same instead of using same code again and again here is my code for the same , just pass the data of row and use like this</p> <pre><code>&lt;delete (deleteFun)="DeleteElement(Number)" [pk]='Number'&gt;&lt;/delete&gt; </code></pre> <p>you can see here working exa...
How to make scrollable html table columns responsive using bootstrap <p>I'm not a web designer. I was trying to design a web layout with some scrollable columns which contains some data in the form of anchor tags which are loaded dynamically. I've designed a <code>html table</code> structure along with a style sheet to...
<p>To make any table responsive just place the table inside a <code>&lt;div&gt;</code> element and apply the class <code>.table-responsive</code> on it, as demonstrated in the example below:</p> <pre><code>&lt;div class="table-responsive"&gt; &lt;table class="table table-bordered"&gt; &lt;thead&gt; ...
Azure ad group membership claims <p>I've set the groupMembershipClaims property in an app's manifest in Azure AD to "All", which should result in a user's security group memberships to be returned in the id token. </p> <p>However, they are not being returned. Have tried to re-login multiple times. Is there something I...
<p>Can you be more specific in terms of what exactly you are trying to achieve and how'd you want to do it.</p> <p>Apparently, if the thing mentioned in your question is what exactly you are looking for and since the groupMembershipsClaims property is set to "All", you'll get the group claims in the JWT token. </p> <...
SQL Trigger To Update <p>Good day I have an external Program that stores information in SQL, I am trying to do a trigger that Updates a table when some of the fields in that Table change.</p> <p>So I have one column <code>Contractual Amount</code> that should be updated everytime any of the values in <code>ufAPCHANG1E...
<p>I'll suggest to use simple query when possible:</p> <pre><code>ALTER TRIGGER dbo.trgContractualAmt ON dbo.Vendor AFTER UPDATE AS BEGIN UPDATE V SET ufAPContAmt += CASE WHEN (V.ufAPCHANGE1AMT &lt;&gt; I.ufAPCHANGE1AMT) THEN I.ufAPCHANGE1...
How to convert nested list to object <p>When I receive JSON data like </p> <pre><code>[ { "id":1, "name":"New Island", "residents":[ { "name":"Paul", "age":"25" } ] }, { "id":2, "name":"One Nat...
<p>From Python's <a href="https://docs.python.org/3.5/library/json.html" rel="nofollow">JSON library</a></p> <pre><code>import json data = '[{"id":1,"name":"New Island","residents":[{"name":"Paul","age":"25"}]},{"id":2,"name":"One Nation","residents":[{"name":"James","age":"23"},{"name":"Jessica","age":"26"}]}]' x =...
Get User in a Doctrine EventListener <p>when I register a new Plasmid Entity, I want give him an automatic name (like: p0001, p0002, p0003), to do this, I need to select in the database the last Plasmid entity for a specific User, get its autoName, and use this previous name to define the new one.</p> <p>But, when I i...
<p>I think that you should store pointer to tokenStorage class in your service instead of user object:</p> <pre><code>class PlasmidListener { private $tokenStorage; public function __construct(TokenStorage $tokenStorage) { $this-&gt;tokenStorage = $tokenStorage; } public function prePers...
Compile and Execute QxORM qxBlog example <p>I'm actually in a project in which I use Qt and I need to use an ORM. I found QxORM. In the process of getting started with this ORM, I need to be able to compile and execute the qxBlog example provided with it. I have thoroughly followed </p> <ul> <li>the QxORM installation...
<p>I found an answer to my question with @drescherjm help.</p> <p>All I had to do was to add an include path to my .pro file. I did it by adding the following line :</p> <pre><code>INCLUDEPATH += ../../../QxOrm/include/ </code></pre>
Docker container and virtual python environment <p>I'm getting started working with Docker. I installed Docker Toolbox on Windows 10 and downloaded the desired container. I need full access to container’s filesystem with the ability to add and edit files. Can I transfer the contents of the container into a Virtual Py...
<p>Transferring files between Windows and Linux might be a little annoying because of <a href="https://blog.codinghorror.com/the-great-newline-schism/" rel="nofollow">different line endings</a>.</p> <p>Putting that aside, sounds like you are looking to create a Docker based development environment. There are good tut...
Outlook deforms my mail <p>I'm doing a newsletter with mailchimp. But when I send a test mail to myself, Outlook deforms it, is it normal?</p> <p>I tried to change it to HTML but it doesn't worked.</p>
<p>Yes it is normal, doing e-mails is tricky.</p> <p>Please share with use the markup.</p> <p>Build e-mails have a lot of tweaks and tricks. You might have some compatibility issue on your code.</p>
Disadvantages of using vanilla code for a Single Page Application <p>I am building a SPA that basically incorporates multiple video streams (using WebRTC) and various other components such as a text 'chat' feature.</p> <p>I have spent a couple of weeks building a proof of concept prototype using vanilla javascript, jQ...
<p>The only specific disadvantage is it may not conform to standards, making it more difficult for someone to read later. If you're doing the project alone, go for it. If you're doing it for a company, you can still do it but document it very well and make sure all of your code is clean.</p>
Python read lines from a file and write from a specific line number to another file <p>I want to read the lines from a file and write from a specific line number to another file. I have this script, which writes all the read lines. I need to skip the first four lines and write the rest to another fils. Any ideas?</p> ...
<p><a href="https://docs.python.org/3/library/itertools.html#itertools.islice" rel="nofollow"><code>itertools.islice</code> is designed for this</a>:</p> <pre><code>import itertools with open('VY_NM_VR_lin_o1_bonded_results_{k}.txt'.format(k=k)) as f1: # islice w/4 &amp; None skips first four lines of f1, then ge...
How to access lib folder modules of ear file from a different deployment on same WildFly server? <p>I have an ear (App.ear) and a war (Web.war) file deployed in the same WildFly. The App.ear contains AppEJB.jar as a module and Util.jar in lib folder of the same. I need the Web.war to be able to see the Util.jar and App...
<p>I believe you need dependency for Util.jar in your Web.war's pom.xml</p>
How To Set an local Maven Repository (Spring Cloudataflow Server) -->Pivotal CF DEV <p>Environment </p> <ul> <li>Pivotal Cloud Foundry DEV</li> <li>Spring Cloud Data Flow Server</li> <li>Spring Cloud Data Flow Shell</li> </ul> <p>Maven Specific Environment Variables (Spring Cloud Data Flow Server)</p> <p>MAVEN_LOCAL...
<p>The property for <code>local</code> repository needs to be: <code> MAVEN_LOCAL_REPOSITORY =C:/Users/xx/.m2/repository/ </code> <code>underscore</code> between LOCAL and REPOSITORY.</p> <p>Did you see <code>MAVEN_LOCALREPOSITORY</code> anywhere in the documentation?</p>
Extending Ionic2 and injecting ModalController <p>I am trying to develop a datepicker component that can be used for any project.</p> <p>I have an NgModule that has components and I inject IonicModule in to it so it can use all the components/directives of ionic2.</p> <pre><code>@NgModule({ imports: [ Com...
<p>You should only call <code>forRoot</code> on the root module. This call sets up a bunch of application providers, which should only be done when bootstrapping Ionic. What you should do instead is just import <code>IonicModule</code> (no forRoot).</p> <p>As for the <code>ModalController</code>, it's already provided...
Finding the Datediff between Records in same Table <pre><code>IP QID ScanDate Rank 101.110.32.80 6 2016-09-28 18:33:21.000 3 101.110.32.80 6 2016-08-28 18:33:21.000 2 101.110.32.80 6 2016-05-30 00:30:33.000 1 </code></pre> <p>I have a Table with certain records, grouped by Ipadd...
<p>While <a href="https://msdn.microsoft.com/en-us/library/ms189461.aspx" rel="nofollow">Window Functions</a> could be used here, I think a self join might be more straight forward and easier to understand:</p> <pre><code>SELECT t1.IP, t1.QID, t1.Rank, t1.ScanDate as endScanDate, t2.ScanDate as beginSc...
Find n-cliques in igraph <p>I would like to know if I can find so-called n-cliques in an igraph object. Those are defined as "a maximal subgraph in which the largest geodesic distance between any two nodes is no greater than <em>n</em>" according to Wasserman &amp; Faust. I'm aware that cliques of <em>n=1</em> can be f...
<p>In <strong>theory</strong>, you could try <a href="http://finzi.psych.upenn.edu/R/library/RBGL/html/kCliques.html" rel="nofollow"><code>RBGL::kCliques</code></a>: </p> <pre><code>library(igraph) library(RBGL) set.seed(1) g &lt;- random.graph.game(100, p.or.m = 300, type = "gnm") coords &lt;- layout.auto(g) cl &lt;-...
Espresso test: How to open my application back after opening the recent apps? <p>I want to open my application back while writing an Espresso test case after opening recent apps by calling <code>pressRecentApps()</code> method. Is there a way to do this except of simulating a click by coordinates?</p>
<p>I'd say that you can't. The moment your app looses focus, you are out of luck.</p> <p>You probably need to use <a href="https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html" rel="nofollow">UI Automator</a> for that</p>
Unknown command 'import-graphml', when trying to import into Neo4j database <p>It has been asked before, but in that case the problem was miraculously solved (<a href="https://github.com/jexp/neo4j-shell-tools/issues/25" rel="nofollow">https://github.com/jexp/neo4j-shell-tools/issues/25</a>). I, sadly, am not so lucky....
<p>My mistake, I assumed these tools were part of the neo4j-shell. However they require there own installation <a href="https://github.com/jexp/neo4j-shell-tools" rel="nofollow">https://github.com/jexp/neo4j-shell-tools</a></p>
Create Application with Authenticates against O365 Azure AD with OpenIdConnect <p>I've got an application I'm creating for use with Office 365 accounts (Will be multi-tenant). I'm looking to use OpenID Connect for authentication. I do not need regular Microsoft accounts working.</p> <p>I've tried creating an applicati...
<p>At the moment, there are two different OpenID Connect endpoints you need to choose from. If you don't require Microsoft accounts, I recommend you register an app at portal.azure.com, and use the <code>https://login.microsoftonline.com/common/oauth2/authorize</code> endpoint for performing OIDC. There is good proto...
WPF text box border changes color upon mouse entry <p>For some reason my text box border is changing color to an offputting blue whenever the mouse hovers over the text box. here is my xaml: </p> <pre><code> &lt;TextBox BorderThickness="1" BorderBrush="Black" x:Name="textBox" custom:ScrollToEn...
<p>Change the default style to black with a IsMouseOver trigger:</p> <pre><code>&lt;Style TargetType="TextBox"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="TextBox"&gt; &lt;Border BorderThickness="{TemplateBinding Bo...
Magento2 Custom content div <p>I'm trying to add a banner to all my pages.</p> <p>So i created this:</p> <pre><code>&lt;block class="Magento\Framework\View\Element\Template" name="banner" template="banner.phtml"/&gt; </code></pre> <p>inside </p> <blockquote> <p>default.xml</p> </blockquote> <p>Which contains:</p...
<p>Hey I think I helped you out on this one already, but here you go. </p> <p>follow this folders paths:</p> <pre><code>app/code/YouTheme/Banners/view/frontend/templates/banner.phtml </code></pre> <p><code>YouTheme/Banners</code> are folders from your custom module... Let say Kevin/Banners or whatever you'd like to ...
I have this python function for DFS, why is it throwing error? <pre><code>##This function will return the edges for an undirected graph#### ###Example: when edges = [[1,2],[3,2]] ### this will return { 1: {'nbr': [2], 'id': 1, 'visited': False}, 2: {'nbr': [1, 3], 'id': 2, 'visited': False}, 3: {'nbr': [2]...
<p>Yes, <code>cc</code> is defined in scope of <code>DFS</code>, that does not make it visible inside <code>explore</code>. You could define it as a parameter to <code>explore</code>;</p> <pre><code>def explore(vertex, E, cc): </code></pre> <p>and pass in the value;</p> <pre><code>. . . explore(x, E, cc) . . . </co...
Connecting to shards separately to read only, speed performance <p>Problem. I need to read documents from Mongodb, 500M documents, it is sharded to 10 shards. </p> <p>My biggest issue is the speed, right now. </p> <p>I have connected to each shard separately and read each one as separate task, assuming my speed will...
<p>Here are some tips to improve the speed with some assumptions</p> <ol> <li><p>MongoDB is a nosql database which uses quorum for consistency and reliability. In your case though you are reading from shards separately but MongoDB uses quorum of 3 by default. (it means reads will be happen from 3 replicas and then mo...
HttpLoggingInterceptor (OkHttp3) logging a lot of times for each request <p>I'm trying to do some requests using Retrofit2 and OkHttp3, and intercepting them using HttpLoggingInterceptor. I am injecting the OkHttp client using Dagger.. and it's all ok but when I just make a request to my server I can see the request an...
<p>try adding @Singleton annotation to Dagger. Maybe, you add several loggers instead of one</p>
Rails - How to avoid repeating same i18n attributes translations <p>I am building a Rails application using I18n translations.</p> <p>I have two models (Blog and Event), sharing same attributes (title, content).<br> In my I18n yml files, how can I avoid repeating same keys for each attributes models and share them ?</...
<p>Similar kind of question is answered <a href="http://stackoverflow.com/a/4910818/4758119">here</a></p> <p>You can achieve it using yaml aliases</p> <pre><code>fr: activerecord: attributes: blog: &amp;title_content title: Titre content: Contenu event: *title_content </code></pre> ...
Execute/Reject function based on customs attribute value in dotnet core C# <p>I'm trying to learn the attributes in C# dotnet core, so I wrote the 2 below classes.</p> <ol> <li><p><code>Attribute class</code>:</p> <pre><code>using System; namespace attribute { // [AttributeUsage(AttributeTargets.Class)] [Attri...
<p>your solution is to find the declared method &amp; in that method find the attribute.</p> <pre><code>var customAttributes = (MyCustomAttribute[])((typeof(Foo).GetTypeInfo()) .DeclaredMethods.Where(x =&gt; x.Name == "fn") .FirstOrDefault()) .GetCustomAttributes(typeof(MyCustomAttribute), true); </code></pre>
Semantic HTML for a business card <p>I am trying to write semantic HTML for a business card. I want to show the name, title, email and phone number on the markup.</p> <pre class="lang-html prettyprint-override"><code>&lt;div id="bussinesscardcontainer"&gt; &lt;section class="Details"&gt; &lt;sp...
<p>Your markup is technically correct but could subjectively be improved. </p> <p>The HTML5 spec added many, more descriptive HTML properties like <code>&lt;footer&gt;</code> that you are using but left implementation up to web developers. This has resulted in less than optimal usage of HTML properties in my experienc...
Leaving case statement in one line using beautify plugin in VS Code <p>After installing beautify plugin in VS Code pressing <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>F</kbd> results in reformatting a switch case form</p> <pre><code>switch (cmd) { case glob.CmdsClient.GET_CHANGED_ITEMS: cmds.getChangedItems(data, s...
<p>You can configure all keyboard shortcuts from the visual studio options menu. Please check the following links for reference. <a href="https://msdn.microsoft.com/en-us/library/5zwses53.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/5zwses53.aspx</a></p>
Javascript not working for unknown reason after making some little tiny change to it somewhere <p>Sorry for bothering everyone, I was just executing it in the wrong browser.</p>
<p>just remove this line:</p> <pre><code>document.getElementById("update").addEventListener("click", update); </code></pre> <p>Or create the update element</p>
Python Pandas - filtering df by the number of unique values within a group <p>Here is an example of data I'm working on. (as a pandas df)</p> <pre><code> index inv Rev_stream Bill_type Net_rev 1 1 A Original -24.77 2 1 B Original -24.77 3 2 A ...
<p>You can group your data by <code>inv</code> and <code>Rev_stream</code> columns and then check for each group if both <code>Original</code> and <code>Rebill</code> are in the <code>Bill_type</code> values and filter based on the condition:</p> <pre><code>(df.groupby(['inv', 'Rev_stream']) .filter(lambda g: 'Orig...
how to Import com.android.internal.telephony <p>How do I Import the following? I have tried them this way but nothing is happening . Please help?</p> <pre><code>import com.android.internal.telephony.cat.AppInterface; import com.android.internal.telephony.cat.LaunchBrowserMode; import com.android.internal.telephony.cat...
<p>These classes are hidden. You can not use directly. I guess <strong>reflection</strong> is the one solution.</p>
Not receiving push form Urban Airship on iOS <p>I'm trying to get my iOS devices to receive push notifications again, but it's not really working out.</p> <hr> <p>The context in which I'm working:</p> <h3>My project setup</h3> <ul> <li>Platforms I need to support: iOS8+ </li> <li>UA version I'm using: 8.0.1 (insta...
<p>The Urban Airship SDK takes care of registering with UNUserNotificationCenter for you. You should be able to remove registration calls. I don't think it should be causing problems for you, but it could prevent some features such as OOTB categories from working.</p> <p>As for push notification events, I would recomm...
Angular 2 Webpack and editing files <p>This might be a completely stupid question, but I'm a newbie and totally new to webpack :)</p> <p>So I started a project using this: <a href="https://github.com/preboot/angular2-webpack" rel="nofollow">webpack</a> I got it up and running fine, with <code>npm install</code>, <code...
<p>According to docs : <a href="https://github.com/preboot/angular2-webpack#developing" rel="nofollow">https://github.com/preboot/angular2-webpack#developing</a></p> <blockquote> <p>Developing</p> <p>After you have installed all dependencies you can now start developing with:</p> <ul> <li>npm start</li...
Profile time taken by Delayed Job <p>I have a huge number of jobs in multiple queues, and I'm wondering if it would be possible to profile the time taken by each job?</p>
<p>You can use <a href="https://github.com/ice799/memprof" rel="nofollow">https://github.com/ice799/memprof</a>.</p> <p>Also to record different events of job you can use hooks<a href="https://github.com/collectiveidea/delayed_job/blob/master/README.md#hooks" rel="nofollow">https://github.com/collectiveidea/delayed_jo...
Symfony using ParamConverter with POST action <p>I'm building <code>rest API</code>, and have method to save posts.</p> <pre><code>postPostAction(Request $request) { } </code></pre> <p>my <code>POST</code> request contains all <code>Entity/Post</code> properties</p> <p>How to use <code>ParamConverter</code> to have...
<p>You can use default paramConverter like this</p> <pre><code>use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; /** * @ParamConverter("thePost", class = "AppBundle:Post") */ public function postPostAction(Post $thePost) { // ... } </code></pre> <p>The annotation takes several parameters, th...
Code that makes cyclic reference for x spaces in list <p>I have a tasko to make a program in which i get m, n and k. I should create a list a with <code>n*m</code> element. List <code>b</code> is supposed to have <code>n*m</code> element. It is created from list a with cyclic shift k to the right for m elements of list...
<p>Try this... </p> <pre><code># Start with an empty list B = [] # Take A in chunks of m for i in range( int(len(A)/m) ): # Take an m-sized chunk of A chunk = A[m*i:m*(i+1)] # Shift it to the right by k (python style!) shift = chunk[-k:] + chunk[:-k] # Add it to B B += shift print (B) </code></...
Git submodule with same name in different branches <p>I was wondering whether it is possible to have a git submodule pointing to two different repositories <em>using the same directory name</em>, depending on the branch currently checked out.</p> <pre><code>overall-repo (Branch A) \subproject at domainA overall-repo ...
<p>In case someone else stumbles upon this, too: The name does not necessarily reflect the folder in which the submodule exists. </p> <p>So the command <code>git submodule add --name subproject-B domainB subproject</code> creates the submodule with a unique name (<code>subproject-B</code>) but lets it reside in the ...
Calling function template of class template in C++ <p>I have intermediate level of knowledge in C++ and I would like to beg your pardon if you find the question is very easy or not of standard to post in this blog. But, somehow I was unable to solve it. :) </p> <p>Your kind help would be appreciated. Here is my code:...
<p>You forgot the template parameter:</p> <pre><code>FastRetinexFilter&lt;...&gt;::getInstance()-&gt;Adjust(...); ^^^^^ Specify the type </code></pre>
Apache Tomcat failed to start <p>I am using mac 15 inch retina eye display laptop currently running Sierra os . I am facing an issue from past few days apache tomcat does not start in netbeans. it gives an error port 8084 already in use. and when i try to change port to 8080 then it says starting of tomcat failed while...
<p>That means that there is another instance of Tomcat running at the same time. If you are unable to stop already running Tomcat instance from Netbeans you can do it from command line.</p> <ol> <li>Find Tomcat process id by executing <code>ps aux | grep tomcat</code>.</li> <li>Stop Tomcat: <code>kill &lt;pid&gt;</cod...
Re-evaluate quality gate in Sonarqube without a new analysis <p>Is there any way to tell Sonarqube to check again if a project passes a quality gate without starting a new analysis? </p> <p>Currently, whenever I change the metrics of a quality gate, I would run a new analysis (obviously with the same result, as there ...
<p>Quality gate compliance is calculated as part of the analysis. No way around that.</p>
$_POST is not working in my script <p>I wanted to create a $_POST function for this URL: /api.php?key=apikey&amp;host=victimip&amp;port=chooseport&amp;time=time&amp;method=udp</p> <p>It does not work and I don't know what's causing this.</p> <p>In index.php I will type in the fields so 'victimip' should be changed, '...
<p>The url you provided is for GET method </p> <pre><code> URL: /api.php?key=apikey&amp;host=victimip&amp;port=chooseport&amp;time=time&amp;method=udp </code></pre> <p>If you want show these value in your input field you should use </p> <pre><code> &lt;body&gt; &lt;form action="action.php" method="post" /&...
Writing to a File in Java using FileWriter <p>I would like to write to a file after a set of characters. For example, if I want to write <code>xyz</code> into a file <code>test.txt</code> which contains string <code>hello world</code>. I want write after the letter <code>w</code>. The output should be <code>hello wxyzo...
<pre><code>public static void main(String[] args) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader(new File("/path/to/test.txt"))); String line; StringBuilder stringBuilder = new StringBuilder(); int offset = 7; while((line = bufferedReader.readLine(...
Limit tablelayout rows, android <p>I was wondering if it's possible to add a limit such as maximum of row/s to the tablelayout? </p> <p>So I can, let's say, insert or show only last 100 instead of entire view. The data is dynamically populated and inserted.</p> <p><strong>Solution</strong></p> <pre><code> int _...
<p>You can check count of rows by <code>getChildCount()</code> method, and add rows only if count is less than 100.</p>
ADALiOS 2.2.5 and 2.2.6 does not work in below iOS 9 <p>In my application I have updated to latest ADALiOS library versions 2.2.6 (tried with 2.2.5 as well) to support for iOS 10 but after updating it stopped working in below iOS 9. If you try to open webview for WAAD login then login screen loads and immediately gets ...
<p>I just tested it on simulator iOS8.1, but things worked.</p> <p>Maybe you can try restarting the simulator as suggested by this? (<a href="http://stackoverflow.com/questions/25797339/nsurlconnection-get-request-returns-1005-the-network-connection-was-lost">NSURLConnection GET request returns -1005, &quot;the networ...
How can I send data between Intel Edison and a mobile device using Ad Hoc or SoftAP? <p>I am working on a project where I need to transfer data between an Intel Edison and a mobile device (hoping for cross platform compatability) without using a router. I have considered Wi-Fi Direct, but this is not available on iOS a...
<p>If you want to use Wifi, SoftAP seems like to be the best option. But if you need a short range connection, you should consider Bluetooth. Since nowadays there are lots of wifi APs around us, the user might be forced to disconnect from his internet-accessing wifi AP to connect to your data network which might be inc...
PHP List files in same directory <p>I'm trying to list files in a folder. I have done this before, so I am not sure why I am having a problem now.</p> <p>I have a PDF files I am trying to display to my web page. The directory structure looks like this:</p> <pre><code>folder1/folder2/displayFiles.php folder1/folder2...
<p>Just use <code>glob</code></p> <p><a href="http://php.net/manual/de/function.glob.php" rel="nofollow">http://php.net/manual/de/function.glob.php</a></p> <pre><code>$pdfs = glob("*.pdf"); // if needed loop through your directorys and glob files print_r($pdfs); </code></pre> <p>Just an example. You should be able t...
Getting multimple results from Ajax post <p>Maybe this is a duplicate but I can not understand why mo code does not work. I am trying to get multiple results via Ajax/php.</p> <p>This is from my php file:</p> <pre><code>$result11 = 'test1' $result22 = 'test2'; echo json_encode(array("data1" =&gt; $result11, "data2" ...
<p>Add a preventDefault() call to your script</p> <pre><code>$(document.body).on('submit','#sendmessagex',function(event) { //----------------------------------------------------^^^^^ event.preventDefault(); var str = $(this).serialize(); $.ajax({ type: "POST", url: "/send.php", ...
Access variables in other file in node.js <p>I want to define a variable in one file called vars.js. then I want to access those variable from another file called mybot.js. this is what I ahve in each file:</p> <p>vars.js: <code>var token = 'abcfgk6'</code></p> <p>mybot.js:</p> <pre><code>var request = require(./var...
<p>You have to export the variable in <code>vars.js</code></p> <pre><code>var token = 'abcfgk6' exports.token = token; </code></pre> <p>And then access via:</p> <pre><code>var request = require(./vars.js); ... bot.login(request.token); </code></pre> <p>Hope it helps!</p>
Should I close the groovy Sql in Grails service <p>I'm using groovy Sql in a Grails project. </p> <pre><code>class MyService{ def sessionFactory def method(){ def sql = new Sql(sessionFactory.currentSession.connection()) def query =... sql.rows(query,...) sql.close() } } </c...
<p>This is not necessary. Please refer to <a href="http://stackoverflow.com/questions/35588115/does-groovy-sql-sql-firstrow-closes-connection-after-execution">Does groovy.sql.Sql.firstRow Closes Connection After Execution?</a></p> <p>Take a look at the link provided in the comments of the question by dmahapatro <a hre...
CGI- Password from HTML won't print <p>We were asked to create a twitter-like program using C, HTML, MySQL and CGI. The first step is creating the login page wherein we would ask the user to enter their username and password. I used CGI x HTML in doing that and here are my programs:</p> <p>HTML:</p> <pre><code>&lt;ht...
<p>For starters I suggest you <em>copy</em> the string you get from <code>getenv</code>. You should never modify the string you get from <code>getenv</code>, and <code>strtok</code> modifies it. </p> <p>Also, when you call <code>strtok</code> the pointer you get is pointing to the beginning of the name in the <code>na...
Cast a kmalloc memory block into multiple structures <p>I have to reserve a large amount of kernel memory (1.5 MB) and share it with the user space. For the short story, I load my kernel module which allocates a large memory buffer in init function using kmalloc, then the user program call ioctl to retrieve the kernel ...
<p>I suppose that the field 'address' of your struct _Menstruct contains the value returned by kmalloc. In this case, this value does'nt have any visibility outside of the kernel space. In the user part, you creates a pointer to short type (km_array1) which points to the kernel address. You will probably have segfault ...