Welcome to HostingForumz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Possible to sort and omit duplicates in a list using javas..

 
   Web Hosting Problem Solving Community! (Home) -> Webmaster RSS
Next:  google toolbar  
Author Message
Laphan

External


Since: Nov 24, 2007
Posts: 2



(Msg. 1) Posted: Sun Feb 03, 2008 5:10 pm
Post subject: Possible to sort and omit duplicates in a list using javascript
Archived from groups: alt>www>webmaster, others (more info?)

Hi All

I need to provide a function on my site whereby a user can enter a number of
ip addresses (one per line) so that I can submit this en masse to string
holding space in my db.

My problem is that I want to keep this list sorted as they enter the ip
addresses and I want to check for duplicates so that they don't enter the
same ip addresses twice.

I was going to do this as a simple form submit and add each entry as a
database row so that I could ORDER BY to get the sort and check for
duplicates on the submit, but this client/server submit really slows the
whole process. It would be great if I could order by and duplicate check on
the client side so that once done all I'm doing is one client/server 'post'
to the db.

Is this feasible?

Thanks

 >> Stay informed about: Possible to sort and omit duplicates in a list using javas.. 
Back to top
Login to vote
John Bokma

External


Since: Apr 27, 2005
Posts: 593



(Msg. 2) Posted: Sun Feb 03, 2008 5:10 pm
Post subject: Re: Possible to sort and omit duplicates in a list using javascript [Login to view extended thread Info.]
Archived from groups: alt>www>webmaster (more info?)

"Laphan" <admin.DeleteThis@DontSpam.com> wrote:

Wow, why didn't you post in even *more* groups?

> Hi All
>
> I need to provide a function on my site whereby a user can enter a
> number of ip addresses (one per line) so that I can submit this en
> masse to string holding space in my db.
>
> My problem is that I want to keep this list sorted as they enter the
> ip addresses and I want to check for duplicates so that they don't
> enter the same ip addresses twice.

The former is extremely annoying in my experience. I expect something I've
added to appear on the bottom of a list. If you keep a list sorted, people
might have to scan the whole list to see where it went.

As checking for duplicates, that should be a piece of cake in any
language, no need to keep it sorted. The keyword is a hash table (aka
associative array), I am sure JS does support something like that out of
the box. But read on...

> I was going to do this as a simple form submit and add each entry as a
> database row so that I could ORDER BY to get the sort and check for
> duplicates on the submit,

Assuming MySQL, you can safely insert duplicates by overwriting them with
ON DUPLICATE SET ...

If you put on top of your form: duplicates will be ignored, the user knows
what happens when he/she sees he's entered a duplicate. If he/she has
entered a duplicate it's already too late. I mean, you can remove it while
the line is entered, but the question is (to me): should you. And I would
say: no. (Also, without any warning the user wonders where the line went
she/he just entered).

--
John Bokma http://johnbokma.com/

 >> Stay informed about: Possible to sort and omit duplicates in a list using javas.. 
Back to top
Login to vote
Doc O'Leary

External


Since: Jan 07, 2008
Posts: 39



(Msg. 3) Posted: Mon Feb 04, 2008 9:48 am
Post subject: Re: Possible to sort and omit duplicates in a list using javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <Xns9A3999BDBC5B1castleamber DeleteThis @130.133.1.4>,
John Bokma <john DeleteThis @castleamber.com> wrote:

> The former is extremely annoying in my experience. I expect something I've
> added to appear on the bottom of a list.

As a slight refinement, I expect it to be added to the list closest to
the input. I recently put a dynamic list on a site that has the entry
field at the top, and while I started by adding new items to the bottom,
it seemed to flow better when they're added to the top and the list
"grows" down.

> If he/she has
> entered a duplicate it's already too late. I mean, you can remove it while
> the line is entered, but the question is (to me): should you. And I would
> say: no. (Also, without any warning the user wonders where the line went
> she/he just entered).

A possible solution is to do a live scan of the list as the user enters
characters and highlight matches. That allows both feedback for
duplicates (nobody should be surprised if they can't be entered again)
and doubles as a search utility.

--
My personal UDP list: 127.0.0.1, 4ax.com, buzzardnews.com, googlegroups.com,
heapnode.com, localhost, ntli.net, teranews.com, vif.com, x-privat.org
 >> Stay informed about: Possible to sort and omit duplicates in a list using javas.. 
Back to top
Login to vote
John Bokma

External


Since: Apr 27, 2005
Posts: 593



(Msg. 4) Posted: Mon Feb 04, 2008 3:09 pm
Post subject: Re: Possible to sort and omit duplicates in a list using javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Doc O'Leary <droleary.usenet.DeleteThis@1q2008.subsume.com> wrote:

> In article <Xns9A3999BDBC5B1castleamber.DeleteThis@130.133.1.4>,
> John Bokma <john.DeleteThis@castleamber.com> wrote:
>
>> The former is extremely annoying in my experience. I expect something
>> I've added to appear on the bottom of a list.
>
> As a slight refinement, I expect it to be added to the list closest to
> the input. I recently put a dynamic list on a site that has the entry
> field at the top, and while I started by adding new items to the
> bottom, it seemed to flow better when they're added to the top and the
> list "grows" down.

Good point

>> If he/she has
>> entered a duplicate it's already too late. I mean, you can remove it
>> while the line is entered, but the question is (to me): should you.
>> And I would say: no. (Also, without any warning the user wonders
>> where the line went she/he just entered).
>
> A possible solution is to do a live scan of the list as the user
> enters characters and highlight matches. That allows both feedback
> for duplicates (nobody should be surprised if they can't be entered
> again) and doubles as a search utility.

Might be another good point, it's something that depends a bit on the list
to be entered, etc. Maybe have an on-off checkbox next to the input field.

--
John Bokma http://johnbokma.com/
 >> Stay informed about: Possible to sort and omit duplicates in a list using javas.. 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]