input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How to give interactive inputs in a single line for .exe windows <p>I am trying to automate one process which involves giving interactive input to a .exe utility. It expects the user-input for each step. I wanted to give all those values at single time while giving that command only. For eg: <code>./test.exe 8\n1\n0</c... | <p>There is no set way to automate a 3rd party program with Powershell. Not all utilities even offer the ability to do so.</p>
<ol>
<li><p>I'd look in the utility documentation for any switches.</p></li>
<li><p>Try the following to see if you can get any built in help: test.exe -h, test.exe /h, test.exe /?, test.exe ... |
Entity Framework M:1 relationship resulting in primay key duplication <p>I'm somewhat new to EF 6.0 so I'm pretty sure I'm doing something wrong here.
there are two questions related to the problem</p>
<ol>
<li>what am I doing wrong here</li>
<li>what's the best practice to achieve this</li>
</ol>
<p>I'm using a code... | <p><strong><em>Don't you think that you are trying to write very similar codes for defining the state of each entity?</em></strong>
We can handle all of these operations with a single command.</p>
<p>You can easily achieve this with the newly released <a href="https://www.nuget.org/packages/EntityGraphOperations/" re... |
How to fix Alamofire library errors? <p>I am using Xcode7.3.1 and i added Alamofire (4.0.1) version.But when i tried to run the project then i got many errors in Alamofire library.Please find attached screenshot contains errors.My podfile contain like the following.How to fix these errors?</p>
<pre><code># Uncomment ... | <p>Alamofire 4.0.1 is using Swift 3, while Xcode 7.x doesn't support it. You should upgrade to Xcode 8 in order to use the newest Alamofire.</p>
|
Validate end_date is after start_date <p>I have a form with two date fields, <code>start_date</code> and <code>end_date</code>. I want to create a rule that <code>end_date</code> must be greater then <code>start_date</code>, and if this condition returns <code>false</code> then to show validation errors as in the pict... | <p>Got it.</p>
<pre><code> $.validator.addMethod("check_date", function(value, element) {
var start_date = $("input[name='start_date']").val();
var end_date = $("input[name='end_date']").val();
return end_date > start_date;
}, 'End date must be greater then Start date.');
</code></pre>
|
Unresolved android dependency issue <p>Hi I am new to Android Studio and I am using <strong>Android studio 2.2.1.</strong>
When I am trying to create a new project I am getting the the errors as shown in the screenshot.</p>
<p><a href="https://i.stack.imgur.com/KZoL6.png" rel="nofollow"><img src="https://i.stack.imgur... | <p>You need to download the dependencies.
Find the the SDK Manager and download the yellow ones which are the most importants</p>
<p><a href="https://i.stack.imgur.com/yEvXX.png" rel="nofollow"><img src="https://i.stack.imgur.com/yEvXX.png" alt="enter image description here"></a></p>
<p>If you still have problems, tr... |
creating multiple folders inside current directory in c++ <p>I want to make some folders using a loop in current directory in c++. I have made a code but getting the following error.</p>
<blockquote>
<p>cannot convert 'std::string {aka std::basic_string}' to 'const char*' for argument '1' to 'void CreateFolder(cons... | <p>You can not directly pass a <code>std::string</code> as <code>char*</code>. By using <code>c_str()</code> function you can retrieve the raw <code>char*</code> from <code>std::string</code>.</p>
<pre><code>//std::string -> const char*
CreateFolder(folder_name.c_str());
</code></pre>
|
How to handle a missing lat long values from ajax response. How to detect and give appropriate alert to the user <p>I am getting a json response from ajax call like this below</p>
<pre><code>{"metadata":{"assetStatusAvailable":false},"data":[{"id":"209880948","name":"1:Periodic Report","domainObjectType":"assetmessage... | <p>Use following function to check a blank value and null value of latitude, longitude</p>
<pre><code>var checkBlankValue(){
$.each(obj.data, function(key, value){
if (key=='latitude' || key=='longitude'){
if (value === "" || value === null){
return false;
... |
Custom wordpress Form submission <p>I want to insert data into database table through custom php form in wordpress. I don't want to use/create plugins/hooks. just simple form for client so he can edit himself whenever he want.</p>
<p>I tried <br></p>
<pre><code>if($_POST['submit'])
{< submit to db >
} else {
&l... | <p>you have to follow the WordPress file structure like page.that_file.php under your theme folder and calling header and footer in it and hit the page to check it work or not. After checking it call the page in your action form still you get 404 than issue in your calling function. </p>
|
How to rename master branch and make another branch as master? <p>I have several branches in my repo - master, production, staging, other_stuff
I want to set my production branch as master, and rename my master branch to master_legacy.</p>
<p>How can I do it?
Actually I found guide, but I'm not sure, whether I can imp... | <p>If you really just want to rename the branches and not merge information together; I would go for:</p>
<pre><code>git branch master_legacy master # create a new branch master_legacy where master is
git branch -D master # force deleting the master branch
git branch master production # create a new master branch wher... |
Get geo locations repeatedly (after every.. 1 minute ) <p>I am calling toast message in <code>AndroidGPSTrackingActivity.class</code>. how to fetch geo locations after every 1 minutes.. With below code I am getting only once </p>
<pre><code>public class AndroidGPSTrackingActivity extends Activity {
public void onCrea... | <p>Use <a href="http://www.androidwarriors.com/2015/10/fused-location-provider-in-android.html" rel="nofollow">google Fusion api example</a> for get location in interval.</p>
|
Bitbucket doesn't create visual branch <p>I'm new to git and working with bitbucket.
Did I do something wrong that bitbucket doesn't show a visual branch? It looks like i'm still working in master.
I have other commits before in the master branch.</p>
<p><a href="https://i.stack.imgur.com/vDibk.png" rel="nofollow"><im... | <p>You did not do anything wrong. Bitbucket shows your commit history just like it is: a linear list of commits (some of which have branches pointing to them). In git, a branch is merely a pointer to a commit.</p>
<p>As soon as you make divergent commits on the two branches, you will see two visual branches on the gra... |
Cron Job (Quartz.NET) in .NET is not triggering daily <p>I have scheduled a cron Job in .NET and the same is hosted in IIS. On the first day it has triggered ( for testing purpose i actually send mail when this job is triggered). But the next day it has not (i want this to be recursive on daily basis ... every 24 Hrs o... | <p>IIS has a feature called "Recycling". This basically reloads everything in IIS.</p>
<p>If you go into Advanced Settings of your Application Pool in the IIS Manager there is an Recycling Interval which by default is 1740 minutes (29 hours)</p>
<p>When IIS Recycles, your application will not begin running until some... |
How to generate automatically Makefile in vim (c/c++) super fast? <p>I'm quite new to vim,
have installed few plugins one of them is SnipMate,
which is quite useful while writing a short Makefile.</p>
<pre><code>snippet base
PHONY: clean, mrproper
CC = gcc
CFLAGS = -g -Wall
all: $1
%.o: %.c ... | <p>You can extract filenames automatically with <code>glob()</code>, and <code>globpath()</code> (don't ask me about SnipMate syntax to import the result -- I'm maintaining another template/snippet plugin). </p>
<p>But if you always use <strong>everything</strong> automatically, why don't you do it directly with make?... |
How i can put my changeable pictures as wallpaper to homescreen...! <p>I have several picture to display it as live wallpaper I have this code but it doesn't change anything,,,,,,,,,,,,,,!! I'm newbie I just did copy paste this code I don't understand anything please can someone help me</p>
<pre><code> public class ... | <p>I know two ways to do it:</p>
<p>1)For creating live wallpaper you need to extend <a href="https://developer.android.com/reference/android/service/wallpaper/WallpaperService.html" rel="nofollow">WallpaperService</a>.
Good tutorial - <a href="http://www.vogella.com/tutorials/AndroidLiveWallpaper/article.html" rel="n... |
Finding a "trail" in 2-D dimention arrays <p>I don't know how to figure out this question, I am just a beginner to computer science.</p>
<p>The input will be 2D array A[n][n] numbers, representing the topographic map of the geographic surface. Also among the input will be a starting location (r,c). referring to entry ... | <p>It's just flood fill. You need a queue and an index-addressable vector of "visited" flags. Put the root into the queue. Whist the queue is not empty, take the first element, and check for reachable locations N,S,E,W. Then check if they have been visited. If not, mark them as visited, and put them in the queue. </p>
|
Custom shape in android using xml <p>I am trying to draw a custom shape which I can use as a background for my layout. But I am not able to do so. Is it possible to draw a shape as below using xml in android. I am not getting how to cut the semicircle shape from the vertical centres of rectangle. </p>
<p><a href="htt... | <p>try bellow xml. save it in drawable.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:topLeftRadius="15dp"
android:topRightRadius="15dp"
android:bottomLeftRadius="5dp"
android:bottomRig... |
When window is resized, span element not getting its width <p>Here's the screenshot:
<a href="https://i.stack.imgur.com/uegLZ.png" rel="nofollow"><img src="https://i.stack.imgur.com/uegLZ.png" alt="enter image description here"></a></p>
<p>And here's the code:</p>
<pre><code>.contact_section .contact_form input[type=... | <p>The CSS property <code>display:inline</code> does not accept widths and heights. Change this to inline-block to solve your issues.</p>
<pre><code>.contact_section .contact_form input[type="text"], .contact_section .contact_form input[type="email"]{
border: 1px solid black;
margin: 15px 0;
font-size: 16p... |
extra characters after close-brace <p>The same code that works on Linux doesn't work on FreeBSD</p>
<p><strong>On Linux</strong></p>
<pre><code>% set timeZone "-4:0"
-4:0
% set timeZone [format "%+03d%02d" {*}[scan $timeZone "%d:%d"]]
-0400
% puts $tcl_version
8.5
</code></pre>
<p><strong>On FreeBSD</strong></p>
<p... | <p>You will have to use <code>eval</code>, since list expansion (<code>{*}</code>) <a href="http://wiki.tcl.tk/17158" rel="nofollow">was implemented in Tcl 8.5</a>. You could perhaps use something like this:</p>
<pre><code>set timeZone "-4:0"
set code "format \"%+03d%02d\" [scan $timeZone "%d:%d"]"
# This gives you "f... |
Javascript why array.slice() doesn't work when the first value is 0? <p>I have a problem, I don't understand why arr.slice doesn't work when the first value is 0, the returned array is empty:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code... | <p>You end direct the loop with the condition, which evaluates as <code>false</code>.</p>
<pre><code>arr[i] -> arr[0] -> 0 -> false -> end for loop
</code></pre>
<p>Use the length of the array as check</p>
<pre><code>for (var i = 0; i < arr.length; i += size) {
// ^^^^^^^^^^^^^^
</code></... |
How can I do SQL Server RegEx replace similar to JavaScript RegEx replace <p>How can perform below shown JavaScript RegEx replace in SQL Server?</p>
<pre><code>var str = "$5,000";
console.log(str.replace(/[$,]/g, ""));
</code></pre>
<p>Output:</p>
<pre><code>5000
</code></pre>
| <p>Try this </p>
<pre><code>declare @str money
set @str= cast(cast('$5,000' as money) as int)
</code></pre>
<p>Or else if you especially want to use regular expression, you can try the below,</p>
<pre><code>DECLARE @Str varchar(100)
SET @Str = '$5,000'
set @Str = STUFF(@Str, PATINDEX('%[$,]%', @Str),1, '')
select @... |
can I use grant_type=client_credentials for google api? <p>I create a clientid, and clientcredentials in google console. when I request the token with <code>grant_type=client_credentials</code>. I got <code>401 unauthrorized</code>.</p>
<pre><code>{
"error": "invalid_client",
"error_description": "Unauthorized",
... | <p>The error means that you are not authenticated. Also client_credentials is not a valid value for grant_type that I am aware of. </p>
<p>The only ones I know of are </p>
<ul>
<li>authorization_code</li>
<li>refresh_token</li>
</ul>
<p>It looks like <code>grant_type=client_credentials</code> is part of the <a href=... |
Deserialize flattened JSON keys to proper objects with GSON <p>We ingest an external API (we cannot change the JSON we receive) which produces JSON with flattened keys. For example:</p>
<pre><code>{
"composite.key": "value",
"normal": "another value",
"composite.key2": "back here again..."
}
</code></pre>... | <p>You can use GSON's <a href="https://google.github.io/gson/apidocs/com/google/gson/annotations/SerializedName.html" rel="nofollow">@SerializedName</a> annotation on the Java fields.</p>
<p>Something like this</p>
<pre><code>public class Composite {
@SerializedName("composite.key")
public String key;
@S... |
Interpolate between elements in an array of floats <p>I'm getting a list of 5 floats which I would like to use as values to send pwm to an LED. I want to ramp smoothly in a variable amount of milliseconds between the elements in the array.</p>
<p>So if this is my array...</p>
<pre><code>list = [1.222, 3.111, 0.456, 9... | <p>do you think about something like that?</p>
<pre><code>import time
l = [1.222, 3.111, 0.456, 9.222, 22.333]
def play_led(value):
#here should be the led- code
print value
def calc_ramp(given_list, interval_count):
new_list = []
len_list = len(given_list)
for i in range(len_list):
first... |
Join data from rows to 1 row depending on the number of rows <p>I have the following tables:</p>
<pre><code>user
userId name
1 Sam
2 Harold
3 John
othertable
id id2 number
1 111 12
1 222 23
1 333 33
2 111 12
2 444 11
3 555 ... | <p>you may try out this 1... not sure if it meet you requirement...</p>
<pre><code>CREATE TABLE users
(
userId int,
name varchar(max)
)
INSERT INTO USERS VALUES
(1, 'Sam'),
(2, 'Harold'),
(3, 'John')
CREATE TABLE othertable
(
id int,
id2 int,
number int
)
INSERT INTO othertable VALUES
(1, 111... |
css text to close hard to read in wordpress <p>[![enter image description here][1]][1]</p>
<p>as you can se the text is to close am</p>
<pre><code>#main {
text-align: left;
margin-bottom: 10px;
display: inline-block;
width: 1280px;
padding: 10px;
margin: auto;
margin-top: 10px;
text-al... | <p>Use css property <code>line-height: 14px;</code> to set height of line between text</p>
<pre><code>p {
line-height: 25px;
}
</code></pre>
|
Sharepoint Rest Api calls` <p>I am making a simple website where I have to save some of my data to sharepoint list. I am using only html css js only. I need to make REST calls to Sharepoint APIs to post data on SP. I am trying to get data from my list(in SP) as follow:</p>
<pre><code>$(document).ready(function() {
... | <p>I think that custom scripting is disabled by default in SPOnline. You may have to enable it. These links may help:</p>
<p><a href="http://stackoverflow.com/questions/29675567/access-denied-office-365-sharepoint-online-with-global-admin-account">Access denied office 365 / SharePoint online with Global Admin accoun... |
How to get nokogiri attribute value? <p>My xml contains multiple statements like</p>
<pre><code><House name="bla"><Room id="bla" name="black" ><blah id="blue" name="brown"></blah></Room></House>
</code></pre>
<p>I need to get all the values for the given keyword.</p>
<p>I used <co... | <pre><code>node_names = doc.css("[name]").map { |node| node['name'] }
</code></pre>
<p>for all node names; or for just "black",</p>
<pre><code>black = doc.at_css("[name]")['name']
</code></pre>
|
How to create pullup and pulldown effect in web? <p>We are creating mobile application and need to create some sort of "android loading" effect. I've tried to draw, because it's difficult to explain.</p>
<p><a href="https://i.stack.imgur.com/MKSf2.png" rel="nofollow"><img src="https://i.stack.imgur.com/MKSf2.png" alt=... | <p>You'll have to add a Pseudo element at the end of the list(with some height).</p>
<p>Now in Javascript check if the offset of this element is above the bottom of screen and scroll up to hide it (with some delay).</p>
<p>Also hide the scroll bar else it may look a bit weird.</p>
|
Passing a vector as a reference to a recursive function <p>I've build a function that accepts a reference to a vector as argument, it looks like this :</p>
<pre><code>void func(std::vector<int> &vec) {
// sth. to do
}
</code></pre>
<p>But i want that the function is recursive and calls itself with a part... | <p>The old way!</p>
<pre><code>void func(std::vector<int> &vec,int l,int r) {
// this function modifies only vec fro indices l to r.
//
// do what you want
//
//
func(vec,new_l,new_r);
}
</code></pre>
|
install4j obsolete files not removed on upgrade <p>I am writing a sample upgrade installer and added in few files and removed up some files. I see that the added files are getting properly placed but the removed are not getting deleted.</p>
<p>how to handle this</p>
| <p>You can add an "Uninstall previous installation" action to the "Installation" screen of your installer in order to remove those files.</p>
|
Connection: keep-alive in nginx webserver <p>I have enabled the Connection: keep-alive in my nginx webserver. And its working fine as well. My query is in nginx access logs i am getting the below message many times. I believe its due to the keep-alive but what exactly the server is doing? Thanks in advance.</p>
<p>Acc... | <p>If I'm not mistaken, when the keep alive activates the web server sends a packet to the client to indicate that the connection is still active, so those messages are in the log.</p>
<p>Sorry for my English ;)</p>
|
undefined method with time_select <p>I am trying to use a time select with locals passed to the partial, but I am getting the following error</p>
<pre><code>undefined method `open_time' for #<Merchant:0x007fb41fd0aa90>
</code></pre>
<p>Partial Call</p>
<pre><code>= form_for @merchant, :url => admin_merchant... | <p>you can do something like this(starting from the last line of your mentioned code):</p>
<pre><code><%= hour_fields.fields_for :trading_hours do |trading_field| %>
<%= trading_field.time_select :open_time, {:minute_step => 30, :ampm => true} %>
<% end %>
</code></pre>
<p>And in Merchants ... |
Integrating Auth0 authentication with existing user database <p>I've a requirement to integrate Auth0 in our project (Reactjs/Hapijs/MySQL). I checked the documentation and they have many examples and that is great, however, I can't find any related to how exactly do I use my existing user database.</p>
<p>In my appli... | <p>There are a few options available for scenarios where you want to integrate Auth0 with applications that already have existing user databases. You can either:</p>
<ol>
<li>continue to <a href="https://auth0.com/docs/connections/database#using-a-custom-user-store" rel="nofollow">use your existing store</a></li>
<li>... |
Deciding when to use a hash table <p>I was soving a competitive programming problem with the following requirements:</p>
<p>I had to maintain a list of unqiue 2d points (x,y), the number of unique points would be less than 500.</p>
<p>My idea was to store them in a hash table (C++ unordered set to be specific) and ea... | <blockquote>
<p>My question is is there any reasonable way to guess when should i use a hash table over a manual search over keys without having to benchmark them?</p>
</blockquote>
<p><sup>I am guessing you are familiar with basic algorithmics & <a href="https://en.wikipedia.org/wiki/Time_complexity" rel="nofol... |
Select Orders of Last Month in MySQL <p>I have to write a query that selects Last month orders from a table Order( id , ......., order_date).</p>
<p>Assume that the date of today is 4th of April. Will i select orders from 1st March to 31th of March or from the 4th of March to the 4th of April ??? </p>
<p>Edit :
Th... | <p>"Last month" typically means the whole period of the month prior to today. So if today was 4th April then last month is</p>
<pre><code> >= 1st March and < 1st April
</code></pre>
<p>E.g.</p>
<pre><code>Select * from orders
Where order_date >= '2016-03-01'
and order_date < '2016-04-01'
</code></pre>
... |
Decomposition of time series data <p>Can anybody help be decipher the output of ucm. My main objective is to check if the ts data is seasonal or not. But i cannot plot and look and every time. I need to automate the entire process and provide an indicator for the seasonality.</p>
<p>I want to understand the following ... | <p>I think the most straightforward approach would be to follow <a href="http://robjhyndman.com/hyndsight/detecting-seasonality/" rel="nofollow">Rob Hyndman's approach</a> (he is the author of many time series packages in R). For your data it would work as follows,</p>
<pre><code>require(fma)
# Create a model with mul... |
how to pass thymeleaf object to angularjs <p>I am using Spring-boot, thymeleaf and Angularjs. In my my view.html I need to recover the list "lstUsers" from my class "controller.java" using Angular.</p>
<p>For informations: "view.html" and "controller.java" works good. The problem is how I can fill my variable "$scop... | <p>Usually this kind of data is retrieved from the server via ajax. For example you can provide a Spring MVC Controller that returns your sub tasks as a JSON array and your angular app would need to retrieve that data from your Spring MVC Controller via ajax.</p>
<p>Have a look at this tutorial: <a href="https://sprin... |
Swift 3, UITextView under the keyboard while typing <p>I'm developing an app with a chat inside, really simple, one tableview with a textview and a button.</p>
<p><a href="https://i.stack.imgur.com/EY6dq.png" rel="nofollow"><img src="https://i.stack.imgur.com/EY6dq.png" alt="enter image description here"></a></p>
<p>... | <p>You can use <a href="https://github.com/hackiftekhar/IQKeyboardManager" rel="nofollow">IQKeyboardManager</a> which will take care of your problem</p>
|
Count unique customers <p>Thank you in advance for your help. I have been working on this problem for hours. I have a table with the following columns:</p>
<pre><code>OrderID | CustomerID | Date | Course
--------|------------|-----------|----------
14954 | 13440 |16.10.2016 | Zürich
14955 | 13441 |... | <p>You want this:</p>
<pre><code>SELECT Course, COUNT(DISTINCT CustomerID) FROM [Table_name] WHERE
Date='17.10.2016'
</code></pre>
|
Xamarin Forms trouble with SQLite and await <p>I'm using the sqlite-net-pcl nuget, in my view model I am trying to get the list of announcements from my database </p>
<pre><code> private SQLiteAsyncConnection connection;
public ObservableCollection<Announcement> AnnouncementList { get; private set; }
... | <p>You can't just call your async <code>Initialize()</code> method in a sync way like that. It will return immediately and by the time you get around to using <code>AnnouncementList</code>, <code>Initialize</code> isn't finished running yet and it is still null.</p>
<p>It's not an ideal solution but you should add <co... |
Entity Framework temporary save <p>We are building a website where users can add/edit/remove students and their related info. Everything works great, but now we want to allow anonymous users to try our demo school.</p>
<p>Demo school is the same as regular school but we want users to be able to edit/delete information... | <p>use a temporary database and as soon as you want to switch to the original one just change the web.config file , if you use Code first it will be easy else you need to generate sql+data from the original database to the temporary . </p>
|
Can not convert JSON to domain object with spring restTemplate <p>Actually I try to invoke a get request with the restTemplate in Spring. Debbuging my application clearly shows that the JSON is downloaded but the automatic mapping does not work. My List of domain object includes only 0 values and null values.
When I in... | <p>I can suggest you to write a test and check how fasterxml ObjectMapper read a json and unmarshall json to your object:</p>
<pre><code>ObjectMapper objectMapper = new ObjectMapper();
String somestring = objectMapper.readValue("somestring", String.class);
</code></pre>
<p>just replace <em>String</em> with your class... |
How do I convert multiple elements of a character array into an integer? <p>Say I have,</p>
<pre><code>char x[0] = '1';
char x[1] = '2';
</code></pre>
<p>I need to 'concatenate' these two into an integer variable,</p>
<pre><code>int y = 12;
</code></pre>
<p>How do I do this?</p>
| <p>As long as you terminate <code>x</code> with a NULL-terminator you can use <code>atoi</code>.</p>
<p><a href="http://ideone.com/z22XKk" rel="nofollow">Example</a>:</p>
<pre><code>#include <stdlib.h>
#include <stdio.h>
int main() {
char x[3];
x[0] = '1';
x[1] = '2';
x[2] = '\0';
int... |
Deploying Angula2 UI application in High Availability Mode <p>Currently we have implemented a Angular2 UI application and deployed in single server. We would like to implement the UI application in high availability mode by deploying the UI application in 2 servers(1 in active mode and another one in stand-by mode). I... | <p>Angular2 runs in the client (browser) only. </p>
<p>The server only serves static HTML, JS, and CSS files. There are no specific requirements for an Angular2 server (except when you want to use server side rendering). Just build your Angular2 source and you will only get static files for deployment.</p>
<p>Any HTT... |
Sending an email causes - Connection interrupted <p>Basically what am i trying to do is to send an email: </p>
<pre><code>-(void) sendAnEmail {
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
mail.mailComposeDeleg... | <ol>
<li><p>From <a href="https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html" rel="nofollow">this Apple Guide</a> I can understand that XPC services are supposed to prevent apps from crashing by separating unstable components somehow.</p></li>
<... |
mv command is throwing too many arguments in SOLARIS <pre><code>for f in `find /app/rohith/* -type f -o -prune -name "*.*"` ; mv $f /app/arch/; done
</code></pre>
<p>ERROR:
ksh: /usr/bin/find: arg list too long </p>
<hr>
<p>Note :
-> OS is Solaris
-> So, i am using prune here, its similar to maxdepth</p>
<p>My Que... | <p>Try this</p>
<pre><code>find /app/rohith/* -type f -prune -name "*.*" -exec mv {} /app/arch/ \;
</code></pre>
<p>I am not sure if it works on solaris but on linux it does</p>
|
Plot decision boundaries of classifier, ValueError: X has 2 features per sample; expecting 908430" <p>Based on the scikit-learn document <a href="http://scikit-learn.org/stable/auto_examples/svm/plot_iris.html#sphx-glr-auto-examples-svm-plot-iris-py" rel="nofollow">http://scikit-learn.org/stable/auto_examples/svm/plot_... | <p>The thing is you <strong>cannot</strong> plot decision boundary for a classifier for data which is not <strong>2 dimensional</strong>. Your data is clearly high dimensional, it has 908430 dimensions (NLP task I assume). There is no way to plot actual decision boundary for such a model. Example that you are using is ... |
getDrawable with AnimatedVectorDrawable crashes in android version 4 <p>I tried to access AnimatedVectorDrawable as follows using the ContextCompat. Im using the following code to do so. It works well in Android version 5 and above but not in android version 4.</p>
<pre><code>@TargetApi(Build.VERSION_CODES.LOLLIPOP)
... | <p>Try this : <code>AnimatedVectorDrawableCompat.create(this, R.drawable.animated_vector_name)</code></p>
<p>Reference:
<a href="http://stackoverflow.com/a/35699072/7001152">http://stackoverflow.com/a/35699072/7001152</a></p>
|
Convert specific column of file into upper case in unix (without using awk and sed) <p>My file is as below
file name = test</p>
<pre><code>1 abc
2 xyz
3 pqr
</code></pre>
<p>How can i convert second column of file in upper case without using awk or sed. </p>
| <p>In pure <code>bash</code></p>
<pre><code>#!/bin/bash
while read -r col1 col2;
do
printf "%s%7s\n" "$col1" "${col2^^}"
done < file > output-file
</code></pre>
<p>Input-file</p>
<pre><code>$ cat file
1 abc
2 xyz
3 pqr
</code></pre>
<p>Output-file</p>
<pre><code>$ cat output-file
1 ABC
2 ... |
auto load php script <p>I have shared folder between in my server which will allow other server to send XML file to me and I want my script read this file auto without opening any page.
I know how to open and read the file.</p>
<p>But the issue how to auto load in the backhand. </p>
| <p>you have to create a one page which will read the provided file and do the required actions , then share this URL and format with the team who will going to provide you the xml file.</p>
<p>It is very much like API Endpoint, Where you have to write the code which will handled request and in this scenario your Endpo... |
Looping through array to store duplicate string and add up values of the same string C++ <p>Relatively new to C++ , the following is my code:</p>
<pre><code>void displaydailyreport()
{
std::string myline;
string date[100]; // array for dates
int dailyprice =0;
ifstream myfile("stockdatabase.txt"); // ... | <p>With c++11 support, you can use std::unordered_map to store key/values pair: </p>
<pre><code>#include <string>
#include <unordered_map>
std::unordered_map<std::string, int> totalMap;
//...
for(i=0;std::getline(myfile,myline);i++) {
auto mapIterator = totalMap.find(stockpile[i].datepurcha... |
Ruby Morse Decoder <p>I tried to create a Morse Decoder. It replaces latin letters with their morse codes. There is one whitespace between letters and three whitespace between words.</p>
<pre><code>def decodeMorse(morseCode)
morse_dict = {
"a" => ".-","b" => "-...","c" => "-.-.","d" => "-..","e" => ... | <p>The problem is here:</p>
<pre><code>word.gsub! letter a
</code></pre>
<p>it is being interpreted from the right to the left since there is no comma between <code>letter</code> and <code>a</code> itâs being treated as <code>letter(a)</code> function call. You want both <code>letter</code> and <code>a</code> to be... |
jq filter array of object unique propertie value <p>Very simple but beginning with jq.</p>
<p>What I have is an array of object. I want to have an array of object filtered by unique value 'myprop'</p>
<pre><code>[
{
myProp: "similarValue"
},
{
myProp: "similarValue"
},
{
myProp: ... | <p>It was pretty easy actually</p>
<p>.values | unique_by(.myProp)</p>
|
onclick inside function fail <p>I have 3 inputs and 3 buttons. I would like to set a value by clicking on the button. Everything working fine with the first set. When I set next input, it change the value of all my inputs. </p>
<p>How can I fix that?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-c... | <p>You can't scope click function inside click function , just use two click and global variable ...</p>
<pre><code>$(function() {
var here;
$("input").on("click", function () {
here = $(this);
});
$("div").on("click", "button", function() {
here.val(this.value);
});
});
</code></pre>
|
Send JSON data through AJAX <p>I'm trying to send data from option selector </p>
<pre><code><select id="city">
<option value="{'city':'melbourne','lat':'-37.8602828','long':'144.9631'}">Melbourne</option>
</code></pre>
<p>Through an AJAX POST</p>
<pre><code>$.ajax({
method: "POST",
url:... | <p>You have a missing <code>="</code> at the option value attribute</p>
<pre><code><select id="city">
<option value="{'city':'melbourne','lat':'-37.8602828','long':'144.9631'}">Melbourne</option>
</code></pre>
<p>Plus, you can directly access the select value:</p>
<pre><code>$.ajax({
method... |
Mailchimp API form not sending final welcome email <p>I'm trying to build a custom form in my site using the <code>Mailchimp API</code>. I've managed to write up a <code>PHP</code> script which is adding my users to a mailing list from within the Mailchimp dashboard. However I'm having an issue sending them an auto res... | <p>I've managed to resolve my issue and I'm posting this answer here for anyone who may experience a similar problem to me regarding the sending of a welcome email by way of the single opt-in process.</p>
<p><strong>Double Opt In Process</strong></p>
<p>Mailchimp enforces a double opt-in policy whereby a user who sig... |
DB2Driver from jar dependency not found <p>I have created a small jar distribution that sets up a database connection for me.
Problem is that when i add it as a gradle dependency I get:</p>
<pre><code>java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
</code></pre>
<p>Gradle dependecie tree:</p>
<pre><code>... | <p>Add this to your <code>build.gradle</code> and run <code>gradle findClass</code> from command line</p>
<pre><code>task findClass {
doLast {
def foundJars = [] as Set
configurations.runtime.files.each { jar ->
zipTree(jar).visit { FileVisitDetails fvd ->
def path... |
Eloquent relationships: cloumn doesn't exist <p>I'm new to Laravel and am having a bit of a hard time cracking how relationships work. I'm building a simple e-commerce application, where each user has some orders, and order has one or many sub-orders, and each sub-order is linked to only one item (please don't comment ... | <p>Overall: define the 1-to-1 relationship using <code>hasOne</code> or <code>belongsTo</code> will affect the target table where Laravel find the foreign key. <code>hasOne</code> assume there is a <code>my_model_id</code> in target table.And <code>belongsTo</code> assume there is a <code>target_model_id</code> in my t... |
OData don't connect with SAP Web IDE (local installation) <p>I used automatical OData connection with SAP Web IDE. Unfortunately, Data don't connect and Layout Editor says that Data Set "not defined". I have tried to connect by coding, for example <code><Table items={/Stats}></code>, but it doesn't work either. W... | <p>It seems like you are never instantiating a model.
You can do that in the manifest.json</p>
<pre class="lang-json prettyprint-override"><code> "models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Statusverwaltung.i18n.i18... |
Why the output of this C program that uses fork and shared memory like that? <p>I have question from old exam, Given a C code and m is global variable, when the program finish what the value of m,the answer is "between 7 and 19" but i don't understand why, can someone explain it to me why the answer is between 7-19 and... | <p>The first thing to notice, analysing this problem is that there are no blocking calls, this means that when the main process reaches the end of main the program will finish, regardless of what state the other processes are in.</p>
<p>Using this fact we can work out the lower limit of <code>m</code>: this will be wh... |
Animation with GSAP <p>I am doing an envelope animation using GSAP, been facing quite a lot of issue but couldn't find much help online.</p>
<p>I am trying to make some animations to 1) rotate from the front of the envelope to back of the envelope, 2) opening of flap and 3) a letter coming out from an envelope.</p>
<... | <p>Anyway I have solved my issue.</p>
<p>Missed out a line in the timeline to change the z-index.</p>
|
Incorrect URLs in Sitecore Habitat <p>After a number of trials, I finally managed to setup Habitat for Sitecore 8.2 </p>
<p>The instance name used is <code>habitatdev</code>. I followed the git document on configuring these custom names in 3 config files in the VS solution. </p>
<p>The home page <a href="http://ha... | <p>The problem (looking at your comment) is in your site config.</p>
<p>You have:</p>
<pre class="lang-xml prettyprint-override"><code><site name="habitat" targetHostName="habitat.habitatdev" database="web" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/habitat" startItem="/Home" ... />
</code... |
npm install fails with error <p>I'm following this tutorial <a href="https://www.youtube.com/watch?v=_-CD_5YhJTA" rel="nofollow">enter link description here</a> but I'v got stuck at 12:41. I downloaded seed project following link in the video description and issued somman <code>npm install</code> as administrator on Wi... | <p><strong>Permission Issue</strong>. It probably has to do with the path names in windows.</p>
<p>Check the same in Git Bash or Windows Powershell. </p>
<p>You can set the NODE path like : <code>set NODE_PATH=source</code></p>
<p>Remove the node_modules and run <code>npm install</code> again.</p>
|
PDO rollback and beginTransaction , cannot work more than 1 query <p>The first query will execute successfully, but for the second query, it doesn't work.
The following is the coding which I declare my database and executes two of the queries:</p>
<pre><code>$db = new PDO( "sqlsrv:server=$servername ; Database=$databa... | <p>You don't need the inner try...catch clause because either 1st or 2nd error would trigger the rollback anyway.
<strong>Back to your question</strong>, MySQL might not execute your update statement because your target rows aren't identified by unique id . (unsafe update)</p>
<p>you can override the safe update check... |
react-native calender picker in dialog in ios <p>In <code>react-native-ios</code>, I am using <code>react-native-datepicker</code> for selecting date from calender.
For this, I am using following link:
<a href="https://github.com/xgfe/react-native-datepicker" rel="nofollow">Date Picker in react-native-ios</a></p>
<p>... | <p>I am using this library : <a href="https://github.com/xgfe/react-native-datepicker" rel="nofollow">https://github.com/xgfe/react-native-datepicker</a></p>
<p>It works great and cross-platform too.</p>
|
Collapsing Toolbar and ImageView - toolbar is not showing <p>I have Collapsing <code>Toolbar</code> with <code>ImageView</code> and <code>Toolbar</code> (which contais this three lines icon for side drawer menu for example). <code>ImageView</code> is collapsing just like I want but... Toolbar is not showing at all.When... | <p>You need to use app:layout_scrollFlags="scroll|exitUntilCollapsed" inside the CollapsingToolbarLayout</p>
<p>and use app:layout_collapseMode="pin" inside the toolbar</p>
<pre><code><android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_par... |
C++ std::regex How to fix the error_complexity? <p>I used <code>std::regex</code> to match a string. </p>
<p>My define of regex is : </p>
<pre><code>regex reg("(-?\\d+,?){2,}", regex::icase)
</code></pre>
<p>Test string is : </p>
<pre><code>5,3240,7290,11340,-3240,-7290,-11340
</code></pre>
<p>I used std function ... | <p>You may "unroll" the <code>,?</code>-containing group into a more linear pattern to reduce complexity - <code>",?-?\\d+(?:,-?\\d+)+"</code>.</p>
<p>See <a href="https://ideone.com/vGh1Vf" rel="nofollow">C++ demo</a>:</p>
<pre><code>#include <iostream>
#include <regex>
using namespace std;
int main() ... |
Video won't play on iphone <p>I have an app that places videos online, and cannot find a way to get iPhones to actually play them.</p>
<p>ffprobe says:</p>
<pre><code> merc@mercs-thinkpad:/disk/home/merc/Downloads$ ffprobe 5801005ff1861ba1729757fbffprobe version 2.8.8-0ubuntu0.16.04.1 Copyright (c) 2007-2016 the FFm... | <p>Oh my... amazingly, it was the file name! Even though the mime type is set, if the file name is not <code>.mp4</code>, the file won't be treated as a movie file!</p>
<p>(Which is amazing to think about, if you know Apple's history...)</p>
|
Migrating jquery code from stateless react component to es6 component <p>I have a component that renders a Boostrap modal. I want to add a class to another button when the modal appears, so I have the below code:</p>
<pre><code>const AddContact = () => {
}
$('#myModal').on('show.bs.modal', function (e) {
$(... | <p>I guess you closed the function's bracket early in 2nd line. Try with this.</p>
<pre><code>const AddContact = () => {
$('#myModal').on('show.bs.modal', function (e) {
$('.add-button').addClass("orange-btn")
})
return (
//modal
...
}
</code></pre>
<p>Hope this will help.</p>
|
How do I dynamically create a common proxy class of two unrelated classes? <p>I have two unrelated java classes (only <code>*.class</code>, no <code>*.java</code>) like this:</p>
<pre><code>public class Trick {
public String getName() { return "Jack"; }
public String trick() { ... }
}
</code></pre>
<p>and</p>... | <ul>
<li>If you need functionality of both classes/interfaces you can use</li>
</ul>
<pre><code>public <TT extends Trick & Treat> void process(TT thing){
//...
}
</code></pre>
<p><strong>edit:</strong> </p>
<ul>
<li>Implement new Interface MyProxyHandler</li>
</ul>
<pre><code>public interface MyPr... |
Serializing a JSON object for a Django URL <p>I have a JSON object that looks like this:</p>
<pre><code>var obj = {
"selection":[
{
"author":"John Doe",
"articles":[
"Article One",
"Article Two"
]
}
]
}
</code></pre>
<p>I want to pass this o... | <p>You are not properly serializing the object to JSON, even if you say you do. The correct way would be to use <code>JSON.stringify()</code>, as @dunder states.</p>
<p>Than you parse it back to an object with <code>JSON.parse(strignifiedJson)</code>.</p>
<pre><code>var obj = {
"selection":[
{
... |
ClickOnce Fails to Launch After Install <p>Iâm having a problem with my ClickOnce application at work. The application refuses to launch when its icon is clicked. No error is displayed, it just doesnât load. This is only happening on some deployment machines, not all. As far as I know, all of the machines at work a... | <p>So, I fixed it ... But not sure how/why this was a fix. Despite the fact that we've disabled UAC on all machines (via the control panel) because we don't want it, I had to make sure that the EnableLUA regkey was set to 1. The thing is, some of the affected PCs already <em>had</em> EnableLUA set to 1, so I simply set... |
how to save change from split content of text <p>I've managed to cut the string a sentence into a word. but the new results can be viewed in the browser when the program runs. but these results can not change the condition of the strings in the original text file. I want the contents of the original text file identical... | <p>You can use:</p>
<pre><code>file_put_contents ( $fileName); //here filename indicates the name/path of source file.
</code></pre>
|
React.js, Is `DOMContentLoaded` equal with `componentDidMount`? <p>People always say that you can get the <code>dom</code> in <code>componentDidMount</code> .</p>
<p>Is that mean <code>componentDidMount</code> is equal with <code>DOMContentLoaded</code>, or mean when <code>componentDidMount</code>, the <code>dom</code... | <p>The <code>DOMContentLoaded</code> event is <em>exclusive</em> to when the <a href="https://developer.mozilla.org/en/docs/Web/Events/DOMContentLoaded" rel="nofollow">entire HTML page loads</a>. Therefore, this event is only fired once and only once, throughout the entirety of the web page's lifetime. <code>componentD... |
json array for events array in jQuery fullcalendar <p>i'm using jQuery fullcalendar and i must set events dynamically, from a query, using a JSON array, for now i'm trying with a static array.
This is my code:</p>
<pre><code><?php
$arr = array(
array(
"title" => "first",
... | <p>Problem is in your code. Try below one.</p>
<pre><code><?php
$arr = array(
array(
"title" => "first",
"start" => "2016-10-18T10:00",
"end" => "2016-10-18T11:00"
),
array(
"title" => "second",
... |
Publishing to npmjs - using a machine user? <p>We're currently working on an open source project (wicked.haufe.io, an API Management system), and for this system, we would like to publish an SDK to npmjs.com for situations where you would want to extend the functionality of the system (it's designed for that).</p>
<p>... | <p>From my understanding machine credentials have nothing to do with it. The only credentials that matter are when you try to "npm publish", it will ask for npmjs.com credentials which you have already created (and can be anything). As far as company and publishing information for the package, you can arbitrarily inclu... |
MySQL find ids for which there is no existing row <p>I have three tables : </p>
<pre><code>1. Person (person_id, name) : (1, "Test1"), (2, "Test2"), (3, "Test3")
2. Role (role_id, description) : (1, "Admin"), (2, "Designer"), (3, "Developer") ..
3. PersonRoles (person_id, role_id) : (1 , 1), (1, 2), (2, 3), (2, 1), (3... | <p>Here is your solution: </p>
<pre><code>select person_id from Person
where person_id not in
(select person_id from Role r
inner join PersonRoles pr on pr.role_id=r.role_id
where r.description='Designer')
</code></pre>
|
modify lists removing elements without making a mess <p>I'm trying to resolve now a task that sounds like that:</p>
<blockquote>
<p>''write a function modi(la, lb) that takes in input 2 lists la and lb that have the same number of elements inside. The function should <strong>modify</strong> lists la and lb camparing... | <p>You should use <code>del</code> to delete list item. Also you should iterate from end to the beginning because if you will go from the beginning and delete let say <code>1st</code> element the element that was on the <code>3rd</code> place will be now on the <code>2nd</code></p>
<p>It should look like</p>
<pre><co... |
Login via enter button <p>I have login form and it works fine, but I don't know how to make it work via enter buttom. I did try to make it with JS, but it didn't work for some reason.</p>
<p>Also I think I made horrible code for login :(, but it works.</p>
<pre><code><div class="clientLogin">
<form>
... | <p>Make the sign in input a type of <code>submit</code>. Like this,</p>
<pre><code><input type="submit" class="zzzz" onclick="auth()" value="sign in"/>
</code></pre>
<p>This should fix the issue. It's a type of <code>button</code> currently which doesn't get triggered on submitting enter key. </p>
|
How to get result in blocks immediately? <p>I'm using blocks to get header fields from response in one class and I have to get that in another class. </p>
<p>I implemented code like this</p>
<p>In first class:</p>
<pre><code>- (void)viewDidLoad {
[super viewDidLoad];
UserAuthentication *auth = [[UserAuthenti... | <p>You are misunderstanding the basic principle of async operation that runs in background thread and when the operation is completed it gives you data in completion block.</p>
<p>To get response in viewDidLoad Method of second class you need to use blocks. like below</p>
<pre><code>-(void)getUserConfigurationOnCompl... |
Custom GL plugin's GL Impact Line disappearing when the transaction posting flag is "YES" <p>I have created the <strong>custom GL Plugin and configured to the Invoice Transaction.</strong>
Every created <strong>Invoice Transaction is goes for approval process</strong>, once the invoice is approved the <strong>status ch... | <p>NetSuite Custom GL Impact will run on on both Non posting and Posting.</p>
<p>Can you provide the code you are using in the Custom GL plugin? It sounds like a logic issue. Do you have any logs?</p>
|
Vertical Bar chart using rotation='vertical' not working <p>From the matplot lib example <a href="http://matplotlib.org/examples/lines_bars_and_markers/barh_demo.html" rel="nofollow">lines_bars_and_markers</a>
using <code>rotation='vertical'</code> does not make it vertical. What am I doing wrong?</p>
<pre><code>"""
S... | <p><code>barh</code> is for horizontal bar charts, change to <code>bar</code> and then swap around the data for the axes. You can't simply write <code>rotation='vertical'</code> because that isn't telling the <code>matplotlib</code> library anything, it's just creating a string that is never used. </p>
<pre><code>impo... |
Last digit in a exponent b <p>I wrote this code to find last digit of a exponent b but SPOJ says its wrong. I tried almost all test cases but couldn't find the error.
Problem:<a href="http://www.spoj.com/problems/LASTDIG/" rel="nofollow">http://www.spoj.com/problems/LASTDIG/</a>
My Solution:</p>
<pre class="lang-java ... | <p><code>Math.pow</code>is a floating point operation! It doesn't compute the exact result. That's why you have that funny cast to int in there.</p>
<p>Therefore you need to use <code>BigInteger</code> or write your own exponentiation function. The latter is the more desirable since the way more efficient way to compu... |
Restoring NSTableView sort order after reload <p>In Interface Builder, an NSTableView is set up with sortable columns (by clicking on the column headers). The data source uses an NSArray. When updating a row of data, the table's data is reloaded which refreshes the array and lays out the data rows according to the ar... | <p>The answer was under my nose. I can use the data source method <code>tableView:sortDescriptorsDidChange:</code>.</p>
<p>I think a cleaner solution is to post the notification for the data source. It should be the same notification as when clicking on a column header. If anyone knows, kindly share here.</p>
|
Mysql Trigger IF(select) doesn't work <p>The following code in my trigger doesn't work when I add a record in the table 'Assessment' (column seen of table 'person' wasn't updated when adding a record in 'Assessment')</p>
<pre><code>IF ((select CAST(max(`date`) AS DATE) from `Assessment` where x = NEW.x and (`date` !... | <p>the issue was in the condition on date that's why I get null in query, so I added the conditions <code>'and day(</code>date<code>) < day(NEW.</code>date<code>) and month(</code>date<code>) <= month(NEW.</code>date<code>) and year(</code>date<code>) <= year(NEW.</code>date<code>)'</code> then I got the right... |
Import existing web application into Bluemix <p>I've existing Web application developed and would like to import the entire repo into Bluemix. This web application required Web Server, Node.js and Bootstrap. Which is the most appropriate buildpack under CloundFoundry should I use?</p>
<p>I've uploaded my application t... | <p>use following steps to add your git repository for Deploying app on Bluemix.</p>
<p>1) Create an app on bluemix by clicking on "Cloud Foundry app "and then
<a href="https://i.stack.imgur.com/esXqv.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/esXqv.jpg" alt="enter image description here"></a> </p>
<p>The... |
How to create an isolated html page without any link/reference to the home page using angularjs? <p>Am new to AngualrJS. I reference index.html as my home page and I want to map a partial link which is not at all related to the home page(<code>index.html</code>); example,
<code>http://www.example.com/newpage</code>.</... | <p>To achieve what you want, you need to have two differente apps. Every app needs a fixed route prior to the '#'.</p>
<p>So, in your case, index.html would have it's app, and newpage.html would have another one.</p>
|
Clicking on an element targeted by id but result is still incorrect <p>I am testing Selenium-Webdriver on Google Translate page. What I'm trying to do is:</p>
<ol>
<li>See if the input language is already presented</li>
<li>If presented, is it selected? If not select it.</li>
<li>If not present, open the more language... | <p>I would do something like this. You should focus on creating functions that do a single thing so that you have reusable code that can be used in various tests easily.</p>
<p>Here are my functions</p>
<pre><code>static public String getTranslatedText()
{
new WebDriverWait(driver, 10).until(new ExpectedCondition... |
Custom attributes for angular translate <p>I am doing a research if I can use a non alphabetic characters for custom translate value attributes. I walked through that doc</p>
<p><a href="https://angular-translate.github.io/docs/#/guide/06_variable-replacement" rel="nofollow">https://angular-translate.github.io/docs/#... | <p>According to <a href="http://stackoverflow.com/a/9337047/744534">this</a> answer, <code>@@</code> can't be an identifier.</p>
<p>Hence <code>@@</code> can't be part of translation texts.</p>
|
Number guessing what the user has in mind C <p>I'm trying to create a program where the program guesses what kind of number the user has in mind. First it will ask the user for a minimum and maximum number, for example 1 and 10(the number I have in mind should be between 1 and 10 then).<br>
Lets say I have the number 4... | <p>You can't use <code>==</code> to compare strings (which are multiple bytes).</p>
<p>Either do <code>if (input[0] == 'L')</code> to just compare the first letter the user entered to a literal value, or <code>if (strcmp(input,"L") == 0)</code> to compare everything the user entered to the 1 character string literal (... |
WSO2 DAS + Clustering APIM with mysql <ol>
<li><p>My APIM version is 1.10.0 and DAS is 3.0.1.</p></li>
<li><p>At first ,I deploy no Clustering APIM + DAS with mysql. the stats shows good.</p></li>
<li><p>Then,I clustering APIM into publisherãstoreãkeymanager and gateway.Configured APIM and DAS order <a href="https:... | <p>Seems in store node, data are publishing are enabled and working. But gateway node data not publishing. Please try to verify the gateway node configuration. Also check gateway node can access the DAS node.</p>
|
counting number of true/talse periods in r <p>I have a boolean vector derived from a time series. It basically looks like this: c(true, false, true, true, false, false, false, true, true...).</p>
<p>I want to count the periods in which the vector is true. Example: for a vector like this: c(true, true, false, true) it ... | <p>How about this:</p>
<pre><code>aaa[is.na(aaa)] <- FALSE
sum(rle(aaa)$values)
</code></pre>
<p>Convert <code>NA</code>s to <code>FALSE</code>, and the see how many <code>TRUE</code> values there are in the run length encoding (<code>TRUE</code> is stored as 1, <code>FALSE</code> as zero).</p>
|
Java printf statement giving errors <p>I'm using Eclipse on an a homework assignment and I'm really struggling. The goal is to write a payroll program that has a user enter their name, hours worked, pay rate, federal and state tax withheld, and then outputs the calculated information of their amounts withheld as well a... | <ul>
<li>Printf methode is available from java version 1.5. Make sure that your jdk version is greater than or equal to 1.5.</li>
<li>Your error tells you that the first argument of the printf method must be a Locale type see an exmaple <a href="http://www.tutorialspoint.com/java/io/printstream_printf_locale.htm" rel="... |
How to prevent JS code from being parsed/evaluated by compiler? <p>I have a module with a lot of JS code in it. Module is created like so:</p>
<pre><code>(function (root, factory) {
// root === window
root.MyModuleName = factory();
})(this, function () {
'use strict';
var MyModuleName = function() {
// A l... | <p>You can't. The JS engine has to evaluate the code to create the function before it can assign the function anywhere.</p>
|
Not Fount :/media/app/images/my_image.png <p>image not found but the image exist at exact location .</p>
<pre><code>print(profile.image.url)
#/media/app/images/my_image.png
</code></pre>
<p>prints the image location but when i used in my template , other column are
current but image is not found</p>
<pre><code>prof... | <p>Add to end of your root urls config <code>urls.py</code> this:</p>
<pre><code>from django.conf.urls.static import static
from django.conf import settings
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
</code></pre>
|
why is my ArgumentMatcher never called? <p>I try to run the simplest test </p>
<p>with mockito argument matcher:</p>
<pre><code>import org.mockito.ArgumentMatcher;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcres... | <p>try this:</p>
<pre><code>public boolean matches(String argument)
</code></pre>
|
Where to get a wordpress plugins for online exam with countdown time embedded with it <p>Please have being working a a project where i want to use wordpress platform to make an online test, i was able to install one plugins called WATU but it doesn't has the countdown time features for each test. I just need someone to... | <p>Please have a look at all the plugins that you can find here:</p>
<p><a href="https://wordpress.org/plugins/tags/exam" rel="nofollow">https://wordpress.org/plugins/tags/exam</a></p>
|
Sequelize validate not working on save() <p>I have a sequelize model with a validation like this:</p>
<pre><code>validate: {
isEmail: {msg: 'This field must be an E-Mail!'}
}
</code></pre>
<p>It's working when I use <code>.create()</code> method but not working when I use <code>.update()</code>/<code>.save()</cod... | <p>To validate the instance you can call <code>.validate()</code> on the model instance as well.</p>
|
How to scale a BigDecimal in Java? <pre><code>import java.math.*;
class Moqueet {
public static void main(String [] args){
double a, b, c;
BigDecimal bg1, bg2;
a = 1;
b = 10000;
c = a / b;
bg1 = new BigDecimal(c);
MathContext mc = new MathContext(10);
... | <pre><code> bg1 = bg1.setScale(4, RoundingMode.FLOOR);
</code></pre>
|
Select max time from second table JOIN <pre><code>SELECT q.uid, q.title, q.category_id, CONCAT(CONCAT(q.text,'\n'),a.answer) as description
FROM questions q
LEFT JOIN (
SELECT question_id, crdate, GROUP_CONCAT(text SEPARATOR '|| ') answer
FROM answers
GROUP BY question_id
ORDER BY crdate DESC
) a ON... | <p>Try this</p>
<pre><code>SELECT q.uid, q.title, q.category_id, CONCAT(CONCAT(q.text,'\n'),a.answer) as description
FROM questions q
LEFT JOIN (
SELECT question_id, max(crdate) as crdate, GROUP_CONCAT(text SEPARATOR '|| ') answer
FROM answers
GROUP BY question_id
ORDER BY crdate DESC
) a ON q.uid ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.