Stack Overflow

Subscribe to Stack Overflow feed
most recent 30 from 2018-02-21T10:21:19Z
Updated: 4 hours 28 min ago

Adding a reference to a NuGet package adds many unrelated assemblies to output

Mon, 02/19/2018 - 19:22

I'm working on a project, to which I would like to add Prometheus metrics exporting. There's a pretty great library for it over at NuGet that I've used. The new version (2.0.x, prerelease), however, is supposedly build for .NET Standard. That's fine, but my current project is built for the .NET Framework on Windows. When I add this NuGet package, however, I get over 100 assemblies added to the output of my project, including many that I don't think are related.

I added an issue for this to the project, but the project maintainer came to the conclusion that this is normal. I don't agree, however, and I'd like to know if there is a specific suggestion I can make to improve the situation.

What should prometheus-net change to avoid adding all these assemblies to the output of my project?

Get cryptocurrency twitter, website, and markets from api

Mon, 02/19/2018 - 16:15

I am trying to get the twitter name, website, and markets for any cryptocurrency listed on coinmarketcap.

For example: shows all of the data that I need but how would I parse the data listed on that page to get the twitter name and website associated with bitcoin?

Can we update external variable through linq?

Mon, 02/19/2018 - 10:13

Can we update external variable through linq, i.e., can we update a variable which is not being used in linq's scope through a linq?

Schedule camel routes after completion of particular route

Mon, 02/19/2018 - 10:13

We read a large file into a database (actually, we read Excel to csv and then dump the csv in a DB), when/after this is done i need to dump the results of several SELECT statements into files.

These file are then distributed by mail.

How can i schedule Camel to only start with the SELECTs after the entire file is dumped in the Db table?

Documentation of environment variables of Hyperledger Fabric components

Mon, 02/19/2018 - 10:13

Recently I was going through some implementations of hyperledger fabric , and I came across with some confusing environment variables for fabric components(some of which listed below). Is there any documentation where I can read about all the environment variables of fabric components. Currently I am am confused about below environment variables of fabric peer:


angular 5 routing with custom pattern

Mon, 02/19/2018 - 10:13

I develop a web application based on angular 5 that has about 100 legacy routes. All of them start with /home. e.g.

/home/financial-category-100 /home/banking-204 /home/508-accountant /home/jobs-in-location

I should redirect all of them one by one to their new destinations.

What is the best practice to solve this problem?

PHP - Filter with $_GET?

Mon, 02/19/2018 - 10:12

I'm looking to filter these small divs on the given filters on top (AB Main Hall, AB Club, Huis 23).

I'm guessing this has to be done with a $_GET? Here's my code in Pastebin from what I now have.

The items are pulled out from arrays, for example here's the first one.

<?php $concert = [ [ "datum" => "20 FEB", "naam" => "Kula Shakar", "zaal" => "AB Club", "image" => "" ], ?>

angularJS how to add +1 to a function that returns a date

Mon, 02/19/2018 - 10:12

I have a table with 5 cells in the header, each cell correspond to a week (example: week 01, week 02 and so on).

In the first cell the week is given like this:

<div class="monthCells">Week {{vm.selectedPeriod}}</div>

and the result is the text : "Week 01" in the header cell.

The code in the controller to show the week number is:

return moment.utc("WW");

It returns always the number of the FIRST week of the selected month, the user can with a date picker go from month to month, and in the table it will show the weeks in that month.

What's the best way to display the other 4 weeks? Because I only get the number for the first week, so what do I put in the other 4 cells?

I was thinking about a counter, so it adds +1 to the number I get with:

return moment.utc("WW");

but the problem is, this won't be in a ng-repeat, but the table header is static, so one solution I was thinking about was put something like this in the 5 header cells:

{{vm.selectedPeriod}} {{vm.selectedPeriod +1}} {{vm.selectedPeriod +2}} {{vm.selectedPeriod +3}} {{vm.selectedPeriod +4}}

So when the user switches month, every week number will be correct but it won't work because I get a string from my function and can't figure out how to parse it in that function with momentJS.

If someone has a solution for my idea, or if there is a better way to achieve this, please let me know

jquery .is(':disabled') not working

Mon, 02/19/2018 - 10:12

I want to add class disabled if li has attr disabled=true. But somehow this is not working. please see if anyone can help.


<ul class="expandable-panel"> <li class="expandable" disabled="true"> <button class="expand-title"> Disabled Lorem ipsum dolor sit amet, consectetur adipiscing elit. </button> <div class="panel-content"> <div class="content"> Content </div> </div> </li> <li class="expandable" disabled="false"> <button class="expand-title"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </button> <div class="panel-content"> <div class="content"> <form> <ul> <li> <label>Label</label> <input type="text"/> </li> <li> <label>Label</label> <ul> <li> <input type="radio" id="default" name="radio" value="Default"> <label for="default">Item to Select</label> </li> <li> <input type="radio" id="selected" name="radio" value="Selected" checked> <label for="selected">Selected Item</label> </li> <li> <input type="radio" id="disabled" name="radio" value="Disable"> <label for="disabled">Item to Select</label> </li> </ul> </li> </ul> </form> </div> </div> </li> </ul>


$('.expandable-panel').find('.expandable').each(function () { if(!$(this).is(':disabled')) { var title = $(this).find('.expand-title'); $(title).click(function () { $(this).parent().toggleClass('expanded'); }); }else { $(this).addClass('disabled'); } });

Convert byte array to string spark

Mon, 02/19/2018 - 10:12

I have a csv file which contains multiple fields. There are few fields for which data is coming in byte array format(b'1234'). I want to remove these b'(convert from byte array to string).

I came to know that we can convert byte array to string in two ways.

>>> s1 = b'Hi' >>> s2 = s1.decode('utf-8') >>> print(s2) Hi >>> s1 = b'Hi' >>> s2 = str(s1, 'utf-8') >>> print(s2) Hi

As there so many fields in CSV out of which only few fields contains byte array, I can't directily apply the function to each and every field. I don't have idea of which are are byte array fields and which ate string, int fields.

Any suggestions to convert byte array to string in csv file. I'm trying to do this in spark.

My code snippet :

df ='com.databricks.spark.csv').options(header='true', inferschema='true') \ .option("delimiter", ",").option("escape", '\\').option("escape", ':').\ option("parserLib", "univocity").option("multiLine", "true").load("file.csv")

Input Data:


As schema changes dynamically we don't have control of knowing which are byte array and which are string

sequential processing for n number of times in jenkins pipline

Mon, 02/19/2018 - 10:12

I have a jenkins pipeline to do parallel processing like below

buildNumber=[:] buildIterations.each{ buildNumber[x]=createExecution(it) } node('MyJenkins'){ stage{'Prepare database') -------- } parallel buildNumber def createExecution(String number){ cmd = { node('MyJenkins'){ stage('Build'){ --------------------- } stage('Test'){----------} stage('package'){--------} } return cmd }

But now i want to change this script to have sequential execution as this will run many builds in one job and have load on database at same time.

//should be executed once node('MyJenkins'){ stage{'Prepare database') -------- } //should be executed one after the other, but below code isn't even considered for job. It just stops after prepare database buildIterations.each{ number=it node('MyJenkins'){ stage('Build'){ --------------------- } stage('Test'){----------} stage('package'){--------} } }

I am new to scripting, please help me know what mistake i am doing

SonarQube Generic Excution Report - skipped test messages?

Mon, 02/19/2018 - 10:12

We are using SonarQube's Generic Execution Reports to input regression tests into a dedicated project. These are from a custom test suite for which a transform has been added to generate the specified results format.

Our questions/issues are as follow:

  1. How can we find the amplifying information for 'skipped' test case? The schema supports a message and longer body text for non-success results, and we can find these for 'failure' and 'error' results, but 'skipped' results do not seem to be accessible through the web client.
  2. We can only see the test case counts for previous submissions -- is it possible to get the amplifying data (message and body text) for previous test runs to compare with the latest?

Ideally I would like to see, in addition to trend graphs, a summary of result history as a grid/table of test cases against submission, with drill down to the amplifying data - possibly with comparison. Although that would probably need a new visualisation plugin if the information is being stored...

Gradle cannot resolve dependecies using ./gradlew assemble command

Mon, 02/19/2018 - 10:12

I have an android app which has 2 internal dependecies (android module, java module).

When I run ./gradlew assemble from console, it finish with an error: android module cannot find symbol from java module.

But if re-run this command several times, build will be successful, eventually.

P.S. From IDE build always succesful.

I'm using Gradle 4.1, migration to 4.3 and 4.5 the same issue

C++ Code to check rtp packets on port

Mon, 02/19/2018 - 10:12

what is the c++ library and code to check whether Real time protocol packets are getting received or not on particular port.

If Styles("").BuiltIn = False vb

Mon, 02/19/2018 - 10:10

I can not get a negative answer if the style is not in the style list


If Styles("FirstLine").BuiltIn = False Then Application.ActiveDocument.Styles.Add(Name:="FirstLine", Type:=wdStyleTypeParagraph) Application.ActiveDocument.Styles("FirstLine").AutomaticallyUpdate = False With Application.ActiveDocument.Styles("FirstLine").Frame .TextWrap = True .HorizontalPosition = wdFrameRight .HorizontalDistanceFromText = 4 .LockAnchor = False End With End If

And he returns the answer:

System.Runtime.InteropServices.COMException: 'The requested member of the collection does not exist.'

How can I get a negative answer?

How to convert my website in app with login page [on hold]

Mon, 02/19/2018 - 10:08

I know webView very well. But I want people to first login and then they enter the app What should I do? I just want a suggestion.

How to Select two tables and Concatenate them

Mon, 02/19/2018 - 10:05

I have two tables Staffs and Customers I want to select the records of each independent of each other but in one query in a such a way that neither of them affects each others' records. for example Selecting the customers, Selecting staffs records , What I want As long JOINING and UNION is not for this purpose

SiftGPU and opencv::FundamentalMat

Mon, 02/19/2018 - 10:05

I'm trying to use cv::FindFundamentalMat but when I try to get the 4th argument (that should be :

Output array of N elements, every element of which is set to 0 for outliers and to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s. )

It only gives me 0's.
I'm using siftGPU to generate the keypoints (x,y) that are used in the function.

My code :

/* ... Use siftgpu */ std::vector<int(*)[2]> match_bufs; //Contain (x,y) from the 2 images that are paired SiftGPU::SiftKeypoint & key1 = keys[match_bufs[i][0]]; SiftGPU::SiftKeypoint & key2 = keys[match_bufs[i][1]]; float x_l, y_l, x_r, y_r; //(x,y of left and right images) x_l = key1.x; y_l = key1.y; x_r = key2.x; y_r = key2.y; vec1.push_back(x_l); vec1.push_back(y_l); vec2.push_back(x_r); vec2.push_back(y_r); std::vector<uchar> results; int size = vec1.size(); results.resize(size); std::vector<cv::Point2f> points1(size); std::vector<cv::Point2f> points2(size); for (int i = 0; i < size; ++i) { points1.push_back(cv::Point2f(vec1[i], vec1[i + 1])); points2.push_back(cv::Point2f(vec2[i], vec2[i + 1])); } cv::Mat fund = cv::findFundamentalMat(points1, points2, CV_FM_RANSAC, 3, 0.99, results);


std::cout << std::endl << fund << std::endl; for (int j = 0; j < results.size(); ++j) { std::cout << (int)results[j]; }

fund is :

0, -0.001, 0.6 0, 0, -0.3 -0.4, 0.2, 0

and results is composed with only 0's.

I'm maybe fooling myself because findFundamentalMat says :

Array of N points from the first image. The point coordinates should be floating-point (single or double precision).

Since i'm not native speaker english, there is maybe something that I'm missing... My (x,y) are like (350.0, 560.0) (that are floating points). But do I have to normalize them between [0,1] and that's what floating-point means?

Or do I am missing something else?


(EDIT : I tried to normalize my points (divide by height and width of respective images, but results are still 0's)

:not selector doesn't hit children

Mon, 02/19/2018 - 10:03

I am unable to get :not working, been reading about it on css-tricks.

My Html:

<div class="small-radio-slider" data-slider="slide" data-slider-active="0" data-slider-resetto="left"> <div class="wrapper"> <div class="inner" data-slider-container="true"> <div class="slider-content"> <div class="li noTextNoHiddenText" data-slide-index="{{@index}}"> <div class="spotWrapper hiddenText">Not Me</div> </div> <div class="li noTextNoHiddenText" data-slide-index="{{@index}}"> <div class="spotWrapper hiddenText">Not Me</div> </div> <div class="li noTextNoHiddenText" data-slide-index="{{@index}}"> <div class="spotWrapper hiddenText">Not Me</div> </div> </div> </div> </div> </div> <div class="spotWrapper hiddenText">Me</div>

I need it to hit spotWrapper but not when it is inside NotextNoHiddenText..

But i am unable to get it to work with

.li:not(.noTextNoHiddenText) .spotWrapper { some styling which should only hit spotwrapper without .noText around it. }

To clarify

SpotWrapper is a partial of some boxes, which i use other places on a site. I also have a slider, which uses these boxes.

I need to make styling changes to the boxes, but NOT inside of the slider. So i have added the class noTextNoHiddenText to the box wrapper inside the slider.

Pushing an array into another array - nested

Mon, 02/19/2018 - 10:02

I am creating a store. The way it works is that when I click 'add to cart', I run a function which gets the id of the button. From that id, you can work out the name of the product, get the cost, quantity etc. For simplicity, this is the funciton code:

function getID(a){ var id = a.substring(0, a.length - 4); var id_quant = document.getElementById(id + '_val').value; var id_name = document.getElementById(id + '_nme').innerHTML; console.log(id + " " + id_quant + " " + id_name); }

You may notice that I remove the last 4 digits from, this is because when I run the PHP to echo all the results, i make the button_id equal to the uid from the database, concatenated with _btn.

What I would then like to do is to push this into an array, or use JSON.

What I am imagining is a nest array like : array[uid][cost], array[uid][name]. I'm just not sure how to do this.

It should be noted that in the function, a is actually

<button id='1_btn' onclick='getID('></button>

I have declared an array above the function, var array = [].

Any help on how to push a nest would be great.