Questions tagged [extractor]
The extractor tag has no usage guidance.
extractor
167
questions
18
votes
4
answers
6k
views
Why does opencv FREAK extractor remove so many keypoints, specifically using ORB detector
I am using OpenCV 2.4.3 c++ interface to find matching points between two images. The first attempt was using SURF. The only problem is the consuming time, so I tried the new FREAK extractor. Using ...
17
votes
5
answers
1k
views
Can extractors be customized with parameters in the body of a case statement (or anywhere else that an extractor would be used)?
Basically, I would like to be able to build a custom extractor without having to store it in a variable prior to using it.
This isn't a real example of how I would use it, it would more likely be ...
16
votes
1
answer
439
views
Can a Scala "extractor" use generics on unapply?
Can't I use a generic on the unapply method of an extractor along with an implicit "converter" to support a pattern match specific to the parameterised type?
I'd like to do this (Note the use of [T] ...
12
votes
2
answers
1k
views
Scala extractors - skip unused parameters
given following code:
abstract class MyTuple
...
case class MySeptet(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int, g: Int) extends MyTuple
case class MyOctet(a: Int, b: Int, c: Int, d: Int, e: ...
10
votes
6
answers
14k
views
Scala: Pattern matching when one of two items meets some condition
I'm often writing code that compares two objects and produces a value based on whether they are the same, or different, based on how they are different.
So I might write:
val result = (v1,v2) match {...
9
votes
1
answer
3k
views
Understanding pattern matching on lists
I've been playing around with Extractors lately and was wondering how the List extractors work especially this:
List(1, 2, 3) match {
case x :: y :: z :: Nil => x + y + z // case ::(x, ::(y, ::(...
9
votes
3
answers
8k
views
Replacing case class inheritance with extractors preserving exhaustiveness checks in Scala
I have a simple class hierarchy that represents a graph-like structure with several distinct types of vertexes implemented using case classes:
sealed trait Node
sealed abstract case class Vertex ...
8
votes
5
answers
4k
views
Scala, partial functions
Is there any way to create a PartialFunction except through the case statement?
I'm curious, because I'd like to express the following (scala pseudo ahead!)...
val bi = BigInt(_)
if (bi.isValidInt) ...
8
votes
1
answer
6k
views
Pattern matching against Scala Map entries
Is there any Scala trick to enable pattern matching against map keys? In other words, I'd like to have an extractor that beside the Map instance accepted also a key value that would mean I want this ...
7
votes
1
answer
2k
views
Nested Scala matchers why Some(Some(1),1) can't match?
It seems that nested matching doesn't work, which is a strange limitation.
An example of the behaviour follows:
Some(Some(1),2) match {
| case Some(Some(a),b) => a
| case e => e
| }
<...
7
votes
1
answer
1k
views
Why does a for-comprehension used with an extractor of type tuple result in a compile warning on `filter`?
Given the following code snippelt:
import scala.util.Try
def foo(x:Int) : (Int, String) = {
(x+1, x.toString)
}
def main(args: Array[String]) : Unit = {
val r1: Try[(Int, String)] = for {
v ...
6
votes
2
answers
14k
views
How to get access token with JMeter JSON Extractor and use it?
I'm trying to extract access token from the body response and use it in Header Manager for authorization.
The response of the first request is
Response
Then I use regular expression for extracting ...
6
votes
3
answers
2k
views
Modeling with Scala case class
I'm attempting to model responses from REST APIs as case classes which I can use pattern matching on.
I thought it would be a good fit assuming inheritance, but I see that this is deprecated.
I know ...
6
votes
1
answer
185
views
Match order with an extractor
I defined a custom extractor to get the last element of the list, as in https://stackoverflow.com/a/6697749/1092910:
object :+ {
def unapply[A](l: List[A]): Option[(List[A], A)] = {
if (l....
6
votes
1
answer
557
views
Difference between home made extractor and case class extractor
According to the scala specification, the extractor built by case classes is the following (scala specification §5.3.2):
def unapply[tps](x: c[tps]) =
if (x eq null) scala.None
else scala.Some(x....
5
votes
1
answer
938
views
How to use extractor in polymorphic unapply?
I don't really get this little thingy. I have an abstract class Box
with several sub-classes for different types. For example
abstract class Box
class StringBox(val sValue : String) extends Box
The ...
4
votes
1
answer
9k
views
JMeter JSON Extractor, extract all values of one key in a string
Using Apache JMeter ver 3.2 r1790745 (the latest) to test a JSON Web Service, the response is like:
[ {
"id" : 3,
"description" : "Back",
"name" : "back"
}, {
"id" : 1,
"description" : ...
4
votes
2
answers
2k
views
unapply method of a case class is not used by the Scala compiler to do pattern matching, why is that?
abstract class Animal
case class Cat(name: String) extends Animal
case class Dog(name: String) extends Animal
Say I have defined Cat and Dog, two case classes.
Then I use them like this:
val ...
4
votes
1
answer
2k
views
How do I write a scala extractor for a case class with default parameters?
I have the following case class with a default parameter and I'm wondering how I can write an unapply method so that I can just extract the first two parameters.
I hope the code below is clear.
case ...
4
votes
3
answers
4k
views
Jmeter Regular Expression Extractor find ItemID in xml
I am new to jmeter; I hope that I can describe my problem to you well enough.
I am trying to use regex to extract an ItemID attribute from an xml element. Which I then use in another request. This is ...
4
votes
2
answers
2k
views
Implicit parameters won't work on unapply. How to hide ubiquitous parameters from extractors?
Apparently unapply/unapplySeq in extractor objects do not support implicit parameters. Assuming here an interesting parameter a, and a disturbingly ubiquitous parameter b that would be nice to hide ...
4
votes
1
answer
267
views
Scala 2.8.0.RC2 compiler issue on pattern matching statement?
Why does the following module not compile on Scala 2.8.RC[1,2]?
object Test {
import util.matching.Regex._
val pVoid = """\s*void\s*""".r
val pVoidPtr = """\s*(const\s+)?void\s*\*\s*""".r
val ...
3
votes
5
answers
356
views
Is there a more functional way, than using custom case statements, to write this in Ruby?
Imagine the following code:
class SimpleLetter
def values
("a" .. "z").to_a
end
def ===(other)
values.include?(other)
end
end
class Vowel < SimpleLetter
def values
["a","e",...
3
votes
1
answer
3k
views
Scala alternative cases match syntax with different type of extracted value
object NoSense {
def main(args: Array[String]) {
val value = "true" match {
case value @ (IntValue(_) | BooleanValue(_)) => value
}
require(value == true)
}
}
...
3
votes
1
answer
733
views
Cannot instantiate ObservableList with an extractor
I have a custom object FermentableInRecipe, which populates a TableView. In order to respond to changes to items in the list, as well as the list itself, I have decided to employ an extractor. Here is ...
3
votes
2
answers
5k
views
youtubeExtractor for Android
I want to use youtubeExtractor for android app and I found library like
compile 'com.github.HaarigerHarald:android-youtubeExtractor:master-SNAPSHOT'
There is a sample code in github I copied it. ...
3
votes
1
answer
170
views
Scala inline unapply extractor
The following code:
object Test {
@inline def unapply(i: Int): Option[String] =
i match {
case 1 => Some("Got 1")
case 2 => Some("Got 2")
case 3 => throw new ...
3
votes
1
answer
2k
views
Scrapy crawl extracted links
I need to crawl a website, and crawl every url from that site on a specific xpath
for example.:
I need to crawl "http://someurl.com/world/" which has 10 links in the container (xpath("//div[@class='...
3
votes
1
answer
756
views
What is the time and space complexity of a Scala's head/tail extractor?
What is the time and space complexity for this:
def isPalindrome[A](x: Seq[A]): Boolean = x match {
case h +: middle :+ t => h == t && isPalindrome(middle)
case _ => true
}
Does it ...
3
votes
1
answer
144
views
Why and how to migrate case class to extractor in Scala
In the Programming in Scala discussion on when to use case classes and when extractors, they say
Extractors break [the] link between data representations and patterns ... This property is called ...
3
votes
0
answers
190
views
android chromium resourceExtractor error
Suddenly my app in production phase started to get Chromium ResourceExtractor errors in api 7 even though I had not changed anything in the app.
Is there any solution or update for this error?
Fatal ...
2
votes
2
answers
5k
views
Scala pattern matching variable binding
Why can't I bind the variable in @-style when the extractor return Option[<Type>]? I.e. this one does not work:
object IsUpperCase {
def unapply(s: String): Option[String] = {
if (s....
2
votes
4
answers
785
views
Scala Extractor unapply called twice
I just discovered that unapply in my extractor is being called twice for some reason.
Anyone know why, and how to avoid it?
val data = List("a","b","c","d","e")
object Uap {
def unapply( s:String )...
2
votes
4
answers
4k
views
jmeter grab value from response data
I have a question about grabbing a certain value from the html response data in Jmeter.
I've been trying both regular expression and xpath extractor(see below) but having no luck.
This is part of the ...
2
votes
2
answers
2k
views
Regular Expression Extractor Jmeter - I want to send email for 404 response codes
I am writing a test case which will hit a URLs and send email if response code is 404. Request is going well and Response also coming but I am stuck at Regular Expression Extractor.Sample Request ...
2
votes
1
answer
3k
views
Java Metadata Extractor causes java.lang.NoClassDefFoundError
I'm trying to use this library for Images Metadata Extraction in Java https://github.com/drewnoakes/metadata-extractor , using NetBeans.
I imported the file metadata-extractor-2.7.0.jar into the jar ...
2
votes
1
answer
2k
views
Apache Kafka Streams : Out-of-Order messages
I have an Apache Kafka 2.6 Producer which writes to topic-A (TA).
I also have a Kafka streams application which consumes from TA and writes to topic-B (TB).
In the streams application, I have a custom ...
2
votes
1
answer
5k
views
How to use variable extracted in JSON path extractor for further steps of scenario?
I have created one scenario in Jmeter where i am loging in. (For this scenario i am using REST APIs)
For this i took one "HTTP Header Manager" , "HTTP Request Sampler".
After login i am extracting ...
2
votes
4
answers
751
views
Does U-SQL support extracting files based on date of creation in ADLS
We know U-SQL supports directory and filename pattern matching while extracting the files. What I wanted to know does it support pattern matching based on date of creation of the file in ADLS (without ...
2
votes
2
answers
3k
views
How to get python to load right library (a .dylib, not .so.3 on OSX)
I'm using the extractor module in python 2.7 via pip install extractor. I'm on OS X using homebrew, and I have previously run homebrew install libextractor. This creates files with extensions .a ...
2
votes
1
answer
384
views
Making a Extracting/Compiling program in Visual C++ 2010 but have errors
I am building a .SM2 and .RM2 extractor/compiler for a game but I am having trouble with the code. I am not experienced in C++ at all and the code is source code given by the original creator. Even ...
2
votes
1
answer
196
views
jmeter: I want to extract 2 values from 2 different json objects where 1 json object will validate my condition & other value I want to extract
My JSON Response is :
{
"results": [
{
"attributes": [
{
"format": "internal",
"name": "resourceid",
"type": "STRING",
"value": "...
2
votes
1
answer
826
views
How to use variable in extractor with unescaped body?
I have a JMeter user variable x = abc and an extractor from a response, with regex = abc\d, using the unescaped body option.
If I try to change the regex to ${x}\d, it doesn't work, however, if I ...
2
votes
2
answers
127
views
Why doesn't Scala optimize calls to the same Extractor?
Take the following example, why is the extractor called multiple times as opposed to temporarily storing the results of the first call and matching against that. Wouldn't it be reasonable to assume ...
2
votes
1
answer
156
views
What are Maven plugin extractors?
In the configuration of a maven plugin's build, where you are specifying configuration for the "maven-plugin-plugin" there is something called an extractor. I also see it when building the plugin (...
2
votes
0
answers
87
views
TableView navigates to the last row cell after commit edit when using extractor for TableView ObservableList
I have a TableView of Bean type that consists of name, quantity, price, and total price columns. These columns have the ability to be changed using TextFieldTableCell except the total column which is ...
2
votes
0
answers
2k
views
Wordpress error ssv3_payload_extractor-xxxxxxxx.php startup
I have the ssv3_payload_extractor-GKoBgg5TR4.php startup error listed as the first item in my error log.
It seems to be causing my site to be not accessible. I can't login into admin, as I get: This ...
2
votes
1
answer
274
views
Scala extractors: a cumbersome example
Everything started from a couple of considerations:
Extractors are Scala objects that implements some unapply methods with certain peculiarities (directly from «Programming in Scala 2nd edition», I'...
1
vote
3
answers
2k
views
JMeter JSON Path Extractor with input variable
Is it possible to use input variables in the JSON Path Extractor expression?
I tried expression $.[${someInputVariable}].name, but it didn't work.
Data format:
[
{name=a},
{name=b},
{name=c}
]
...
1
vote
1
answer
63
views
No pattern match for Seq[Seq[T]]
def example1(sss:Seq[Seq[String]]) = sss match {
case Seq(a, b) :+ Seq(c, d) :+ tail => true
}
val res1 = example1(Seq(Seq("a", "b"), Seq("c","d")))
// scala.MatchError: List(List(a, b), List(c, ...