input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
enumerateObjects failing on NSOrderedSet <p>In Swift 2 I was able to do this:</p>
<pre class="lang-swift prettyprint-override"><code>let foo = NSOrderedSet()
foo.enumerateObjects {
obj, idx, _ in
...
}
</code></pre>
<p>In Swift 3 I'm getting an error</p>
<pre><code>Ambiguous use of 'enumerateObject... | <p>Try like this:</p>
<pre><code>let foo = NSOrderedSet(array: [1, 2, 3, 1, 1, 6, 1])
for (offset,element) in foo.enumerated() {
print(offset)
print(element)
}
</code></pre>
<p>You can also do it using forEach as follow:</p>
<pre><code>foo.enumerated().forEach {
print($0.offset)
print($0.element)
}
... |
How to use Authorization Token token=A-123456789qwertyuio12 Header in Retrofit 2.0 <p>im trying to consume an api that has that authorization header, i can get a 200 response in Postman with all data but cant get it to work in retrofit</p>
| <p>May be you need add the <code>Token</code> using OkHttp Interceptor.</p>
<pre><code>OkHttpClient client = new OkHttpClient.Builder()
.addNetworkInterceptor(mTokenInterceptor)
.build();
</code></pre>
<p>then add it to <code>Retrofit</code>:</p>
<pre><code>Retrofit retrofit = new Retrofit.Builder()
... |
Calling base class of a class in an assembly loaded into a seperate app domain <p>I've been fighting with this for a few days now and can't find anything on google for this particular situation. I know what I want to do is possible because I have worked with another application that does it (Exit game Photon) Photon un... | <p>Not sure if its the "proper" way but I figured out a way to do it by creating a serializable class call ApplicationData with the fields I need then instantiating a new ApplicationData class and adding it to the AppDomain data area wich my base class in the plugin can access</p>
<pre><code>ApplicationData data = new... |
SQLException related to insert database values using ArrayList <p>Iam new to java and trying to develop small swing app, I have Inquiry model class which containing getters and setters and constructions and also iam getting input by user in JFrame. </p>
<p>Im getting this error <code>java.sql.SQLException: At least on... | <p>You are not setting any value in</p>
<pre><code> String sq = "INSERT INTO INQUIRY (IN_ID,IN_TITLE,IN_MSG,IN_DATE)VALUES(?,?,?,?)";
PreparedStatement pr = con.prepareStatement(sq);
// set values here
pr.executeUpdate();
</code></pre>
|
Firebase Cloud Messaging notification with curl getting MismatchSenderId <p>I'm developing Android apps with firebase(ver.9.4.0).</p>
<p>When I sent FCM notifications using tokens as shown below, only some devices couldn't get the notification.</p>
<pre><code>curl --header "Authorization: key=AIzaXXXXXXXXXXXXXXXXXXXX... | <p>Try to refresh the token into your database. Because when you uninstall the app or clear the data then token gets changed.</p>
|
How to click a button lying below UITableView <p>say, I have a button lying under <code>UITableView</code>, how can I click the button through the <code>UITableViewCell</code> but do not trigger the cell click event:</p>
<p><a href="http://i.stack.imgur.com/AtWZY.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/... | <p>Get the touch point on the main view. Then use following method to check the touch point lies inside the button frame or not. </p>
<pre><code>bool CGRectContainsPoint(CGRect rect, CGPoint point)
</code></pre>
|
Is Peripheral side implementation is needed at all in real practice <p>I am new to CoreBlueTooth, I can understand peripheral side implementation is required when we are using iPhone/iPad device as a BLE device, but I wanted to know if the peripheral implementation will be required at all while communicating with the a... | <p>You don't need to use <code>CBPeripheralManager</code> in this case, but you will use <code>CBPeripheral</code> objects that are retrieved from your <code>CBCentralManager</code></p>
|
Change background color in Yii2 gridview cell depend on its value <p>I am trying to make background color that depending on the value calculation number in one cell. This is my code:</p>
<pre><code>[
'attribute' => 'coefTK',
'label' => '<abbr title="Koefisien Jumlah Tenaga Kerja">TK</abbr>',
'encodeL... | <p>Use <code>contentOptions</code>:</p>
<pre><code>[
'attribute' => 'coefTK',
'label' => '<abbr title="Koefisien Jumlah Tenaga Kerja">TK</abbr>',
'encodeLabel' => false,
'headerOptions' => ['style'=>'text-align:center'],
'contentOptions' => function ($model, $key, $ind... |
How to repeat same codes in 10 times and get those results in R? <p>Here is my code:</p>
<pre><code>f.x <- function(x) {
60*x^3*(1-x)^2
}
x <- seq(0, 1, length=100)
n.samps <- 1000
n <- 0 # counter for accepted
i <- 0 # iterations
samps <- numeric(n.samps)
while (n < n.samps) {
y <-... | <p>You can try placing your entire script into a function, and then just call it 10 times from a loop:</p>
<pre><code>getValue <- function() {
x <- seq(0, 1, length=100)
n.samps <- 1000
n <- 0 # counter for accepted
i <- 0 # iterations
samps <- numeric(n.samps)
while (n <... |
Conda update is too much time on Centos <p>Conda is taking too much time on CentOS. I m running the command conda --debug update conda. Here is the log not sure why it's taking too much time. </p>
<pre><code>DEBUG:conda.fetch:channel_urls=OrderedDict([('https://repo.continuum.io/pkgs/free/linux-64/', ('defaults', 1)),... | <p>Did this problem resolve itself for you? The problem, as the debug output shows, is that you were unable to access <a href="https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2" rel="nofollow">https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2</a> -- this is only a 300KB file. But the issue w... |
Strcmp wont return zero for same two same strings <p>I am reading in a CSV file using fscanf which has two fields. </p>
<pre><code>datatype_t*read(FILE* fp)
{
char name[66];
char data[1466];
if (fscanf(fp, "%[^,] %[^\n]", name, data) == 2) {
datatype_t *d = (datatype_t*)malloc(sizeof(datatype_t));
d->nam... | <p>From the <code>man fgets</code>:<p>
<code>fgets</code> reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A terminating null byte (aq\0aq) is stored after the last ch... |
View doesn't aligned in the center of layout <p>I have a simple layout, as follow:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Text... | <p>Try adding <code>app:layout_behavior="@string/appbar_scrolling_view_behavior"</code> to your Fragment's layout xml file.</p>
<p><strong>Edit1</strong>
<br/>
Actually it is behaving as it is supposed to.
When you have your <code>Viewpager</code> with:<code>app:layout_behavior="@string/appbar_scrolling_view_behavior"... |
Recursive function in Laravel 5.2 <p>I want to make a recursive function and pass it to view to build a category, sub-category in laravel 5.2 and how to create route and view and contrller for this code ..... this is my code ..can anyone help me ?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-c... | <p>I think your solution is here: <a href="https://github.com/etrepat/baum" rel="nofollow">https://github.com/etrepat/baum</a></p>
<p>this will automatically work for.</p>
|
How to update particular value of child in Firebase DB <p>I am following this <a href="https://firebase.google.com/docs/database/ios/save-data" rel="nofollow">document</a>. Following is my code for update:</p>
<pre><code>func updateDealResultToServer(key:String,dealResult : String)
{
let post = ["dealResul": deal... | <p>I suggest using <code>setValue</code> for single child updates (keep in mind that I am using Swift 3, slight syntax changes may apply but you should be fine):</p>
<pre><code>rootRef.child("komal_kyz").child(key).setValue(["dealResul":dealResult])
</code></pre>
|
Why we are using the method -(id)init and what are the uses? <p>While referring a sample code i found this snippet can any explain why it is used.</p>
<pre><code>- (id)init
{
self = [super init];
if (self) {
[[self view]setBackgroundColor:[UIColor redColor]];
}
return self;
}
</code></pre>
<p>and what is t... | <p>init and viewDidLoad both are completely different.</p>
<p>viewDidLoad called, when the view is loaded into memory, this method called once during the life of the <strong>view controller</strong> object. It's a great place to do any view initialization.</p>
<p>init method is an initializer method. Cocoa has variou... |
How to run c# code using notepad++? <p>I have trouble executing code that I have written in notepad++. As from what I have researched online, I should edit path in system variable to this C:\Windows\Microsoft.NET\Framework64\v4.0.30319. I have already changed it and it's still not working. After I type in test.cs, a wi... | <p>After compiling you c# file, execute it by just typing the name in your command prompt. Don't use extension again. Just type</p>
<pre><code>test
</code></pre>
<p>after compiling successfully in your cmd prompt, and you'll be fine. You can also use</p>
<pre><code>test.exe
</code></pre>
<p>to run it instead of jus... |
Why does sapply fail to use lubridate's parse_date_time while lapply does not? <p>Given: a simple 4x2 data frame filled with data of type character</p>
<p>Goal: the same data frame but with all the values replaced by the result of applying the following lubridate function call to them: <code>parse_date_time(df, orders... | <p>The reason is that <code>sapply</code> have by default <code>simplify = TRUE</code> and when the length or dimension of the <code>list</code> elements are same, it simplifies to a <code>vector</code> or <code>matrix</code>. Internally, Date time classes are stored as numeric,</p>
<pre><code>typeof(parse_date_time(... |
pass data from activity one to activity three directly while going through activity two but data should not be passed to activity two <p>I have three activities A,B and C. I need to pass some data from activity A to activity C. But the navigation is from A to B to C i.e. I can't go to activity C from activity A directl... | <p>use Interface to communicate with other Activity.</p>
<p>or you can make your variable <code>public static</code> on Activity1</p>
|
Groupwise computation in R <p>I have grouped and summarized a data frame in R so that I now have a table like:</p>
<pre><code>Group | Value | Count
==========================
A | 1 | 4
A | 2 | 2
A | 10 | 4
B | 3 | 2
B | 4 | 4
B | 2 | 3
C | 5 | 3
C... | <p>Here is a base R solution:</p>
<pre><code>sapply(split(df1, df1$Group),
function(x) round(sum(x$Count[x$Value == 2]) / sum(x$Count), 2))
## A B C
## 0.20 0.33 0.67
</code></pre>
|
Host or OS dependent settings in Visual Studio Code (VSCode) <p>In Visual Studio Code, is it possible to have different settings.json files dependent on the host or OS you are on, preferably in a layer above the user settings?</p>
| <p>There is no current way to achieve this within the product, but it is on their backlog. You can follow the <a href="https://github.com/Microsoft/vscode/issues/8962" rel="nofollow">issue</a> and give a thumbs up to it to show the team that it is important to you.</p>
|
Find aggregated sum of repetition spark <p>Input :<br></p>
<p>Name1 Name2<br>
arjun deshwal<br>
nikhil choubey<br>
anshul pandyal<br>
arjun deshwal<br>
arjun &nb... | <p>I would approach it using a set, which does not contain any order and therefore just compares on the content of the set:</p>
<pre><code>scala> val data = Array(
| ("arjun", "deshwal"),
| ("nikhil", "choubey"),
| ("anshul", "pandyal"),
| ("arjun", "deshwal"),
| ("arjun", "deshwal"... |
I am using Jquery Social feed. I am getting alert box from another site. how to disable that alert from it <p>Here is the alert box. I want to disable this alert box. </p>
<pre><code><script type="text/javascript">
jQuery(window).load(function() {
var param = document.URL.s... | <p>Simply overwrite <code>alert</code> with your own, empty, function.</p>
<pre><code>window.alert = function() {};
</code></pre>
<p>Integrating it with your code : </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-c... |
How can we access type and subtypes of enum in java? <p>I need to implement the following using <code>enum</code>.</p>
<pre><code>import java.util.*;
/**
*
* @author mukesh
*/
public class MyTest {
private List<SubTypes> subTypes = new ArrayList<SubTypes>();
enum Types {
PercentArea, Stacke... | <p>I think you need something like this</p>
<pre><code>private static void getSubTypes(Types type)
{
SubTypes[] values = SubTypes.values();
for(SubTypes value : values)
{
if(value.t == type){
System.out.println("found subtype "+ value);
}
}
}
</code></pre>
<p>hope this hel... |
Need advice about JOIN by LIKE operator <p>I have two data tables, one contain the customer data such as customer ID and used bonus codes. The second table is for internal notes, every note that i write about the customer is there, for example: gave to customer 12 bonus code GFT100.
know i need join this two table base... | <p>I'd advise adding a nullable <code>coupon_code</code> column to your notes table (assuming a note may only pertain to zero or one coupon code) and recording the optional code with each note when applicable. Searching for the code in the free text values could return false positives</p>
<p>... but, this join should ... |
Jquery not functioning properly in Google Apps Script <p>I have this code:</p>
<p><em>index.html</em></p>
<pre><code><!DOCTYPE html>
<html>
<div>
<form id="email_subscribe">
<input type="email" name="email" id="email" placeholder="Enter your email">
<input ty... | <blockquote>
<p>With IFRAME mode however HTML forms are allowed to submit, and if a
form element has no action attribute specified it will submit to a
blank page.
â <a href="https://developers.google.com/apps-script/migration/iframe#form_submission_are_no_longer_prevented_by_default" rel="nofollow">Offical D... |
Angular2 Observable error handling in template <p>I like the approach of new angular with observables. It prevents us from writing a long chain of <code>.done().fail().always()</code>. like in JQuery. It is happening under the hood in NG2 using only <code>| async pipe</code>. But how about the case when there might be ... | <p>There is currently no way to handle errors in the template. You can use operators like <code>catch()</code> to ensure errors don't reach the template.</p>
<p>See also this related open issue <a href="https://github.com/angular/angular/issues/7539" rel="nofollow">https://github.com/angular/angular/issues/7539</a></p... |
Save Data in mysql Using angularJs <p>I need to insert and retrieve data using Angularjs with PHP/Mysql</p>
<pre><code><form>
<label>Customer Name </label><input type="text"/>
<label>Customer Address </label><input type="text"/>
<label>Customer Image </label><... | <p>AngularJS is a frontend technology which means it will only work on browser. You cant save data from angularJS to MYSQL, you need to do that in a server application. In your case it is PHP.</p>
<p>To do this first you need to pass the data from client side to server side. Please check the below documentation to see... |
position of ViewPager item with Data Binding <p>I have implemented <code>ViewPager</code> with use of android Data Binding, it is working perfect with data and click events.</p>
<p>I have created <code>interface</code> for click event</p>
<pre><code>public interface ItemClickListener {
public void onItemClick();
... | <p>You can pass view in interface</p>
<pre><code> public interface ItemClickListener {
public void onItemClick(View view);
}
</code></pre>
<p>Than set position in tag which you already doing</p>
<pre><code>binding.getRoot().setTag(position);
</code></pre>
<p>And than you can get position from that view param... |
What does the e flag and special characters do in mysql? <p>I am studying mysql from <a href="http://dev.mysql.com/doc/refman/5.7/en/batch-mode.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.7/en/batch-mode.html</a> . On second paragraph it says: </p>
<blockquote>
<p>If you are running mysql under Windows a... | <p><code>-e</code> is actually short for <code>--execute</code>, that's probably why you had trouble finding it. <a href="http://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_execute" rel="nofollow">http://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_execute</a></p>
... |
VoIP Push Notifications in Ionic for iOS <p>From iOS 8 we can now use <a href="https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html" rel="nofollow">VoIP Push Notifications</a>.</p>
<p>I found <a href="https://github.com/phonegap/phonegap-plugin-push/issues/728"... | <p>I ended up creating the plugin myself. You can get it on npm <a href="https://www.npmjs.com/package/cordova-ios-voip-push" rel="nofollow">here</a>.</p>
<p>You can install the plugin with:</p>
<p><code>ionic plugin add cordova-ios-voip-push</code></p>
<p>and then use the plugin like this in your Ionic/Cordova app:... |
Ads Mob Sdk updation in eclipse <p>I just received email from Google that on 17th oct on-wards they will stop displaying ads as the methods got deprecated.I also studied about it on some links as follows :-</p>
<p><a href="https://firebase.google.com/docs/admob/android/quick-start" rel="nofollow">https://firebase.goog... | <p>I would suggest migrate to Android Studio and use <strong>inbuilt utility of adMob and Firebase</strong></p>
<p>In your case, please import your project into Android studio, it will suggest, ways to update project with latest SDKs.</p>
|
make command not tabbing to complete file names <p>Trying to use the 'make' command in linux to compile c programs for class. If I do make it works, but if I type 'make' and then start typing the file name and tab it doesn't autocomplete the file for me. It's kind of annoying and I'd like to be able to use it instead ... | <p>It probably does not complete, because the parameter following <code>make</code> is usually the name of the target (for the recipe) and not a filename.</p>
<p>It perhaps completes for options that expect a filename, like e.g. <code>make -f mymakefile</code>.</p>
|
MySQL, grouping words and saving them to two other tables <p>Have three tables:</p>
<pre><code>products (relevant columns: id, name)
wordgroups (relevant columns: id, wordgroup)
productwordgroups (relevant columns: wordgroupid, productid)
</code></pre>
<p>Now I would like to separate each products.name into wordgroup... | <p>I have solved the second part of the problem for you, that is if you extract all the letters to separate rows for the given name.</p>
<p>The extracting will need to be done in a procedure.</p>
<p>My code, where letters is input table and letter is a column:</p>
<pre><code>select * from letters
union all
select a.... |
Does deep nesting flexbox layout cause performance issue? <p>I have been working on a ReactJS project where I create most of the components using flexbox layout. Since with react, we can have deeply nested components, so my layout is having nested flexbox layout. </p>
<p>Now my question is, does this have any issue wi... | <p>Have done a little test. Rendered 100 components, each with 10 nested layout. With and without flexbox. Here are the code snippets:</p>
<p><strong>Component/index.js</strong></p>
<pre><code>@CSSModules(styles, { allowMultiple: true })
export default class TheComponent extends Component {
render() {
const { d... |
Stop a sticky element at a certain spot other than the top of the page? <p>I have a sticky sidebar that sticks 100px from the top of the page, the problem is when I scroll, the sticky element scrolls to the very top of the page, then jumps down to the 100px.</p>
<p>Is there a way to make it stop once it get to the 100... | <p>Add a margin-top of 100px to your sticky element</p>
|
How to include node-sass in nwjs (on windows) <p>I'm working on a multi-platform project in NW.js (node-webkit) and it has to use node-sass. The problem is that I can't seem to find any way to include it without an error on windows (x64). </p>
<p>Here's what I've tried:</p>
<ol>
<li>Require as is<br>
Error: A dynamic... | <p>I faced similar issue (but on linux) and failed to find any answer why node-sass does not work and how to fix it. But <a href="https://github.com/medialize/sass.js" rel="nofollow">sass.js</a> works for me (worker+script). Of course it isn't so convenient as node-sass (i.e you need to handle imports in a special way)... |
Data Division in MATLAB Neural Network Train Command <p>While training a neural network in MATLAB I am using "train" command. Is this command auto divide the data into training, testing, and validation sets or we have to divide the data manually. </p>
| <p>Yes, it does. But we can divide the data manually, if we want to. <code>net.divideFcn</code> and <code>net.divideParam</code> fields of the net object should be used:</p>
<pre><code>t=0:0.05:8; x= sin(t);
net = feedforwardnet(3);
net.divideFcn= 'dividerand'; % divide the data randomly
net.divideParam.trainRatio= 0... |
How do you create reusable Animations in Angular 2 <p>I'm playing with the Animation API, and I'd like to create a reusable animation like say sliding in content for top level router views. I managed to get through the funky meta data syntax (which is actually pretty cool once get past the crazy idea of using metadata)... | <p>One possible way is to put animation trigger code in separate file and export it as <code>const</code> variable and use it in component as below.</p>
<p>//animations.ts</p>
<pre><code>import { trigger, state, style, transition, animate } from '@angular/core';
export const slideIn = trigger('slideIn', [
state('*... |
How to add a serial number to my usb stick <p>I have a cheap usb stick. Unfortunately my stick has no serial number.</p>
<p>Is it possible to add an own serial number to my stick?</p>
| <p>No, this is not possible in general. To change the USB descriptors and add a USB serial number, you would have to modify the firmware of the USB stick. It's unlikely that the procedure for writing to it would be documented, or that the firmware itself would be available in source form. The effort it takes to figu... |
How to setup WebGL autocomplete on Visual Studio Code? <p>I need to develop a game HTML5 and WebGL on JS, but the editor does not suggest methods, fields, enums related to WebGL to become easier. Any ideas?</p>
| <p>You should download WebGl.d.ts, for example <a href="https://github.com/RicoP/webgl.d.ts" rel="nofollow">from here</a></p>
<p>And reference this file in first string of your JS file:</p>
<pre><code>/// <reference path="webgl.d.ts" />
</code></pre>
|
get cookies from a website <p>What are the ways of getting the cookies from a website from ways other than the following?</p>
<ul>
<li>Inspecting the browser</li>
<li>Using Selenium web drivers by using <code>driver.get_cookies()</code> command</li>
</ul>
| <p>you can also run javascript via selenium and use document.cookie.
it return the cookies in string format:</p>
<p>key=value;key=value</p>
|
Why is int a[0] allowed in c++? <p>I find that in the declaration of an array, we cannot specify the size of it like this</p>
<pre><code>int a[0];
</code></pre>
<p>I know, empty size array illegal in C++, but In my code, empty size array compiler allowed and give the output. </p>
<p>My code is here :</p>
<pre><code... | <p>It issues a warning, for example clang outputs:</p>
<pre><code>warning: zero size arrays are an extension [-Wzero-length-array]
</code></pre>
<p>this is undefined behaviour:</p>
<pre><code> a[0] = 10;
a[1] = 20;
</code></pre>
<p>Zero length arrays are extensions for gcc, why - you can read on it here:</p>... |
Create data labels for frequency plot in ggplot2? <p>In <a href="http://stackoverflow.com/questions/36495155/frequency-density-barplot-of-categorical-variable?noredirect=1&lq=1">this</a> question, a frequency figure can be created using ggplot. For example:</p>
<pre><code>f <- factor(sample(letters[1:5], 100, r... | <p>You can add <code>geom_text()</code>:</p>
<pre><code>library(ggplot2)
ggplot(dat, aes(x=f, y=..count.. / sum(..count..), fill=f)) +
geom_bar() +
geom_text(stat = "count", aes(label=..count../100))
</code></pre>
<p><a href="http://i.stack.imgur.com/Um9JI.png" rel="nofollow"><img src="http://i.stack.imgur.com/U... |
Multiple Identity Provider Login OAuth/Open ID <p>There are mobile applications such as games where they allow the user to register and log in using Google, Facebook, or their own server. After logging in using third party provider, they seem to be able to store user information such as game progress to their server so... | <p>Resource owner grant is a dead end here. You need to switch to a logon workflow using a browser. This will give you the external logins for "free".</p>
<p><a href="https://vimeo.com/171942749" rel="nofollow">https://vimeo.com/171942749</a></p>
<p>This is also encouraged for security reasons - see the spec I link t... |
Passing raw SQL query as an argument to Repo.all() in Ecto <p><code>Ecto.Adapters.SQL.query(Repo, "Select * from table", [])</code> seems to execute the query and returns the data. Is there a way to define a query based on raw sql such that it can be passed to <code>Repo.all()</code> as an argument?</p>
<p>I'm looking... | <p>You cannot pass raw sql to Repo.all like this.<br>
Best you can do is pass some unsupported database function as fragment or find workaround.</p>
<pre><code>#UNION ALL
iex(1)> result1 = Model1 |> select([m], m.title) |> Repo.all
["a", "b"]
iex(2)> result2 = Model2 |> select([m], m.title) |> Repo.a... |
Maven "Update Project" operation in Eclipse results in PMD "unable to find referenced rule" error <p>I have a Maven project imported into Eclipse via m2e. The project includes Spring and other dependencies, but for some reason they are not being recognized by Eclipse at all. When I attempt to use "Update Project..." (r... | <p>Go to your project folder and run <code>mvn eclipse:eclipse</code> before running <code>Update Project</code>. I hope it will resolve the issue.</p>
|
How to check if two variables point to the same object in memory? <p>For example:</p>
<pre><code>struct Foo<'a> { bar: &'a str }
fn main() {
let foo_instance = Foo { bar: "bar" };
let some_vector: Vec<&Foo> = vec![&foo_instance];
assert!(*some_vector[0] == foo_instance);
}
</code>... | <p>I did some digging on Rust's GitHub and found out that <a href="https://github.com/rust-lang/rust/commit/f17d972014625eae13ac6d7fe98ff82a110a14d3" rel="nofollow">there used to be a function for this in <code>std</code></a>, but it's not there anymore. There is an <a href="https://github.com/rust-lang/rfcs/issues/115... |
PHP compare value from database <p>I have a form with more then 4 fields and all data inserted into those fields are related, so i want to achieve something different.<br>
For example - I have 4 fields with names <code>class</code> <code>class_time</code> <code>class_teacher</code> & <code>batch_name</code> and eac... | <p>before inserting new data you can check the things by below given query and if that query return more than 0 rows you can show an error message </p>
<pre><code>select * from `tablename` where `class_time` = '".$class_time."' and `class_teacher`='".$class_teacher."'
</code></pre>
<p>You shouldn't use any mysql_*-fu... |
Why is the property value not instantly updated when multi-threading? C# <p>I have a Task running which updates a Property in another thread. </p>
<p>The moment it updates it, inside a loop it rechecks the variable and often happens that the variable still isn't updated? (a second, two)</p>
<p>Here's an example:</p>
... | <p>if this variable is shared between threads, it must be declared as volatile.
<a href="https://msdn.microsoft.com/en-us/library/x13ttww7.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/x13ttww7.aspx</a></p>
|
PHP header location throws back error <p>I want to redirect mobile users to my mobile site so I did this in a file named <code>myfile.php</code></p>
<pre><code><?php
$useragent=$_SERVER['HTTP_USER_AGENT'];
if((preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|i... | <p>It does what it says on the tin. You've sent output on line 1 of index.php. Once information has been output, it's too late to send redirection instructions. Do first the include, and then send the html:</p>
<pre><code><?php //note this is the line 2 and it doesn't contain any space
$home = $_SERVER['DOCUMEN... |
List view link contains special symbol <p>My <code>listview</code> URL appears like this: </p>
<pre><code>http://localhost/inventorymanagement/#/~2Finventory~2Frequest~2Fitem~2F/list
</code></pre>
<p>How do I change it into a readbale form like this?: </p>
<pre><code>http://localhost/inventorymanagement/#/inventor... | <p>ng-admin uses angular-translate, go and watch it how it works with ng-admin.</p>
|
Beautifulsoup findall() can't find all targets <p>I want to crawl some pictures in Redfin website, but it seems that FindAll() method can't find all the image url whose parent class is ImageCard.</p>
<p>Here's the code:</p>
<pre><code>from bs4 import BeautifulSoup
import urllib2
def make_soup(url):
headers = {'User... | <p>The html does not include the links to these extra photos. That is why you can't find it. They are being created with javascript and your program does not process javascript.</p>
<p>However, if you look carefully, you will find this:</p>
<p><code><meta content="http://media.cdn-redfin.com/photo/48/bigphoto/983/... |
Qtquick qml : How to seperate Logic from UI in Qtquick UI Application? <p>Suppose, I want to seperate Logic code from UI code as myApp.qml and myAppForm.ui.qml.</p>
<p>ui.qml does not support javascript logic, for example,mouse events.</p>
<p>Suppose, the following problem.</p>
<pre><code>//myAppForm.ui.qml
import Q... | <p>You can extend the mouse area using alias property. Here is modified code.</p>
<pre><code>//myAppForm.ui.qml
Item {
Property alias rectMouseArea: mouse1
Rectangle {
id: rectangle1
color: "#a0ebfb"
anchors.fill: parent
MouseArea {
id: mouse1
anchors.fill: parent
}
... |
how to set the context of another class from different class? <p>I have a main activity and a settings activity. The settings activity class is fired via intent when clicked on a menu item Settings. Now, i want to make sure the default values are set in the preferences so inside onCreate for MainActivity i call the fol... | <p>use application context and save values into prefereces with different name.</p>
|
Autofac: Resolving generic interface in a generic method <p>The generic interface:</p>
<pre><code>public interface IGeneric<T>{}
</code></pre>
<p>The client:</p>
<pre><code>public class ClientClass
{
public void DoSomething<T>()
{
//what to inject in constructor
//to get an imple... | <p>Assuming you have a class implementing your interface</p>
<pre><code>public class MyGeneric<T> : IGeneric<T>
{
}
</code></pre>
<p>and you have registered it in your container</p>
<pre><code>builder.RegisterGeneric(typeof(MyGeneric<>)).As(typeof(IGeneric<>));
</code></pre>
<p>then you can ... |
Fitting an empirical CDF curve to find exact vaue <p>I am trying to find the exact value of any number using the empirical cdf. What's the best way to get the exact value? Can I use a fitting tool and then estimate it using the fitted function?</p>
<pre><code>[f,x] = ecdf(samples);
</code></pre>
<p>i.e How do I find ... | <p>You can get an approximate value of f(x) by finding the shape (σ) and location (μ) parameters that best fit the curve in a least squares sense.</p>
<p>Here's an "example" set of noisy "test data" with a normal distribution (similar to your sampled data):</p>
<pre><code>>> % ytest = f(xtest, mutest, ... |
Angular UI tabs - change active tab programaticlly <p>I have a webpage with two angular ui tabs. I adding a new button into this page and I want to add this button-click behavior: when the button clicked, swap the tab to the other tab. </p>
<p>For example: </p>
<ul>
<li>If the current active tab is "first" - make the... | <p>You are using an old version of <strong>Angular UI Bootstrap (0.14.3)</strong></p>
<pre><code><uib-tabset>
<uib-tab heading="First" active="selected == 1">
First data
</uib-tab>
<uib-tab heading="Second" active="selected == 2">
Second data
</uib-tab>
</uib-tabset>... |
inserting sql with loop <p>I have the table <code>PERSONAL</code> </p>
<pre><code>ID_PERS NAME
---------------
11 azerty
22 uiop
</code></pre>
<p>and the table <code>TOURNE_LABEL</code></p>
<pre><code>ID_TOUR NAME
--------------
1 w
2 p
3 v
</code></pre>
<p>I want to lo... | <p>SQL is all about set based operations. If you're thinking about a loop, chances are you're heading in the wrong direction. For this problem, you could cross-join the tables, thus producing all the possible combinations, and use the insert-select syntax:</p>
<pre><code>INSERT INTO ls_pda
SELECT id_pres, id_tour... |
ggplot - altering the height of each overlapping variable on a density plot <p>I'm quite new to R and ggplot2 so apologies if this is an obvious question, but I've searched around and can't find anything about this exact issue</p>
<p>I have a ggplot density plot for 6 variables on the same plot, overlapping. What I am... | <p>Yes this is possible although I wouldn't recommend it. What you can do is just divide the distribution by it's maximum and then multiply with the target height.</p>
<pre><code># some example data:
x = seq(-5, 5, .1)
y1 = dnorm(x)
y2 = dnorm(x, .5, .2)
Y = cbind(y1, y2)
matplot(x, Y, type = 'l', bty = 'n', lty = 1, ... |
Create DataFrame with null value for few column. <p>I am trying to create a <code>DataFrame</code> using <code>RDD</code>.</p>
<p>First I am creating a <code>RDD</code> using below code -</p>
<pre><code>val account = sc.parallelize(Seq(
(1, null, 2,"F"),
... | <p>The problem is that Any is too general type and Spark just has no idea how to serialize it. You should explicitly provide some specific type, in your case <code>Integer</code>. Since null can't be assigned to primitive types in Scala you can use <code>java.lang.Integer</code> instead. So try this:</p>
<pre><code>va... |
Need Help in retreiving elements from embedded array in mgo(golang+MangoDB) <p>I m using golang in the backend and mongoDB as database.When i try to retrieve documents from one of the embedded array i m getting only one index of the embedded array in the result as the result.Please help me Thanks
My struct is like this... | <p>I am not sure that what you ask is possible in a single mongo query. I would rather get all
elements and the filter in go with something like this:</p>
<pre><code>var result []*Employee
err := c.Find(nil).All(&result)
if err != nil {
// do stuff...
}
// For each result, filter the Leave values having a to ... |
How can i change the PHP value in textbox through Javascript <p>I have a textbox the value load from PHP Here is the code</p>
<pre><code><input type="text" id="fName" value="<?php echo $row['fName']; ?>" disabled/>
<input type="button" value="Edit" onclick="changeValue('fName')" />
</code></pre>
<p... | <p>After clicking on the button, the page will reload so that the value of the database will be restored.</p>
<p>Please change </p>
<pre><code><input type="button" value="Edit" onclick="changeValue('fName')" />
</code></pre>
<p>to </p>
<pre><code><input type="button" value="Edit" onclick="changeValue('fNam... |
Get data in my RecyclerView <p>I started to work with Retrofit. In my application i have one RecyclerView with two ViewHolder's, where trying to get data from my models, in logs coming <em>type</em>:</p>
<pre><code>@Override
public void onResponse(Call<DropDown> call, Response<DropDown> response) {
... | <p>Everything seem ok to me in your adapter. Try to call <strong>recyclerView.invalidate()</strong>. The idea is that you draw your RecyclerView before calling the <strong>onResponse</strong> method. Thus, you have empty view. The <strong>invalidate()</strong> method will try to redraw the view.</p>
|
dynamically show and hide link when switch button is checked/unchecked using jquery codeigniter <p>I have created a category module and switch button on then link show and switch button off then link hide. I am using codeigniter framemwork.</p>
<p><strong>controller:</strong></p>
<pre><code>class Category extends CI_... | <ol>
<li>add id attribute to your button in view:</li>
</ol>
<p>from <code><a href="<?= base_url("category/edit/{$value['id']}"); ?>" class="btn btn-success">Edit</a></code></p>
<p>to: <code><a id="btnEdit<?= $value['id']?>" href="<?= base_url("category/edit/{$value['id']}"); ?>" clas... |
Using of Smart Pointers on objects with automatic storage duration <p>Is it a problem if I apply Smart Pointers (<code>scoped_ptr</code>, <code>unique_ptr</code> or <code>shared_ptr</code>) on objects with automatic storage duration (i.e. stored on the stack)? I assume not as in both cases (with and without smart point... | <p><strong>Yes</strong>, there is a problem (a big one): you are using smart pointers to do something (I don't know what) they were not designed to do. They are meant to manage the lifetime of dynamically allocated objects. They solve a problem inherited from <code>C</code>, they offer ownership to objects which need d... |
Spring boot: How to pass variable from application-env.properties to another properties file? <p>I have application-local.properties and application-dev.properties in spring boot with following value:<br>
<code>logging.level.file=INFO</code> </p>
<p>And in another property file, log4j.properties, I want to get the ab... | <p>This is not so easy. By default, Spring-Boot comes with Logback configuration. However, there is a possibility to activate log4j too, which is discussed in the following thread: <a href="http://stackoverflow.com/questions/29225777/log4j-properties-in-spring-boot">Log4j.properties in Spring boot</a>.</p>
|
Script startup is slow when started with "Run with Powershell" <p>When I start a script with "Run with Powershell" its starting slow.
First it is searching for avaiable modules and after this its asking for a Execution Policy Change. Is there a way to suspend them?</p>
<p>Thanks for the help!</p>
| <p>Sure but <a href="https://technet.microsoft.com/en-us/library/hh849812.aspx" rel="nofollow">understand the consequences</a> </p>
<p>Set-ExecutionPolicy Unrestricted âForc</p>
|
SQL select if value higher save as column1, else save as column2 <p>Is it possible to do something like this:</p>
<pre><code>IF datalength(U_Partner) > 5 THEN save value '9999' into room_id and U_Partner value into partners_id
IF datalength(U_Partner) <= 4 THEN save value U_Partner into room_id and '9999'
valu... | <p>You could use two <code>Case</code> in this scenario. each <code>Case</code> for each column. The code would be something like this:</p>
<pre><code>Select
CASE WHEN datalength(T5.U_Partner) > 5 THEN '9999' ELSE T5.U_Partner END as room_id,
CASE WHEN datalength(T5.U_Partner) > 5 THEN T5.U_Partner ELSE '9999' E... |
How to find database name of \data\base postgres folders? <p>I have a large folder of 70 GB in my postgres installation under:</p>
<p><code>D:\Program Files\PostgreSQL\9.5\data\base\130205</code></p>
<p>Question: how could I find out which database is based on that folder?
I have like 10 databases running on the same... | <p>Just run <code>oid2name</code> as PostgreSQL operating system user.</p>
|
getting data from two different tables that have only one common column in sql server <p>My tables are as follows:</p>
<p>Please give me an SQL query to get the expected result set.</p>
<pre><code>Table1
A B C D E
1 2 C1 D1 E1
2 2 C2 D2 E2
3 2 C3 D3 E3
Table2 ... | <p>You need <a href="https://msdn.microsoft.com/en-us/library/ms180026.aspx" rel="nofollow">UNION</a> to combine results of two or more queries as below. As you have <code>C, D, E</code> in one table and they are not present in another you need to add this columns with <code>NULL</code> values, the same to <code>F, G, ... |
R Shiny, how to stop ggplot boxplots from updating themselves as in a group of linked boxplots <p>When I create a group of linked boxplots( selecting points in one boxplot highlights the corresponding points in all boxplots), the boxplots keep updating themselves for a uncertain amount of times (sometimes only once but... | <p>guess the reason is source table always keep updating when you brush one of plots. cause all of your plots use the same brush id, can not identify which input$brush_1 is the real "brush" action. One chart has been brushed,input$brush_1 changed and reactive table D will be updated as well. Another plot based on the n... |
Laravel multiple records update with Eloquent <p>I want to <code>Update</code> multiple records to the reference table. Here is the response of the <code>$request</code>.</p>
<pre><code>array:21 [
"_method" => "PATCH"
"_token" => "xXukmVEsMvyeBODIURqFx9Mhk4LviYrV6iLmAuOY"
"account_type" => "0"
"name" ... | <p>Check the fillable property <code>protected $fillable = [];</code> or use for all properties from the <code>$request</code> <code>protected $guarded = [];</code></p>
|
how to get local file with Restangular.service when a base url is not localhost? <p>I need to get a json file which is on my local machine, but my baseUrl in Restangular is not localhost...</p>
<p>So, here is the question:
Is it possible to get local file with Restangular.service when a base url is not localhost ? </p... | <p>See this post : <a href="http://stackoverflow.com/questions/371875/local-file-access-with-javascript">Local file access with javascript</a></p>
<p>It is not a problem with Restangular but with Javascript. </p>
<p>If you need it for test purpose you can try to find a way to do it (see the post)</p>
<p>If you are d... |
Why I get two different values in different browser? <p>I wrote this code:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var i = new Image()
i.src = 'http://img1.vued.va... | <p>It seems that by using jQuery to hook up the onload event, does it as you expect</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>var i = new Image()
$(i).css('width... |
Change class of label element in nput box in angularjs <p>I'm quite new in AngularJS. I'm trying to change the class of a label element while I'm doing something on an input text.</p>
<p>What I have is the following:</p>
<pre><code><form>
<input id="first_name" type="text" ng- blur="moveLabelFirstName=!mov... | <pre><code><form>
<input id="first_name" type="text" ng-model="name" ng-blur="moveLabelFirstName=!moveLabelFirstName"
ng-focus="moveLabelFirstName=!moveLabelFirstName"/>
<label for="first_name">
<span ng-class="{'active': !moveLabelFirstName}"> MyName </span>
<span ng-class="... |
Why is extra data being written to my output stream and how can I stop this? <p>I am trying to build a simple connection between my Java server (it sends information) and my C client (it receives info).</p>
<p>I want to send one single integer representing the size of an array and then a byte array itself. My java cod... | <p>The problem with my code was in this line as rightly pointed out in the comments</p>
<p><code>bytes_received = recv(connected,ptr1,10,0);</code></p>
<p>I was mistakenly trying to read more than 4 bytes which is the exact number needed to convert to an integer value. </p>
<p>Alternatively, to read 4 and only 4 byt... |
Wordpress: prevent code dupplication through similar page templates <p>I'm currently doing some refactoring on an existing wordpress website that uses 9 page templates and I have the following problem:</p>
<p>All these pages have the same code written to display the header, the sidebar etc.</p>
<p>I wonder if it's po... | <p>Create template your-name.php
Put that code</p>
<pre><code><?php
/*
Template Name: Your Name
/*
get_header();
get_sidebar();
get_template_part(template-hepler/your-name-content.php); // includes the actual page template.
get_footer();
?>
</code></pre>
<p>Create your-name-content.php in template... |
Get non-ASCII filename from S3 notification event in Lambda <p>The <code>key</code> field in an AWS S3 notification event, which denotes the filename, is URL escaped. </p>
<p>This is evident when the filename contains spaces or non-ASCII characters.</p>
<p>For example, I have upload the following filename to S3:</p>
... | <h2>tl;dr</h2>
<p>You need to convert the URL encoded Unicode string to a bytes str before un-urlparsing it and decoding as UTF-8:</p>
<pre><code>utf8_urlencoded_key = event['Records'][0]['s3']['object']['key'].encode('utf-8')
# encodes the Unicode to utf-8. The key shouldn't contain any non-ASCII at this point, but ... |
SonarQube support for .sqlproj and .dtproj <p>We have an active SonarQube Version 6.0 installation that is inspecting numerous C# projects e.g. those with a .csproj extension. If the .csproj contains a sql file then this file will be inspected.</p>
<p>In a new solution we have a mixture of .csproj, .dtproj and .sqlpro... | <p>SQL server projects are currently not supported by the <em>SonarQube Scanner for MSBuild</em>. You can track progress on this via ticket <a href="https://jira.sonarsource.com/browse/SONARMSBRU-243" rel="nofollow">SONARMSBRU-243</a>.</p>
|
Passing into ajax success function <p>I have developed following code, I need to pass exact 'this' value ( because lot of items with this class)in to ajax success function. How to do that. </p>
<pre><code>$(document).on('click', '.address_remove_link', function(e) {
var id = $(this).attr("data-id");
$.ajax({
... | <p>The issue is because the scope of <code>this</code> changes within the <code>success</code> handler function. You can store the outer scope in the click handler function instead. Try this:</p>
<pre><code>$(document).on('click', '.address_remove_link', function(e) {
var $link = $(this); // store reference here
... |
Why Elasicsearch query show partial results? <p>i get partial result from search into Elasticsearch:</p>
<pre><code>curl -XGET 'http://1.1.1.1:9200/my.index-*/api/_search?q=name:foo'
</code></pre>
<p>I get:</p>
<pre><code>{
"took": 14,
"timed_out": false,
"_shards": {
"total": 204,
"successful": 204,
... | <p>Use from and size, see the documentation on elastic website.</p>
<p><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html" rel="nofollow">click here to go to the documentation</a></p>
<pre><code>{
"from" : 0, "size" : 10,
"query" : {
"match" : { "nam... |
Enterprise Library 6 - VS 2015 - Windows 10 <p>Will EL6 be supported on Win10 & VS 2015 in the near future?
I wanted to install the ConfigConsole.visx in order to configure all things in the designer.</p>
<blockquote>
<p>VSIXInstaller.NoApplicableSKUsException: This extension is not
installable on any currentl... | <p>The VSIX extension is a zip file, so unzip it, edit the manifest and add 14.0 as supported version.</p>
<pre><code><InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[12.0,14.0]" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[12.0,14.0]" />
</code></pre>
<p>zip the con... |
Open simple PHP file with Javascript/jQuery <p>I have a PHP file on my server that stores one string <code><div id="username">my.username</div></code>. The URL is <a href="http://intranet/text.php" rel="nofollow">http://intranet/text.php</a>.</p>
<p>I would like to use some jQuery/Javascript to read this f... | <p>Try ajax as follow:</p>
<pre><code>$.ajax({
url:"your-phpfile.php",
success:function(data)
{
//data 'll hold the output of the php file
}
})
</code></pre>
<p>Remember before doing this include jquery library.</p>
|
How to run translate after training the model? <p>having run this code from : </p>
<pre><code>cd tensorflow/models/rnn/translate
python translate.py --data_dir [your_data_directory]
</code></pre>
<p><a href="https://www.tensorflow.org/versions/r0.10/tutorials/seq2seq/index.html#sequence-to-sequence-models" rel="nofol... | <p>First, make sure you've trained the model long enough to get a saved checkpoint (every 200 training steps by default)</p>
<p>Then, run <code>translate.py</code> with the <code>--decode</code> option:</p>
<pre><code>python translate.py --data_dir [your_data_directory] --decode
</code></pre>
<p>Then it will give yo... |
How to use a wildcard in an if statement? <p>Would it be possible to use a wildcard in an if statement like this?</p>
<pre><code>if(trim($line) != $DELETE)
</code></pre>
<p>Full code:</p>
<pre><code> $DELETE = "*TotalWar";
$data = file("../oneos/applist.txt");
$out = array();
foreach($data as $line) {
if(tr... | <p>You can use <code>fnmatch()</code> for this</p>
<p><code>fnmatch()</code> checks if the passed <code>string</code> would match the given shell <code>wildcard pattern.</code></p>
<p>for more info read <a href="http://php.net/fnmatch" rel="nofollow">http://php.net/fnmatch</a></p>
|
How do I get metadata using React-Native-Camera capture? <p>I can't figure out how to get captured image's <strong>metadata</strong>, using <a href="https://github.com/lwansbrough/react-native-camera" rel="nofollow">react-native-camera</a> capture method.</p>
<p>I was assuming it's something like: </p>
<pre><code>thi... | <p>This might be a shot in the dark, but if you read the first paragraph of the README.md <a href="https://github.com/lwansbrough/react-native-camera" rel="nofollow">https://github.com/lwansbrough/react-native-camera</a> it says:</p>
<blockquote>
<p>These docs are for the work in progress v1 release. If you want to ... |
Pass workspace of pipeline multibranch project to downstream freestyle project <p>My setup is as follows:</p>
<p>I have a top-level multibranch pipeline project that builds the various branches of my git project. In addition, I have a single freestyle project that is required for analysis of the individual multibranch... | <p>You can use Jenkins <a href="https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin" rel="nofollow">Copy Artifact plugin</a> in your downstream freestyle project, combined with a String parameter do define which job you should copy artifacts from.</p>
<p><strong>Upstream job</strong> :</p>
<pre><code>bui... |
using inheritance in akka actors <p>I am writing a TCP client server program using Scala/Akka.
Some of the actors on server side need to process TCP messages coming clients.
I have used(copied) code that basically parses the received TCP messages and on reception on a delimiter character the message is sent to someone... | <p>Yes that is possible and one example that adhere to what you describe is PersistentActor. <a href="http://doc.akka.io/api/akka/2.3.4/#akka.persistence.PersistentActor" rel="nofollow">http://doc.akka.io/api/akka/2.3.4/#akka.persistence.PersistentActor</a> which is a Subtype of Actor.</p>
<p>On my past company, we ab... |
how can convert hql to sql in hibernate 4 <p>I have method that convert hql to sql in hibernate 3 .but after upgrade to hibernate 4 i get exception for 5th parameter of the method .</p>
<pre><code> public String toSql(String hqlQueryText) {
if (hqlQueryText != null && hqlQueryText.trim().length() &g... | <p>The 5th parameter may be null, as you may see on some <a href="https://github.com/hibernate/hibernate-orm/blob/0a2a5c622e3eb30724e80bc8661c0ac55ebfb2be/hibernate-core/src/test/java/org/hibernate/test/locale/LocaleTest.java#L43" rel="nofollow">unit tests from hibernate source code</a>.</p>
|
Create file and folders defined in file <p>Good morning, I'm trying to create folders and empty files from a text file.
Per example, I have a <em>create.txt</em> with the following content:</p>
<pre><code>FolderA
FolderA\FolderB
FolderA\FileC.js
</code></pre>
<p>I know that I can create folders from a text file with ... | <p>How does this work for you?</p>
<pre><code>For /F %I In (test.txt) Do @If %~nxI==%~nI @(MD %I) Else @(Type Nul>%I)
</code></pre>
|
Spring - reading key/value xml file into Map <p>With the below xml; what is the concise way to get these values into a <code>Map</code> when using the Spring framework?</p>
<pre><code><item key="k1" value="val1" />
<item key="k2" value="val2" />
<item key="k3" value="val3" />
</code></pre>
<p>I coul... | <p>You have several possible solutions here (there are more, of course).</p>
<h3>Direct initialization</h3>
<p><code>SomeEntity.java</code></p>
<pre><code>public class SomeEntity {
private Map<Object, Object> maps;
//...
}
</code></pre>
<p><code>spring.xml</code></p>
<pre><code><bean id="SomeEntit... |
How to write integration tests with spring-cloud-netflix and feign <p>I use Spring-Cloud-Netflix for communication between micro services. Let's say I have two services, Foo and Bar, and Foo consumes one of Bar's REST endpoints. I use an interface annotated with <code>@FeignClient</code>:</p>
<pre><code>@FeignClient
p... | <p>Probably there is no way to make WireMock comunicate directly with Eureka Server, but you can use other variants to configure test environment that you need.</p>
<ol>
<li>In test environment you can deploy Eureka Service Registry under standalone Jetty servlet container and all the annotations will work like they d... |
How to insert a random noise to a signal <p>I have a random signal and I would like to add a random noise to it.</p>
<p>I can add noise to standard signals like Sine, Cosine, Square, sawtooth etc.. by using <code>awgn</code> or <code>randn</code></p>
<p>But this doesn't work when I try to add the same noise on a rand... | <p>If I understand you question you want to add some noise to your signal with a smaller interval than the sampling frequency of the signal itself.</p>
<p>In this case you can use <code>interp1</code> in order to interpolate your signal:</p>
<pre><code>signal = [200 180 160 120 80 80 70 70 65 50 55 120 10 10];
n ... |
App Crashes when trying to load action bar in Android Studio <p>I am quite new to Android and have been learning it myself with some help with online videos. I am attempting to use two activities to go back and forth using an action bar. The first activity is just the main activity however the second is a map activity.... | <p>Please use <code>ActionBarActivity or AppCompatActivity class instead of FragmentActivity</code> in Map Activity to have an action bar. My suggestion would be go for <code>AppCompatActivity</code>. <br>
<strong>Reason behind is -</strong> <br>
If you look at <a href="https://developer.android.com/reference/android/s... |
vba: Find function with .rows returning an unexpected result <p>I am trying to use the find function to make a wider code applicable to multiple instances of the same basic table. I look for table headers to the left of my table with this code</p>
<pre><code>preschoolStart = (Sheets("Rotas").Columns(3).Find(What:="Sch... | <p>Define the <a href="https://msdn.microsoft.com/en-us/library/office/aa224980.aspx" rel="nofollow">.Parent</a> worksheet reference properly and add an <code>After:=.Cells(.Cells.Count)</code> parameter to the <a href="https://msdn.microsoft.com/en-us/library/office/ff839746.aspx" rel="nofollow">Range.Find method</a>.... |
unrecognized escape sequence in a UNC with a varible <p>The following code gives me the <strong>unrecognized escape sequence</strong> error at the two backslash for: <code>\C$\temp</code> in the code.</p>
<p>I tried with double <code>\\</code> and <code>""</code> but still doesn't work.</p>
<p>The code <code>+ txtWSN... | <p>When in doubt, read the <a href="https://msdn.microsoft.com/en-us/library/aa691090%28v=vs.71%29.aspx" rel="nofollow">documentation</a>:</p>
<blockquote>
<p>C# supports two forms of string literals: regular string literals and verbatim string literals.</p>
<p>A regular string literal consists of zero or more ... |
Why outputting 'error: ' in Post-Build Event breaks my build in VS2012? <p>Adding </p>
<pre><code>cmd.exe /c "ECHO error : unexplainable"
</code></pre>
<p>causes this:</p>
<pre><code>1>------ Build started: Project: xxx, Configuration: Debug Win32 ------
1>EXEC : error : unexplainable
1>C:\Program Files (x8... | <p>It is a bug in MSBuild: <a href="https://github.com/Microsoft/msbuild/issues/766" rel="nofollow">https://github.com/Microsoft/msbuild/issues/766</a></p>
<p>The 'Exec' task used by the 'PostBuildEvent' target should have the 'IgnoreStandardErrorWarningFormat' set to true by default but it doesn't, so it fails when f... |
How to get data from two different fragments in tabs to main activity <p>Hello every one i want to know how to get data from 2 different fragments inside tab layout.</p>
<p>for example :In this image there two tabs tab1 and tab2 both have different values stored in edit text .</p>
<p><strong>tab1 helloooooo,
tab... | <p>You can use like this way:</p>
<pre><code>Bundle bundle = new Bundle();
bundle = getActivity().getIntent().getExtras();
YourFragment fragment = new YourFragment();
bundle.putString("yourKey", yourValue);
fragment.setArguments(bundle);
</code></pre>
<p>Then you can get them in your second fragment </p>
<p>in <stro... |
How can I backup mysql database with bareos? <p>What plugin I should use for that?</p>
<p>Can you show me your config from <code>bareos-fd.conf</code> and FileSet section from <code>bareos-dir.conf</code></p>
<p>Thank you!</p>
| <p>bareos-dir.conf</p>
<pre><code>FileSet {
Name = "mx-zag-mysql"
Include {
Plugin = "bpipe:file=/MYSQL/dump.sql:reader=mysqldump -uUser -pPassword --single-transaction --add-drop-database -B DB_name:writer=mysql -uUser -pPassword"
Options {
Signature = MD5 # calculate md5 checksum per file
... |
Symfony 2.7: Access not rendered property within the form-object <p>I need access to a property within the form object. The Problem is, that the property I want to access is not rendered in the form and not declared in the contractType class. </p>
<pre><code> class ContractType extends AbstractType
{
/*... | <p>Try </p>
<pre><code>$form->get('contract')->getData()->getDownloadId();
</code></pre>
<p>Please note I'm assuming you have a getter <code>getDownloadId</code> in your <code>Contract</code> class</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.