devicemap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reza Naghibi <re...@apache.org>
Subject Re: Uncommitted patch DMAP-107
Date Mon, 13 Jul 2015 16:06:49 GMT
Looks like "HTC One X" and "HTC One X+" match the same since 1.0 normalizes
out the regex. Otherwise, im guessing the + is an error because its likely
meant to be a literal \+ and not a regex. Since the patterns are identical,
the device choosen is the first one reached during iteration. The patch
changes this because the data structure changes from a HashMap to a
HashSet, so iteration order is different.

I could add logic to the ranking function to fix this, but at this point
there is no use. Getting matching to properly work on the ODDR data will
never be perfect because the data has many errors like the one above. So as
always, the solution here is the fix the bad pattern.

Also, some problems with your split() method. It shouldn't be static and
you can remove the reference to Apache commons by using String.isEmpty().
Not sure we need the null check, but null is allowed in normalize(), so its
best to err on the side of safety. Below is the corrected version:

---

private List<String> split(String text) {
        List<String> nonemptyParts = new ArrayList<String>();

        String[] parts = TEXT_SPLIT_PATTERN.split(text);

        for (String part : parts) {
            String normalizedPart = Pattern.normalize(part);

            if (normalizedPart != null && !normalizedPart.isEmpty()) {
                nonemptyParts.add(normalizedPart);
            }
        }

        return nonemptyParts;
    }

---

Also, the style of the 1.0 Java client is to be explicit with imports and
not use the wildcard. Just a small style nitpick. So if you can correct the
above split() function (and fix the imports), your patch should be good to
go with the HTC One X tests removed.

I will put this in the ticket.

Thanks


On Mon, Jul 13, 2015 at 10:53 AM, Reza Naghibi <reza@naghibi.com> wrote:

> This sounds good. Why does the patch remove 2 user agents from the test
> file?
>
> On Mon, Jul 13, 2015 at 6:06 AM, Volkan Yazıcı <volkan.yazici@gmail.com>
> wrote:
>
> > Then if there are no objects, I will proceed patching 1.x this week.
> >
> > On Mon, Jul 13, 2015 at 11:59 AM, Werner Keil <werner.keil@gmail.com>
> > wrote:
> >
> > > If it improves the performance, as Stefan mentioned, I see no reason
> why
> > > you should wait.
> > > 2.x is very likely to be much different, most importantly using JSON,
> so
> > > the patch could not even match there as it does now;-)
> > >
> > > Cheers,
> > > Werner
> > >
> > > On Mon, Jul 13, 2015 at 11:39 AM, Volkan Yazıcı <
> volkan.yazici@gmail.com
> > >
> > > wrote:
> > >
> > > > Hello Reza,
> > > >
> > > > I was waiting for the 2.0 release of the client to commit those
> > changes.
> > > Do
> > > > you want me to commit them to the 1.x branch?
> > > >
> > > > Best.
> > > >
> > > > On Fri, Jul 10, 2015 at 9:40 PM, Reza Naghibi <rezan@apache.org>
> > wrote:
> > > >
> > > > > No reason. This patch was submitted by Volkan before he had commit
> > > > rights,
> > > > > so he posted it on JIRA. Volkan is now a committer and he is
> allowed
> > to
> > > > > work on the 1.0 clients, so im pretty sure he is free to commit the
> > > > patch.
> > > > >
> > > > > On Fri, Jul 10, 2015 at 3:15 PM, Stefan Seelmann <
> > > > mail@stefan-seelmann.de>
> > > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I browsed through the devicemap-client Java code and saw some
> > > > > > performance optimizations in DeviceMapClient.classify(). Then
I
> saw
> > > > that
> > > > > > there is already an issue and patch available since last
> December.
> > Is
> > > > > > there a reason why it is not yet committed? The patch currently
> > has a
> > > > > > compile error as commons-lang is not in dependencies but that's
> > easy
> > > to
> > > > > > fix.
> > > > > >
> > > > > > Kind Regards,
> > > > > > Stefan
> > > > > >
> > > > > > [1] https://issues.apache.org/jira/browse/DMAP-107
> > > > > >
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message