input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
double quotas appearing after json output in PHP array to JSON <p>I have read a question answer at </p>
<p><a href="http://stackoverflow.com/questions/11012695/php-array-to-json-how-to-get-rid-of-some-double-quotes">PHP Array to json, how to get rid of some double quotes?</a></p>
<p>I have same issue but my code is l... | <p>@Simba - Thank you for guide me. Your guides help me to get exact result</p>
<pre><code>$output = json_decode('['.$row['more_info'].']');
$feature = array(
'type' => 'Feature',
'properties' => array(
'score' => "",
'fid' => ""
//Other fields here, end w... |
Using ServiceStack OrmLite to delete rows with condition in other table <p>I have the following tables in the database:</p>
<pre><code>Table C Table B Table A
------- ------- -------
Id Id Id
BId AId
</code></pre>
<p>The BId column is a foreign key to TableB. AId is a foreign key to... | <p>Support for DELETE TABLE JOINS were just recently added to OrmLite and is available from v4.5.1 that's now <a href="https://github.com/ServiceStack/ServiceStack/wiki/MyGet" rel="nofollow">available on MyGet</a>.</p>
|
How to style dialog button in NativeScript? <p>My alerts and dialog buttons are white in color after i have upgraded my NativeScript version to the latest one.
Please help me retrieve its original black color...</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div ... | <p>The solution was found in the comments.</p>
<p>The problem was linked to a <code>CSS</code> property generated for an other button.</p>
<p>This property was also affecting the button in the modal.</p>
<p><strong>Solution</strong></p>
<p>Use another class/id/selector for the modal's button</p>
<p><em>OR</em></p>... |
get dictionary contains in list if key and value exists <p>How to get complete dictionary data inside lists. but first I need to check them if key and value is exists and paired.</p>
<pre><code>test = [{'a': 'hello' , 'b': 'world', 'c': 1},
{'a': 'crawler', 'b': 'space', 'c': 5},
{'a': 'jhon' , 'b':... | <p>Use comprehension:</p>
<pre><code>data = [{'a': 'hello' , 'b': 'world', 'c': 1},
{'a': 'crawler', 'b': 'space', 'c': 5},
{'a': 'jhon' , 'b': 'doe' , 'c': 8}]
print([d for d in data if d["c"] == 8])
# [{'c': 8, 'a': 'jhon', 'b': 'doe'}]
</code></pre>
|
Excel - sum numbers in each cell, that matches the pattern <p>I have a table for capacity management, that contains information about teams working on project in time. I would like to be able to create a new table, that would basically tell me, which team is overloaded. I guess example would explain it better:</p>
<p>... | <p>Create a summary table with the dates in the column headers and the team names in the row headers. Then you can use a SumProduct() formula to calculate the totals per team and date. Refer to the screenshot below.</p>
<p>The formula in cell B13 is</p>
<pre><code>=SUMPRODUCT(($B$1:$H$1=B$12)*($A$2:$A$8=$A13)*$B$2:$H... |
Swift UITableViewCell subview do not register tap <p><strong>Background:</strong> I'm making a calendar and for that I'm combining a UITableView and a UICollectionViews. The UITableView is holding month cells. Each month UITableViewCell is holding a UICollectionView with UICollectionViewCell days.</p>
<p><strong>Probl... | <p>Nested UIScrollView with same scroll directions is against Apple's Human Interface Guidelines and your app might even get rejected for this so try disabling the scroll of your UICollectionView.</p>
<p>Hope this helps.</p>
|
How to call another key from ng-repeat source <p>Pardon me if the question sounds weird. Suppose I have the following object:</p>
<pre><code>// For example purposes, pretend that link gets pushed to $scope.links 5 times.
var link = {
name: "name",
description: "description",
members: [{
memname: "... | <p>Created Snippet for you .</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 myCtrl($scope) {
$scope.links = [{
'name': "name",
'description': "descr... |
Use debounce in setTimeout <p>I'm trying to implement <code>debounce</code> from underscore library within <code>setTimeout</code>. </p>
<pre><code>setInterval(function() {
setTimeout(function(){
_.debounce(function() {
console.log('debounce');
}, 500);
}, 1000);
}, 100);
</code></pre>
<p>Basical... | <p>Are you sure you need function after setTimeout? Because _.debounce is a function itself. I am not sure either )) but code below works for me:setInterval(function() {
setTimeout(
_.debounce(function() {
console.log('debounce');
}, 500)
, 1000);
}, 100);</p>
|
i need to schedule 2 tasks at diffrent times <p>i try to schedule 2 tasks, the first need to done everyday - to check birthdays,
the second task need to be only if today is the first day of the month..</p>
<p>i tried to make 1 schedule that will done everyday at 8:00 am , and when its done to check if its the first da... | <p>Try to store a simple boolean to the <code>SharedPreferences</code> after successfully scheduling so that before you call <code>startTimers()</code> just check with the stored value. Sth like:</p>
<pre><code>public void onCreate(){
if (!isScheduledAlready()) {
startTimers();
}
}
public boolean isScheduled... |
Angular 2 - Waiting for boolean to be true before executing service <p>I have an navigation menu that uses ng2-page-scroll module. </p>
<p>I scroll trough page using hashtag links.</p>
<p>The problem is that if i work cross routes, the data takes some time to load, so the service normally scrolls to my section, than ... | <p>The problem is in your code, in particular in <code>checkIfDataLoaded()</code> method and not because you're working with booleans.</p>
<p>It obviously throws an error when the inner condition resolves to false because then the method returns <code>undefined</code> and therefore calling <code>undefined.then(...</co... |
How to successfully complete this INSERT JOIN WHERE SQL statement? <p>I am looking to insert into table community_players the community_id and player_id from respective tables; 'communities' and 'users' where the following conditions are met:</p>
<p>users.user_email AND communities.admin = 'steve.downs@gmail.com'
AND
... | <p>Should be something like:</p>
<p><code>INSERT INTO community_players (community_id, player_id)
(SELECT communities.community_id, users.user_id
FROM TABLE communities
JOIN TABLE users ON id
WHERE users.user_email = 'steve.downs@gmail.com'
AND communities.admin = 'steve.downs@gmail.com'
AND communities.code = 'HX99f9... |
How to set Actions in aws java sdk for iot rule? <p>I am trying to create a rule using the aws sdk for java (not the standalone aws iot java sdk).</p>
<p>So far I have done these</p>
<pre><code>public class Application extends Controller {
static AWSIotClient awsIotClient;
private static void init() {
... | <p>I finally got it working for me</p>
<pre><code>public static Result index() {
init();
CreateTopicRuleRequest another_test = new CreateTopicRuleRequest();
another_test.setRuleName("test");
TopicRulePayload topicRulePayload = new TopicRulePayload();
topicRulePayload.setDescript... |
Angularfire2 redirect after login <p>i'm using ionic 2 rc0 and angular 2 and i just added angularfire2 to use firebse auth. </p>
<p>I have all configured and tested (I just see my user logged in the firebase console) but i want to redirect to other page after login.</p>
<p>My code for login:</p>
<pre><code>registerU... | <p>AngularFire2 has <code>FirebaseAuth</code>, to which you can subscribe to auth state changes </p>
<p>This is recommended way to handle user auth, because you will subscribe to changes in the auth state, other methods might not work as expected, like when user refreshes the page user object might not exist.</p>
<pr... |
Find report file outside of Application.StartupPath or bin folder <p>My Crystal Report is located outside of <code>Application.StartupPath</code> and the bin folder - in a tree folder:</p>
<pre><code>MainFolder
- CrystalReport_here_which_is_Sales_report.rpt
bin 'folder
- DebugFolder
- inside debug folder is th... | <p>You can solve your problem with a relative path (code in vb.net) :</p>
<pre><code>Dim CRPath as String = System.IO.Path.GetDirectoryName(Application.StartupPath) & "\..\..\MainFolder\"
rpt.Load(CRPath & "Sales_Report.rpt")
</code></pre>
|
S3 client.GetObject behaviour if read beyond fileSize <p>I need to read a file from S3 in blocks.
I am using the following code : </p>
<pre><code>GetObjectRequest request = new GetObjectRequest(bucketName, filePath);
rangeObjectRequest.setRange(startOffset, startOffset + length - 1);
S3Object objectPortion = s3Client.... | <p>The underlying API returns an error, so the library should throw an <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/AmazonServiceException.html" rel="nofollow">exception</a> with an <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/AmazonServiceException.html#get... |
How can I highlight the text In the textbox? <p>The code for text area.</p>
<pre><code><div>
<textarea id="ta" onpaste="functionFind(event)"></textarea>
</div>
</code></pre>
<p>The function that will be executed</p>
<pre><code>function functionFind(pasteEvent)
{
var textareacont... | <p>You can't actually render markup inside a textarea. However, you can fake it by </p>
<ul>
<li>carefully positioning a div behind the textarea</li>
<li>Keep the div's inner HTML same as of textarea</li>
<li>Add your highlight markup to the div</li>
</ul>
<p>For example: </p>
<pre><code><div class="container">... |
fill input fields with json data then sent to the printer <p>i want to fill input fields with data from json and then sent it to the printer and then again to fill inputs from last row -1 in db then sent to the printer and then last row -2 then print it etc.. I have managed to return the json data from last n insered r... | <p>i have found the solution </p>
<pre><code> for(i=0; i<data.added[0].printmultiple; i++){
$('#barcodecountry2').val(data.added[i].signintime);
$('#barcodesurname').val(data.added[i].customid); //get id
$('#barcodename').val(data.added[i]... |
How to remove a swift 2 array element is not at index <p>How to remove a swift 2 array element is not at index</p>
<p><a href="https://i.stack.imgur.com/zzCzW.png" rel="nofollow">picture</a></p>
<p><a href="https://i.stack.imgur.com/p58Vf.png" rel="nofollow">picture</a></p>
| <p>First of all please post the code rather than screenshots. Nobody who is willing to help is also willing to retype the code for testing.</p>
<p>The index variable <code>i</code> in the loop is a <code>Storable</code> object, not an <code>Int</code> index, that's exactly what the error message says.</p>
<p>Using <c... |
Fatal error: Function name must be a string with Anonymous function <p>I am finding myself in a bit of a problem.
I have two anonymous functions and one calls the other.
But when the function <code>$fCompleteDate</code> is called within the function <code>$fFindAndCreateDate</code> </p>
<p>I get the fatal error of: <... | <p>I see that you use Anonymous functions so I updated my answer.</p>
<p>You need to specify that the second function use the first one like this:</p>
<pre><code>$fFindAndCreateDate = function($aStruct) use ($fCompleteDate) {
....
}
</code></pre>
|
creating a login page but button click doesn't show any data or error messages <p><strong>when i click on the submit button it doesn't show any error and does not respond with any message.after a click it only reload itself and doesn't show any data. please reply me with the error.</strong></p>
<pre><code><?php
$se... | <p>There is a <code><form></code> Tag missing</p>
<pre><code><body>
<form action="#" method="post">
<tr>
<td>Username:</td>
<td>
<input type="text" name="user" value="" />
</td>
</tr>
<br />
<br />
&... |
Getting only 10 rows in Solr Cassandra search <p>I am working on Datastax Cassandra with Apache Solr for multiple partial search.
Issue is, everytime I am getting only 10 rows even once I am doing count(*) query, I am able to check there are 1300 rows belong to particular query.</p>
<pre><code>nandan@cqlsh:testo> ... | <p>I don't think it should be managed from the schema. The query has a <code>rows</code> and a <code>start</code> parameter. Use those: rows defines the max number of items to return, start defines the first item in the list to return:</p>
<pre><code>q=isd:9*&rows=22&start=17&wt=json
</code></pre>
<p><cod... |
Regarding word search error (Encoding error Java) <p>I have a list of french words where I am trying to search in my database. The words are "thé Mariage frères", "thé Lipton" etc.
While I am reading my file in java, it shows the words as "thé Lipton", "thé Mariage frères". It fails to get the correct words... | <p>You file is in one encoding (maybe latin1/iso-8859-1) and you're reading your file in another encoding.</p>
<p>See if this port helps <a href="http://stackoverflow.com/questions/12096844/how-to-read-a-file-in-java-with-specific-character-encoding">How to read a file in Java with specific character encoding?</a></p... |
Custom tableview cell multiple rows <p><a href="https://i.stack.imgur.com/jVspI.png" rel="nofollow"><img src="https://i.stack.imgur.com/jVspI.png" alt="This is samole image"></a>
This is my json data. Here it is Restaurant name coming one and line name coming 2 some times line name coming more then how to print the dat... | <p>Use your restaurant array for section</p>
<pre><code>numberOfSectionsInTableView{}
</code></pre>
<p>and your <code>"lines": [{}]</code> array for</p>
<pre><code>numberOfRowsInSection{}
</code></pre>
<p>You may get better idea from code mentioned below</p>
<pre><code>- (NSInteger)numberOfSectionsInTableView:(UIT... |
400 Bad Request with spring REST <p>I have spring rest service such this</p>
<pre><code>@RequestMapping(method = RequestMethod.POST,
path = "/getdata", consumes = {"multipart/form-data"}, produces = MediaType.APPLICATION_JSON)
public
@ResponseBody
Result getBarcode(@RequestParam("text") String sl,
... | <p>Set your file like this.</p>
<pre><code> map.add("imageFile", new FileSystemResource(new File("...path to file...")));
</code></pre>
<p>or like this</p>
<pre><code>map.add("imageFile", new ClassPathResource("...path to file..."));
</code></pre>
|
Lock-free programming: reordering and memory order semantics <p>I am trying to find my feet in lock-free programming. Having read different explanations for memory ordering semantics, I would like to clear up what possible reordering may happen. As far as I understood, instructions may be reordered by the compiler (due... | <p>For #1, compiler may issue the store to y before the load from x (there are no dependencies), and even if it doesn't, the load from x can be delayed at cpu/memory level.</p>
<p>For #2, p2 would be nonzero, but neither *p2 nor data would necessarily have a meaningful value. </p>
<p>For #3 there is only one act of p... |
Optimization of an algorithm using apply inestead of two fors in R <p>I've got a following problem:</p>
<p>I want to reorganise my table from:</p>
<pre><code>df <- data.frame(A=c(1,0,1), B=c(1,0,1), C=c(0,1,1))
A B C
x 1 1 0
y 0 0 1
z 1 1 1
</code></pre>
<p>Into a frame:</p>
<pre><code> AB AC BC
x ... | <p>This will work using a combination of lapply and dplyr.
It makes a list of the product of the columns, which is then bound into a single dataframe.</p>
<pre><code>library(dplyr)
lapply(1:(ncol(df)-1), function(n){
out <- df[,n] * df
names(out) <- paste0(names(df)[n] ,names(df))
out %>% select(c((n+... |
why is cassandra not getting connected to server? <p>I have installed cassandra and worked on it. It worked properly. Now, it is showing as-</p>
<p><code>localhost/<> is in use by another process. Change listen_address:storage_port in cassandra.yaml to values that do not conflict with other services
Fatal confi... | <p>Your localhost is already in use. Follow the following steps-</p>
<p><code>$ jps</code></p>
<p>You see some processes running. For example:</p>
<p><code>9107 Jps
1112 CassandraDaemon</code></p>
<p>Then kill the <code>CassandraDaemon</code> process by the process id you see after executing <code>jps</code>. In my... |
NetworkX: how to properly create a dictionary of edge lengths? <p>Say I have a regular grid network made of <code>10x10</code> nodes which I create like this:</p>
<pre><code>import networkx as nx
from pylab import *
import matplotlib.pyplot as plt
%pylab inline
ncols=10
N=10 #Nodes per side
G=nx.grid_2d_graph(N,N)
... | <p>There is a lot going wrong in the last line, first and foremost that G.edges() is an iterator and not a valid dictionary key, and secondly, that G.edges() really just yields the edges, not the positions of the nodes.</p>
<p>This is what you want instead: </p>
<pre><code>lengths = dict()
for source, target in G.edg... |
How to fix element p size <p>I'm working in one html/js apps similar to powerpoint, so the apps leave you create slider and show them in any type of screen (they are big screen but with not that many pixel, example one screen make 128x90 [px], the screen make 2x1 [metters])</p>
<p>At the creation process the people ca... | <p>You have try to use a Normalize.css file? the browser some time add part of code that you don't need, maybe something like <code>p{font-size:110%}</code> or <code>spam{font-size:110%}</code> Also could be that are inside your normalize part.</p>
|
Timer.start() unexpectedly? <pre><code>private void PlayerClockInPanelControl_Load(object sender, EventArgs e)
{
InitializedMouseDownEvent();
}
private void InitializedMouseDownEvent()
{
aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer... | <p>You get this behaviour because there is no difference between <code>timer.Start()</code> and <code>timer.Enabled = true</code> (and also <code>timer.Stop()</code> and <code>timer.Enabled = false</code>). For this reason if you call <code>timer.Enabled = tru</code>e in your <code>formLoad</code> you start the timer.<... |
Rest API automation using Rest Assured framework for dot net <p>I have used rest-assured framework for rest api automation testing using JAVA But now I have to develop automation code using dot net. Can I use the same framework for dot net also? If can't, please suggest some frameworks for rest api automation testing?<... | <p>Yes, you can test .Net REST api using a java framework. You are simplt testing the operations and the responses to those operations, the language of the testing framework can be anything you desire.</p>
|
Even/Odd Numbers in Arm <p>I am trying to write an ARM program that counts the number of odd numbers written in a .txt file and sums the amount of even numbers.</p>
<p>I understand that the least significant binary digit(Z Bit) signifies whether a number is odd or even. </p>
<p>My question is which instruction(s) can... | <p>The Z bit is a condition code bit which is true if the value the conditions codes were set from is "Zero". You can set the condition codes with (for example):</p>
<pre><code>tst r1,#1
</code></pre>
<p>Then the Z bit will be set if the number is even, and clear if it is odd. You can then use conditional execution... |
git remove directory with special char ( symbol) in it <p>got this directories:</p>
<ul>
<li>main%F0java </li>
<li>main%F0res</li>
</ul>
<p>created for any reason (i guess android studio is to blame) and committed it on a rush. the fact is thath %F0 is the  symbol so when i go to commit/remove via termina... | <p>removing and committing via the console (not with sourcetree) seemed to work. thanks to Issam</p>
|
Can't bind to 'control' since it isn't a known property of (myComponent) <p>this is my app.module.ts</p>
<pre><code>import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
/... | <p>The component needs to be registered with an <code>@NgModule()</code></p>
<pre><code>declarations: [ AppComponent, ErrorMessageComponent ],
</code></pre>
|
How to filter data without repeat values in mongodb with java <p>I'm trying to get data from mongoDB without repeat values. I want to filter following data</p>
<pre><code>{"page":"www.abc.com","impressions":1,"position":144}
{"page":"www.abc.com","impressions":1,"position":8}
{"page":"www.xyz.com","impressions":7,"pos... | <p>You should be able to run an aggregation pipeline that groups the documents by the <code>page</code> field using the <strong><a href="https://docs.mongodb.com/manual/reference/operator/aggregation/group/" rel="nofollow"><code>$group</code></a></strong> pipeline operator, get a count of the documents using the <stron... |
How to use Glide with dagger2 <p>I am developing a music application. I want to load artist's image from LastFM so i do this this way
1. I created a class <code>ArtistImageLoader extends BaseGlideUrlLoader</code>.
2. In the <code>getUrl</code> method i used retrofit2 to get the artist's image url from LastFM via <a hr... | <p>My assumption is that your ArtistImageLoader is defined in an separate class. The reason for the your problem is the way dagger works. It only injects fields annotated with <code>@Inject</code> on the class you specified as parameter of the inject method. Therefore nothing inside your <code>ArtistImageLoader</code> ... |
Get the size of heap and stack per process in linux <p>I wanted to know the size of heap and stack per process in linux. Is there any way to find it?</p>
<p>I found out that sbrk(0) will give me the end of heap. But how can I find the start of heap to get the heap size?</p>
<p>Also on stack size is there any way to f... | <p>On Linux, you can read <code>/proc/[PID]/maps</code> and find <code>[heap]</code> and <code>[stack]</code> entries.</p>
<p>But for the GLIBC heap implementations usually used on Linux, the "heap" consists of both memory obtained via <code>sbrk()</code> that shows up in the <code>/proc/[PID]/maps</code> file as <cod... |
Cassandra stopped working after nodetool repair <p>After running "nodetool repair" command cassandra node gone down and did not start again.</p>
<pre><code>INFO [main] 2016-10-19 12:44:50,244 ColumnFamilyStore.java:405 - Initializing system_schema.aggregates
INFO [main] 2016-10-19 12:44:50,247 ColumnFamilyStore.java... | <p>Turned on the node and it's fine. It took too long to start (more than 30 minutes).</p>
<pre><code>INFO [main] 2016-10-19 15:32:48,348 ColumnFamilyStore.java:405 - Initializing system_schema.indexes
INFO [main] 2016-10-19 15:32:48,354 ViewManager.java:139 - Not submitting build tasks for views in keyspace system_... |
Setup node https server using SSL certificate from GoDaddy <p>Earlier i used a self signed certificate and created a https server on node js using</p>
<pre><code>var privateKey = fs.readFileSync( 'key.pem' );
var certificate = fs.readFileSync( 'cert.pem' );
var app = express();
https.createServer({
key: privateK... | <p><code>d752ec439hdwudbdh7.crt</code> is your site's certificate generated by GoDaddy. It corresponds to your <code>cert.pem</code> file. As the format of the file provided by GoDaddy is actually PEM (base64 encoded data beginning with the <code>----BEGIN</code> text), you can use it as it is without having to convert... |
How to alert when last cat show full image? <p>How to alert when last cat show full image ?</p>
<p>When you click <code>Click HERE</code> cat image will slide, i want to apply my code for alert when display last cat full image (in this cast when click 3 time)</p>
<p>But please do not to count click. because i have to... | <p>One solution is to use jQuery and Viewport-plugin. The plugin ads couple of new pseudo selectors. For example you can check any element is inside or outside of viewport. A little snippet:</p>
<pre><code>if($("#lastChild").is(":in-viewport"))
{
alert("hhh");
}
</code></pre>
<p>See here for more informations: <a h... |
.bashrc function with arguments <p>I often use the following command to merge PDFs:</p>
<pre><code>gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=output_name.pdf /location/of/plots/*.pdf
</code></pre>
<p>I tried setting up an equivalent function in my .bashrc file:</p>
<pre><code>func... | <p>The following function works fine for me:</p>
<pre><code>pdf_merge() {
output=$1
shift
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="$output" "$@"
}
</code></pre>
|
What kind of iterators supports random access but not contiguous storage in C++? <p>I saw that there is a new iterator since C++17,below listed by a screenshot in cppreference. I was a lot confused. What kind of iterators is random access but not contiguous storage in C++?? otherwise, the ContiguousIterator is not pow... | <p>One non-contiguous container with random-access iterators is <a href="http://en.cppreference.com/w/cpp/container/deque" rel="nofollow"><code>std::deque</code></a>. Quoting the cppreference site:</p>
<blockquote>
<p>As opposed to <code>std::vector</code>, the elements of a deque are not stored contiguously: typica... |
Why cant I format date to d-m-Y using CakePHP's accessor <p>I got a problem with accessor on single record/get.</p>
<p>I have date record with value '2015-10-10'.</p>
<pre><code> //PatientsController.php
$record = $patients->find()->first();
debug($record->dob);die;
//would print 19-10-2016 (t... | <p>You may be putting <strong>dd-MM-YYY</strong> it should be <strong>dd-MM-yyyy</strong>
Then your code should be </p>
<pre><code>public function findPatients($query, $options) {
return $query->formatResults(function($results) {
return $results->map(function($row) {
$tgl = ne... |
Error: You have written a subquery that can return more than one field without using the EXIST reserved word <p>I get the following error when I run the query.</p>
<blockquote>
<p>You have written a subquery that can return more that one field without using the EXIST reserved word in the main query's FROM clause. R... | <p>You could use <code>UNION</code>:</p>
<pre><code>sql = "SELECT * FROM ("
+ " SELECT * FROM Data WHERE ProductDate = '" + yesterday + "' AND EndTime > '" + endTime + "' "
+ " UNION"
+ " SELECT * FROM Data WHERE ProductDate = '" + todayDate + "' AND EndTime = '" + endTime + "' "
+ ")";
</code... |
Codeigniter DB escape and like <p>I use CI 3, and I have a problem using escape and like clause. Here is my code :</p>
<pre><code>$where = '(a.title LIKE \'%'. $this->db->escape($name) .'%\' OR agi.senior_artist LIKE \'%'. $this->db->escape($name) .'%\')'
</code></pre>
<p>The problem is <code>$this->db... | <p>You need to use</p>
<pre><code>$this->db->escape_like_str()
</code></pre>
<p>instead</p>
<pre><code>$this->db->escape()
</code></pre>
<p>when you use LIKE conditions</p>
<p><a href="https://www.codeigniter.com/userguide3/database/queries.html" rel="nofollow">Read more</a></p>
|
Redirection in reactjs <p>I have a problem which i couldn't solve it for a while. I have mvc application which will render a login page upon successful login i have to redirect to a particular page.</p>
<p>The login authentication is done by Api controller which will give me a json bit on successful authentication.I h... | <p>So basically you just add the router to the class through context, e.g.:</p>
<pre><code>...
contextTypes: {
router: React.PropTypes.object.isRequired
}
...
</code></pre>
<p>and then if the condition is correct</p>
<pre><code>if (successCondition) {
this.context.router.push('stateName');
}
</code></pre>
<p>... |
I have a fragment that resets and displays a blank page instead of the views <p>I have a side drawer for navigation between my different fragments, find code below.</p>
<pre><code> public boolean onNavigationItemSelected(MenuItem item)
{
// Handle navigation view item clicks here.
int id = item.get... | <p>You need to add addToBackStack() method.</p>
<p>i.e</p>
<p>FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.root_view,new TimeChanging()).<strong>addToBackStack</strong>(new TimeChanging().getClass().getName()).commit();</p>
<p>And when... |
Need to match the repeated words and replace it with a new one using regex <p>I was trying to match a pattern from the below line in linux,</p>
<pre><code>$(menu_no),ini_question3.vox,inv_question3.vox,inv_question3.vox,ini_question3.vox,to_question3.vox
</code></pre>
<p>From the above line i need to find the repeate... | <p>I'm not sure what you want to replace, but if you want to match duplicate string <code>inv_question3.vox</code>, you can try:</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"><c... |
nested ng-repeat that one depend on the other <p>I have an issue with angular, I want to use two nested ng-repeat in a data table where the first get the data, and the second get the name of field to be retrieved from the data (retrieved in the first ng-repeat) <br>
here is what I tried to do with code :<br></p>
<pre ... | <p>use <code>toString()</code> to retireve the scope data in an scope object.</p>
<pre><code><tr md-row ng-repeat="item in items">
<td md-cell ng-repeat="field in fields" >
{{item[field.toString()]}}
</td>
</tr>
</code></pre>
<p><a href="https://plnkr.co/edit/NDcmPG7RFvpNTtv8p4... |
retrieving multiple JSON files with jquery <p>I want to retrieve data from multiple json files.I am able to append data to the table from one of the json file. But when I wanted to pull the data from multiple json files it wont work. My code is:</p>
<pre><code>var uri = 'sharepointmodel.json';
var uri2 = 'navisioncust... | <p>Both of your function names are same, find(). That's why just one function is getting called and your data is getting appended from only one file.</p>
<p>Either have different function names or have one function and pass uri variable to it e.g.</p>
<pre><code> function find(json_uri) {
var info = $('#KUNDE').... |
Frequency tables by groups with weighted data in R <p>I wish to calculate two kind of frequency tables by groups with weighted data. </p>
<p>You can generate reproducible data with the following code :</p>
<pre><code>Data <- data.frame(
country = sample(c("France", "USA", "UK"), 100, replace = TRUE),
mig... | <p>You could do this by: making a function with the code you've already written; using <code>lapply</code> to iterate that function over all years in your data; then using <code>Reduce</code> and <code>merge</code> to collapse the resulting list into one data frame. Like this:</p>
<pre><code># let's make your code int... |
python @property not overwrite class attribute <p>I'm confused with the class attribute. I understand that Python interpreter will search attr inside <code>cls.__dict_</code> (object attribute) first, If the attribute doesn't exists, it will looking for at class attributes. But in that case I dont know why the result b... | <p>This isn't about <code>property</code>, but about the behaviour of attributes prefixed with <code>__</code>. This triggers name mangling, which is almost never what you want and behaves unexpectedly in an inheritance scenario. Don't use it.</p>
|
Random crash on capturing image on lower android versions <p>In my application i capture image from camera, on marshmallow it works fine, but on lower version it gives random crash. Sometimes it works fine, sometimes it not . Here is code which i am using in my app</p>
<pre><code> String timeStamp = new SimpleD... | <blockquote>
<p>This is because app gets restarted and its path gets null value because path is set only when i open camera</p>
</blockquote>
<p>Most likely, your process is being terminated while it is in the background. <a href="https://developer.android.com/guide/components/processes-and-threads.html#Lifecycle" r... |
Decompile unity coroutine(ienumerator) correctly <p>I'm creating game with unity, I found my old game that project was deleted, and wanna get full C# code from there.
I've used ILSpy to decompile to get it, everything was decompiled fine except coroutine(ienumerator). It decompile like C__Iterator, not correctly.(I've ... | <p>No, there is no application that will decompile correctly the <code>IEnumerator</code> because this statement is syntactic sugar. This means that when the compiler find an iterator block it transalte the block iterator in something more complex that the disassembler is not able to reconstruct in the original way.</p... |
How to disable location service programmatically in iOS? <p>I have the following:</p>
<pre><code>class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
...
let locationManager = CLLocationManager()
func application(_ application: UIApplication, didFinishLaunchingWithOptions lau... | <p>In your plist file, you must make sure the location row is <code>Privacy - LocationWhenInUseUsageDescription</code> not <code>Privacy - LocationAlwaysUsageDescription</code> </p>
|
Problems with focus() in an input radio in Firefox <p>I have discovered a problem in Firefox when you try to make focus in an input radio. It doesn't make focus in the input, unless you previously use tab to focus on the input before. After that it works correctly. Does anyone know how to solve it? Thank in advance!</p... | <p>It is working for me in Firefox (v47.0 and v47.0.1). The only thing is not highlighting it... But if you add some CSS like the following, you will see how it is working fine:</p>
<p><code>input#myRadio:focus {
outline: 7px solid yellow;
}</code></p>
|
How to handle exception like download failed or invalid URL link or internet failure using TDownLoadURL? <p>I have an VCL app containing an object TDownloadUrl (VCL.ExtActns) used to download applications, my question is how to handle any kind of exception that restrict to download [for example:- like download failed o... | <p><code>TDownloadURL</code> only defines 2 error messages, which are both declared in the <code>Vcl.Consts</code> unit:</p>
<ul>
<li><p><code>SUrlMonDllMissing</code>, which is raised when the Win32 <a href="https://msdn.microsoft.com/en-us/library/ms775123.aspx" rel="nofollow"><code>URLDownloadToFile()</code></a> fu... |
Hosted static website in AWS <p>I need help with AWS Host to website. </p>
<p>I hosted my static site following the AWS recomendations. (using S3-bucket, Route-S3).</p>
<p>However, in my site after my domain is appears ".s3-website-sa-east-1.amazonaws.com".
How to do for not appears this after my domain?</p>
| <p>You need to create an Amazon route53 entry as detailed here:</p>
<p><a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html#root-domain-walkthrough-switch-to-route53-as-dnsprovider" rel="nofollow">http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-do... |
IF Statement in eBay API <p>I have a PHP code to use eBay API to get 5 results by keyword. </p>
<p>I want to add an IF condition to show a headline <code><h2>List of products</h2></code> only if there are results.</p>
<pre><code> // Check to see if the request was successful, else print an error
if ($r... | <pre><code>// Check to see if the request was successful, else print an error
if ($resp->ack == "Success") {
$results = '';
// If the response was loaded, parse it and build links
foreach($resp->searchResult->item as $item) {
$pic = $item->galleryPlusPictureURL;
$link = $it... |
Smarty Template date_format gives unpredictable results <p>I am passing a timestamp into a Smarty Template, and using <code>date_format</code> gives unpredictable results. Here's an example template that demonstrates the problem most elegantly:</p>
<pre><code>{"1456602208"}
{"1456602208"|date_format}
{"1432808316"}
{"... | <p>The best way to avoid this is to cast to <code>int</code> the timestamp. Now it's a numeric <code>string</code>.</p>
<p>Smarty did some changes in 2.6.10 to use all numeric input values as timestamp, but before was not always the case. </p>
<p>As I can see the first timestamp ends in <code>2208</code> and also the... |
Count blanks row by row <p>I need an auto-expanding formula to count blank cells in each row, as long as there are values in <code>B</code>. I've tried <code>=ARRAYFORMULA(IF(ISBLANK(B2:B),IFERROR(1/0),COUNTBLANK(E2:2)))</code> and thereby managed the expansion, but it keeps counting <code>E2:2</code> and not the actua... | <p>Try something like this</p>
<pre><code>=ArrayFormula(IF(LEN(B2:B100),MMULT(N(ISBLANK(B2:100)), TRANSPOSE(column(B2:2)^0)),))
</code></pre>
<p>Change range to suit. </p>
|
File path when working with One Drive for Buisiness <p>I have a MS Word Add-In that works with a file located in the local synchronized area of One Drive for Business.</p>
<p>I create the file at C:..\OneDrive..\MyDir\File.docx
Some point later I create a FileInfo object:</p>
<pre><code>var file = new FileInfo(doc.Fu... | <p>Word can open both local files and cloud files. When the latest OneDrive sync client is installed and you open a local file that's sync'd to the cloud, Word will discover its cloud URL and prefer using that, because it lights up cloud-based features like coauthoring. If it's possible for your plugin to be tweaked to... |
How to make expandable div to show first element and toggle rest <p>I have few sections on my webpage with different type of news stories. Some with images, some without (just text). I want be able to display the first paragraph or first div of each story and then on click toggle the whole content of the div (story). <... | <p>You need to have <code>toggle</code> button for each element.</p>
<pre><code>//Hide all content
$('.content').hide();
$('.archive').click(function(){
//Get content DIV
var content = $(this).parent('.news').find('.content');
//Content toggle
content.toggle();
//Show / Hide adjusted
$(this).text(content.i... |
Facing crash in samsung galaxy note 7 <p>Facing crash on galaxy note 7</p>
<p><code>Caused by android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 2062): , while compiling: PRAGMA journal_mode ################################################################# Error Code : 2062 (SQ... | <p>You have opened too many files.</p>
<p>Your code forgets to close all its database objects, or other files.</p>
|
for /f %%I was unexpected at this time <p>I'm trying to write a script to copy the latest file.
I got this command from the net:</p>
<pre><code>FOR /F "delims=|" %%I IN ('DIR "X:\Dirs\*.rar" /B /O:D') DO SET NewestFile=%%I
copy "%NewestFile%" "J:\Personal\Gastos\dirs"
</code></pre>
<p>It outputs an error:</p>
<bloc... | <p>Try this in a batch file:</p>
<pre class="lang-bat prettyprint-override"><code>@ECHO OFF
(SET SrcDir=X:\Dirs)
IF /I "%CD%" NEQ "%SrcDir%" PUSHD "%SrcDir%"
SET "NewestFile="
FOR /F "DELIMS=" %%I IN ('DIR/B/OD *.rar') DO SET "NewestFile=%%I"
IF DEFINED NewestFile (IF EXIST "J:\Personal\Gastos\dirs\" (
COPY "%... |
How to set ios App push notfication sound with custom tone in Objective C? <p>In My App I need notification other than default, how it possible? I have try many code but i didn't get success. Notification send from Php.</p>
| <p>When you are sending a payload of pushnotification. You have to mention sound file name. </p>
<p>What ever sound you want to play, you have to add that file in project directory. Mention this file name on payload of push notification. Your sound is playing when push notification is receive. </p>
<pre><code>{
"a... |
Find a Twitter mention using Regex in Java (with a twist) <p>I need to create a regex pattern to find mentions in a class called Tweets.
In this case, the valid characters after the '@' are: (A-Z or a-z), digits, underscore ("_"), or hyphen ("-").
The difference with classic Twitter usernames is that pattern should all... | <p>Adding positive lookahead to the end of original regex should help:</p>
<p>(?<=^|(?<=[^a-zA-Z0-9-<em>\.]))@[A-Za-z0-9</em>-]+<strong>(?=[^a-zA-Z0-9-_\.])</strong></p>
|
Why do I get a multilevel array? <p>I need an array with a list of names so I simply get them from the database, but when I printed the array I noticed it stores every name into a seperate array. Why is that, and how can I just store them in one?</p>
<p>My code:</p>
<pre><code><?
// Product names
$producten ... | <p>Because <code>fetch_array</code> will return both the assoc name of the column and the numeric index.</p>
<p>If you want only the name of the column you should use: <code>fetch_assoc</code> or if you want only numeric you should use <code>fetch_row</code></p>
<p><code>fetch_array</code> is a combination of both <c... |
Do I need to extend FirebaseInstanceIdService to subscribe to FCM Topics? <p>I want to manage topic subscription from the client (android app). I am currently doing it at activity onCreate(). I am wondering if the right way is to subscribe / unsubscribe at InstanceIdService::onTokenRefresh() or at any time convenient (... | <p>As you already know, <code>FirebaseInstanceId</code> is probably a singleton class, where you retrieve your registration token. So I think the <code>subscribeToTopic()</code> method, since only the name of the topic is passed, you can presume that it already calls an instance of the <code>FirebaseInstanceId</code> i... |
Create object with code in VB6 <p>i have a program in Visual Basic 6, and i need create a button in my program with code.</p>
<p>I write this code:</p>
<pre><code>private sub Pulso_click()
dim boton as CommandButton
set boton = new CommandButton
boton.width = 100
boton.height = 30
boton.caption = ... | <p>This code works for me</p>
<pre><code> Option Explicit
'
Dim WithEvents Cmd1 As CommandButton
'
Private Sub Form_Load()
Set Cmd1 = Controls.Add("vb.commandbutton", "Cmd1")
Cmd1.Width = 2000
Cmd1.Top = Me.Height / 2 - Cmd1.Height / 2 - 100
Cmd1.Left = Me.Width / 2 - Cmd1.Width / 2 - 100
Cmd1.Caption = "Dyn... |
PowerShell winforms Tab selected index changed event <p>I have designed the GUI using WinForms in PowerShell as follows</p>
<pre><code>Add-Type -Assembly 'System.Windows.Forms'
$form = New-Object Windows.Forms.Form
$TabControl = New-Object System.Windows.Forms.TabControl
$tabPage1 = New-Object System.Windows.Forms.... | <p>Figured it out this is how I need to add the event</p>
<p>instead of this</p>
<pre><code>TabControl.SelectedIndexChanged($TabControl_SelectedIndexChanged)
$TabControl_SelectedIndexChanged
{
({$selectedTab = $TabControl.SelectedTab;
[System.Windows.Forms.MessageBox]::Show($selectedTab)})
}
$TabControl.Ad... |
Eclipse library jar files in Android studio <p><a href="https://i.stack.imgur.com/K0c8H.png" rel="nofollow">image here</a></p>
<p>In the picture you can see the libs folder and it contans two sub folders and a jar file named unity classes. I want to merge this project with my android studio project so in this case i w... | <p>I found the answer finally. Its simple and i just have to add this line</p>
<pre><code>dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
</code></pre>
|
Pandas Create Column with Groupby and Sum with additional condition <p>I'm trying to add a new column in pandas DataFrame after grouping and with additional conditions </p>
<pre><code>df = pd.DataFrame({
'A' :[4,5,7,8,2,3,5,2,1,1,4,4,2,4,5,1,3,9,7,9],
'B' :[9,5,7,8,3,3,5,2,1,1,4,4,2,4,5,1,3,5,7,9],
'... | <p>You can add <a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing" rel="nofollow"><code>boolean indexing</code></a>:</p>
<pre><code>mask = df['D'] == 1
df1 = df[mask].join(df[mask].groupby(['A'])['C'].sum(), on='A', rsuffix='_inward')
print (df1)
A B C D C_inward
0 4 9 9 ... |
Can someone explaint what this code do? <p>I'm trying to figure out what this code but no luck. I need some explanations</p>
<pre><code>signed char c = '0';
for(; c > 0; c++);
printf("%d", c);
</code></pre>
<p>output is -128, when I change the sign to "less then" output is 48, why?</p>
| <p><a href="http://www.asciitable.com/" rel="nofollow">http://www.asciitable.com/</a></p>
<p>The character <code>'0'</code> has the numerical value 48.</p>
<p>You count this up until your value is below 0 so in a <code>signed char</code> that happens on overflow to -128. edit:(this is undefined behavior, but the comm... |
How to check key value is exist in an array using PHP <p>I need one help. I need to check some key value is exist in an array using PHP. I am explaining my code below.</p>
<pre><code>$comment = json_encode(array(array('day_id' => '1', 'comment' => 'vodka0'),array('day_id' => '', 'comment' => ''), array('da... | <p>Use <a href="http://php.net/manual/en/function.array-column.php" rel="nofollow"><code>array_column</code></a> and <a href="http://php.net/manual/en/function.array-filter.php" rel="nofollow"><code>array_filter</code></a> to check this:</p>
<pre><code>// extract all day_id columns
$dayId = array_column($arrComment, '... |
How to change viewBox to center an element in svg <p>I have a svg map which contains a bunch of circles, on click on a circle I want to make the circle the center of the canvas. I am using <strong>RaphaelJS</strong> to work with svg.</p>
<p>I have tried <code>paper.setViewBox(width / 2 - cx, height / 2 - cy, width, he... | <p>Your calculations look wrong to me. I would expect it to be:</p>
<pre><code>paper.setViewBox(cx - width / 2, cy - height / 2, width, height, true)
</code></pre>
|
Method with same name and different return type is achieved in c# but not in java <p>I am new to JAVA environment, am facing issue while trying to implement method with same name and different return type. In C# I have used method hiding concept to achieve this. Is there any better way to implement the same in JAVA. Pl... | <p>In Java methods are identified by there method descriptor: the method descriptor consists of class and method name as well as the type of the method parameters, but the return type is not part of the method descriptor!</p>
<p>So in Java you can not have two methods with same name, same parameters (but different ret... |
Execute shell script from scala aplication <p>I want to execute the sh file from scala application,
Lets say i have createPassword.sh file , I need to invoke this sh file from scala application and get the output back.</p>
<p>How can i achieve through scala application ?</p>
| <p>This should do the trick if the script is in the current working directory (otherwise specify the full path of the script)</p>
<pre><code>import sys.process._
val result = "./createPassword.sh" !!
</code></pre>
<p><code>result</code> is then a String containing the standard output (and standard error)</p>
<p>EDIT... |
how to load a component programatically to one div in angular 2 <p>i am very new to angular 2,
i have some set of dynamically created divs i want to load per-defined components to those div based on user selection. i tried many blogs to load component dynamically but none of them are clear and simple. </p>
<p>what i'... | <p>Define a html component using # inside template</p>
<pre><code><div #container ></div>
</code></pre>
<p>Now you can access this container inside the component class</p>
<pre><code>this.container.innerHTML="YOUR CONTENT";
</code></pre>
|
How to mock Spring Message Resource inside another Mock class with Mockito? <p>In my test when I assert de exception message I'm getting <code>null</code></p>
<p>I'm not getting mock the message inside Service.... :(</p>
<p>I have:</p>
<p>My test:</p>
<pre><code>@RunWith(MockitoJUnitRunner.class)
public class Servi... | <p>It is hard tell for sure, without knowledge about the interface of <code>Message</code>, but it is easy to spot that you configure mock object to stub method with signature <code>getMessage(String, List)</code>:</p>
<pre><code>when(message.getMessage(eq(REQUIRED_FIELD), any(List.class))).thenReturn(REQUIRED_FIELD);... |
XMPPError: bad-request - modify error create new user using smack library 4.1.8 and openfire <p>i have been developing a chat application using smack client library 4.1.8 and xmpp server(openfire server) but while trying to create new user using Accountmanger class it raises and exception "XMPPError: bad-request - modi... | <p>You need to set properly Service Name. You can chek your serviceName in Openfire through admin panel (127.0.0.1:9090) it's in first page in middle of the page, look for "Server Name" after login.</p>
<p>By default it's your machine name.</p>
<p>However your code will run just once: 2nd time AccountManger will thro... |
redirect .htaccess - remove last part of url <p>I need redirect url like: <strong>www.domain.com/xx/yy/itinerar</strong> to <strong>www.domain.com/xx/yy</strong>.
The value of yy can be various.
I have </p>
<pre><code>RewriteCond %{REQUEST_URI} (.*)itinerar
</code></pre>
<p>but i have trouble with RewriteRule.</p>
| <p>You can use this redirect rule:</p>
<pre><code>RewriteEngine On
RewriteRule ^(.*)/itinerar/?$ /$1 [L,NC,R=301]
</code></pre>
|
LNK2001 with Cmake static library <p>I am struggling to link to a static library created with CMake in another Visual C++ project. I am getting LNK2001 unresolved symbol errors for all the symbols in the library. Forgot to link with the library? I really don't think I have, as I have specified it as an absolute path an... | <p>Ok, I have apparently fixed this although I'm confused by the error I got. It seems the CMake library was targeting x86, not x64. I discovered this when I tried to link to a different library in the same group which then reported an error about inconsistent machine types. Having fixed CMake to do a x64 build I notic... |
How to pause and stop SKScene without having performance issues? <p>I am writing a program using Swift3 in Xcode. I am using SpriteKit and SKScene in my program. As you know, there is a predefined update function that always runs (even when the view changed) in gamescene.sks.</p>
<p>I know that "self.scene.view.paused... | <p>Apples DemoBot is always a good project to check out. </p>
<p>The best way to pause your game is to create a world node and pause that node instead of pausing the skView.</p>
<pre><code>let worldNode = SKNode()
</code></pre>
<p>add it in didMoveToView in your GameScene.</p>
<pre><code>addChild(worldNode)
</code>... |
Angularjs - ng-change and $scope.$watch fires only once <p></p>
<p>I have tried both ng-change as well as $watch on the model. However, it fires exactly once. Either when the first character of the input is entered. Or when the last character is deleted. For example, when I enter the first number, the function is call... | <p>It will be helpful, if you elaborate your question further more.</p>
<p>Basically this scenario working fine. </p>
<pre><code><div ng-controller="test">
<input ng-model="a" ng-change="check()" />
</div>
</code></pre>
<p>JS code</p>
<pre><code>angular.module("myApp", [])
.controller('test', ['... |
How to show total rate in SQL? <p>I need item wise total amount from below table (quired data) in SQL.
How to achieve this? please suggest me-
NB: Please see the attached file, I am unable to paste it correctly.</p>
<p><a href="https://i.stack.imgur.com/nbnFX.png" rel="nofollow"><img src="https://i.stack.imgur.com/nbn... | <p>Use window functions:</p>
<pre><code>select t.*,
sum(totalamount) over (partition by itemid) as totalamountsum
from t;
</code></pre>
|
Button submit's value not transmitted in POST <p>I am using Yii2 and I want to create comment functionality on post using Pjax widget.
The comment windows displays all the existing comments for the post adding an edit button to the ones that belongs to the connected user in order to permit changes.
Under this list of c... | <p>Why are you counting on the submit button name / value to figure out what you need to do? </p>
<p>$_POST['Comment']['id'] is a much better indicator of what needs to done. If it is there update otherwise create. </p>
<p>Also make sure the model does not allow editing of comments posted by others.</p>
<p>The model... |
How do I connect to VMware from another PC? <p>I am facing an issue with my VMware and Ubuntu PC.
Scenario: I have a Windows 8.1 PC (IP: 192.168.1.10) and installed VM ware on this Window PC and installed Centos 7 on the VM ware (IP: 192.168.163.127). Also, I have another PC installed with Ubuntu 15.10 (IP: 192.168.1.... | <p>By using NAT it is quite possible. For further information about how you can configure your NAT and Bridge please take a look at following links:
<a href="https://pubs.vmware.com/workstation-12/index.jsp?topic=%2Fcom.vmware.ws.using.doc%2FGUID-D05850F8-E850-4086-A735-5C84C72D007C.html" rel="nofollow">https://pubs.vm... |
Normailized Dtabase schema of quiz in php <p>I am little confusing for building schema of quiz</p>
<p>In this i have to upload many questions and having four options each option contains textbox and corresponding checkbox that denotes for right answer. if admin select one ceckbox that could be right answer.</p>
<p>N... | <p>This seems fairly straight forward. You just have three tables, one for quizzes, one for questions and one for answers. Something like this:</p>
<p>Quizzes</p>
<pre><code>+----+-------------+-----------------+
| id | name | description |
+----+-------------+-----------------+
| 1 | Sample Quiz | An exa... |
Android marshmallow after granting permission through Appop Denial error for SYSTEM_ALERT_WINDOW permission <p>Hi i am trying to get SYSTEM_ALERT_WINDOW permission i have added <code><uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /></code> in my manifest file. Now when i install the releas... | <p>It may not be asking for the permissions if already allowed please check as below:</p>
<p>No permissions have been granted if you go to <strong>Settings > Apps > "Your app" > Permissions.</strong></p>
<p>You should uninstall clear app data and uninstall it completely, then install via playstore.</p>
<p>If you don... |
NewtonSoft JsonConvert SerializeObject Dictionary of Object Escape Chars <p>I'm having some trouble using the JsonConvert.SerializeObject method concerning escape chars in WCF. My web method returns a Stream as follows:</p>
<pre><code> return new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(myObject... | <p>I use JavaScriptSerializer (just replace "Object" with your custom class)</p>
<pre><code>using System.Web.Script.Serialization;
List<Object> list = new List<Object>();
JavaScriptSerializer jss = new JavaScriptSerializer();
string res = jss.Serialize(list);
</code></pre>
<p>and get this format with "... |
generating new line for each loop bash <p>I have this problem about bash output i need to write code that would output: </p>
<pre><code>1
22
333
</code></pre>
<p>using loops so far i have this code: </p>
<pre><code>First loop....
for ((i=1; i<=1; i=i+1))
do
echo $i
done
#Second loop....
for ((i=1; i<=2; i+... | <p>A simple nested for loop is be sufficient to do what you want:</p>
<p>CODE:</p>
<pre><code>for ((i=1; i<=5; i++))
do
for((j=1; j<=$i; j++))
do
echo -n $i
done
echo
done
</code></pre>
<p>OUTPUT:</p>
<pre><code>1
22
333
4444
55555
</code></pre>
|
multiple commands in git alias is not working <p>I have the following code in my <code>.gitconfig</code> file:</p>
<pre><code>[alias]
john = "!f(){ git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done; git fetch --all; git pull --all; };f"
</code></pre>
<p>... | <p>You need to escape embedded double quotes with backslashes. For instance:</p>
<pre><code>[alias]
next = "!f() { id=$(git rev-list --reverse --ancestry-path ..master | head -1); test -n \"$id\" && git checkout $id || echo 'no more commits'; }; f"
</code></pre>
<p>(which I actually have commented out si... |
How would i change my program so that the colours are specific and not random? <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-override"><code><html>
<head>
<style>
... | <p>A modified version of your code:</p>
<pre><code><html>
<head>
<style>
#myDiv {
height: 200px;
width: 200px;
background-color: black;
}
</style>
</head>
<body>
<div id="myDiv"></div>
<script>
//g... |
angular2 input value bind from another input with ngmodel directive <p>Consider i have two inputs like the below</p>
<pre><code><input [(ngModel)]="value1" type="number">
<input [(ngModel)]="value2" type="number">
</code></pre>
<p>the value2 should be updated when i type any number in value1.</p>
<p>I t... | <p>Try <code>change</code> event instead of <code>ngModelChange</code> as below :</p>
<pre><code><input [(ngModel)]="value1" (change)="value2=value1*value2" type="number">
<input [(ngModel)]="value2" type="number">
</code></pre>
|
User authentication failing after upgrading to 3.2.1 <p>I just upgraded my app from Grails 3.2.0 to <strong>3.2.1</strong> due to some problems and the user authentication started failing. I'm using Grails Spring Security Core plugin version <strong>3.1.1</strong>.</p>
<p>I'm getting the following exception:</p>
<pre... | <p>Seems to be an issue with Grails 3.2.1 itself. Issue tracked <a href="https://github.com/grails/grails-core/issues/10244" rel="nofollow">grails/grails-core#10244</a>.</p>
<p>Workaround is to override <code>limitScanningToApplication</code> in your <code>grails-app/init/PACKAGE/Application.groovy</code></p>
<pre><c... |
Cant parse date to D3 line graph <p>I want to create a line graph like below fiddle,
<a href="http://jsfiddle.net/wRDXt/2/" rel="nofollow">http://jsfiddle.net/wRDXt/2/</a></p>
<p>Here the date is used as <code>new Date(2013, 17, 1)</code>.</p>
<p>I have json contents as follows,</p>
<pre><code>[{
"_id": "bb68d8a... | <p>The <code>date</code> in your <code>dataset</code> is not a date-object, but a string. Therefore it does not have a <code>getDate()</code>-function and you get the error you get. </p>
<p>To fix this, right after you have declared your dataset, loop through all entries in the dataset and redefine <code>date</code> b... |
xcopy: did "/d" find newer file? <p>xcopy allows for the use of the parameter /d to "copy all Source files that are newer than existing Destination files" (<a href="https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true" rel="nofollow">https://www.microsoft.com/resources/doc... | <pre><code>FOR /f %%a IN ('XCOPY /d /l ..\* .') DO SET /a numcopied=%%a
</code></pre>
<p>executed <strong>before</strong> you perform you actual <code>xcopy /d</code> will set <code>numcopied</code> to the number of files to be copied.</p>
<p>Note that I used the directories <code>..</code> and <code>.</code> here fo... |
how to replace a column of a data frame with several columns alternatively? <p>I have a data frame like this </p>
<pre><code>X <- matrix(rexp(30, rate=.1), ncol=5)
Y <- matrix(rexp(6, rate=.1), ncol=1)
mydata <- data.frame(cbind(Y,X))
</code></pre>
<p>Now I want to change the third column of X with each of t... | <p>You can do it in loop </p>
<p>like </p>
<pre><code>res=lapply(1:ncol(Xm),function(i){
mydata[[3]] <- Xm[ , i] # change 3-rd column of mydata om i-th colomn of Xm
lm(Y~.,data=mydata)
})
</code></pre>
<p>where <code>res</code> - list of your lm models</p>
<p>If you want to save only X3 std
you can do it in suc... |
node.js multipart/form-data local file upload to api <p>I want to upload a file to a restful api service from my javascript application. It should use a local path like "c:/folder/test.png" and upload to something like "localhost/uploads", is there a easy approch, I am a little lost coming to the upload part and have t... | <p>You need to use <a href="https://github.com/felixge/node-formidable" rel="nofollow">https://github.com/felixge/node-formidable</a>
It work fast to upload files</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.