Getting a non sorted list of members
I am trying to copy data from one set of products to another for 2 entities. Entity1 uses Map1 products whilst Entity 2 uses Map2 My sample Product dimension structure is as follows:-
Product
|_ProdA
|_ProdB
|_ProdC
|_ProdE
|_ProdF
|_Map1
|_ProdA (shared)
|_ProdB (Shared)
|_ProdC (Shared)
|_Map2
|_ProdA (shared)
|_ProdF (shared)
|_ProdE (shared)
The mapping is defined by the position of the shared products in Map1 and Map2 eg Prod A maps to ProdA, Prod B maps to Prod F etc
I have used the MDSHIFT function but I cannot get an unsorted member list (@RELATIVE etc sorts the retrieved member list and also removes duplicates).
Is there another way to copy data from Map1 to Map2?
Thanks
i'm trying to generate a sorted list of integers but
there is a restriction that these sorted randomed
generated integers must be uniformaly distribued
within the range of numbers needed for example (1
-1000)??does any body know how can we generate random
numbers and at the same time sorted with uniform
distribution??
i have thought about an idea like starting from 1 for
example and and then let the difference between each
two numbers is random within 1 to 10 then adding this
random integer to the last number generated and soo
on .. but i don't feel it is efficient as maybe the
random difference would be 1 each time . so i will
never get a uniformly sorted list .. any ideas or
suggestions ,please??My guess is that you generate the numbers first, then sort them. If you use the pseudorandom number generator, Random, will generate numbers with a roughly uniform distribution. You have to do some work to it if you want some other type of distribution.
Similar Messages
-
When I send a Group message from my address book, the entire group gets listed in the "To" line. How do I get each member to receive the message individually without listing all members? Its just messy is all. Any help is greatly appreciated.
Hey Grupo Castillo,
Thanks for the question. You can actually configure this behavior from Mail preferences:
1. Choose Preferences from the Mail menu.
2. Click Composing.
3. Deselect the checkbox for "When sending to a group, show all member addresses".
When you send an email to the group, only the groups name will be seen.
Mac OS X: Mail - How to Hide Address Book Group Member Names When Sending an Email
http://support.apple.com/kb/TA21082
Thanks,
Matt M. -
Is there a way to get a handle on Sorted list of a SortableModel
I'm using adf table based on SortableModel. Sorting works fine when i click on a table column which is enabled for sorting.But is it possible to access the sorted list or rows in the bean code.
myTableModel.getWrappedData() only gives the actual list not the sorted ones.
How do i get the handle on sorted list. i'm using 10.1.3
Thanks,
SenthilHi,
here's how it should work
for (int i=0; i<sModel.getRowCount(); i++)
sModel.setRowIndex(i);
System.out.println("i:"+i+" data:"+sModel.getRowData());
Frank -
I have started Family Share and ever since I activated my iTunes Match none of my family members get the iTunes purchases and movies???
Hi Daddy DooL,
Thank you for participating in the Apple Support Communities.
If you or your family members using Family Sharing can see shared purchases, start with the troubleshooting steps from this article on the affected devices:
If you don't see your family's shared content - Apple Support
Best Regards,
Jeremy -
How to get sublists off a sorted list
I'm using Arrays.sort(Object[], Comparator) to help sort some
of my objects. However, I now have a need to create sublists
off of a sorted list
For example when I sort by last name ...
SubList1: Clark, Stanley
SubList1: Goodyear, Nancy
Goodyear, Elvis
Are there any Java APIs or some other techniques available to
do this?
I was thinking of using a Observer/Observable interface to notify
a change in comparison key which could then be used to create
sublists.
Thanks in advance
PJjava.util.List has a method subList
-
I'm trying to sort a set of 4 lists that depend on each other. I'm using a bubble-sort to do this. I sort one list and when I need to swap items I also swap the corresponding items in the other three lists to keep them all synced.
So far I've only done this using a set of short lists. I've calculated that in order to sort the entire data-set using my bubble-sort will require about 20hrs (roughly 8000 items in each list).
I've looked into Database Events but it doesn't seem to have a sort function. I found a quick-sort routine on the web, but the code lacks comments and thus makes no sense to me.
Anybody know of a faster way to sort?
Message was edited by: MausyHello
You may try a flavour of merge sort handler, which is stable (i.e. preserves original order of items with the same key) and has N * log N complexity in both average and the worst case.
(Quick sort is not stable and has N * N complexity in the worst case.)
Notes about the script.
In brief,
0) given a list of keys (= kk) and a list of values (= aa);
1) create a list of indices (= ii) to identify each value in original aa;
2) transpose {kk, ii} and build a list (= xx) of which element is {kk's item j, ii's item j} for i from 1 to count kk;
3) sort xx by its element's first item;
4) transpose xx and get sorted kk and sorted ii by key;
5) bulid sorted value list (= aa1) by extracting items from aa by using sorted indices sequentially.
(You can build sorted value list from other value list by using the same sorted indices sequentialy)
There're three essential handlers: cmp(), msort() and transpose().
The cmp() is comparator for msort() and cmp(x, y) returns true iff element x and y are out of order.
The msort() is non-recursive merge sort handler. (I made it non-recursive to avoid stack-overflow in AppleScript)
The transpose() is 2d-array transposer.
Hope you get the picture.
Good luck,
H
--SCRIPT
test()
on test()
script o
property kk : {} -- key list
property ii : {} -- index list
property aa : {} -- value list
property aa1 : {} -- value list sorted by key
set h to 100 -- test list size
-- make key list
repeat with i from 1 to h
set end of my kk to random number from 0 to (h div 2)
end repeat
set kk0 to kk's contents -- save original key list
-- make index list
repeat with i from 1 to count my kk
set end of my ii to i
end repeat
-- make value list
repeat with i from 1 to count my kk
set end of my aa to "a" & i
end repeat
-- sort list of (key & index) pair by key
set xx to transpose({kk, ii}) -- transpose
msort(xx, my cmp) -- sort
set {kk, ii} to transpose(xx) -- transpose back
-- retrieve values by sorted indices
repeat with i in my ii
set end of my aa1 to my aa's item i
end repeat
return {original_keys:kk0, sorted_keys:kk, sortedindices_bykey:ii, sortedvalues_bykey:aa1}
end script
tell o to run
end test
on cmp(x, y) -- comparator for msort handler
(* sort in ascending order of 1st item of list element *)
return x's item 1 > y's item 1
end cmp
on cmp(y, x) -- comparator for msort handler
(* sort in descending order of 1st item of list element *)
return x's item 1 > y's item 1
end cmp
on msort(aa, cmp_) -- v1.2f1
Basic non-recursive merge sort handler
having list sorted in place in ascending order.
list aa : list to be sorted in place
handler cmp_ : comparator
* cmp(x, y) must return true iff list element x and y are out of order.
script o
property xx : aa -- to be sorted in place
property xxl : count my xx
property yy : {}
property cmp : cmp_
on merge(p, q, r)
property xx: source list -- [*1]
integer p, q, r : absolute indices to specify range to be merged such that
xx's items p thru r is the target range,
xx's items p thru (q-1) is the first sublist already sorted (in ascending order) and
xx's items q thru r is the second sublist already sorted (in ascending order).
(p < q <= r)
Notes
[1] It assumes that xx[p, q-1] and xx[q, r] have been already sorted (p < q <= r).
Also xx is modified in place.
local i, j, k, xp, xr, yi, yj, ix, jx
if r - p = 1 then
set xp to my xx's item p
set xr to my xx's item r
if my cmp(xp, xr) then
set my xx's item p to xr
set my xx's item r to xp
end if
return -- exit
end if
if my cmp(my xx's item (q - 1), my xx's item q) then
else -- xx[p, q-1] & xx[q, r] are already sorted
return
end if
set yy to my xx's items p thru r -- working copy for comparison
set ix to q - p
set jx to r - p + 1
set i to 1
set j to q - p + 1
set k to p
set yi to my yy's item i
set yj to my yy's item j
repeat
if my cmp(yi, yj) then
set my xx's item k to yj
set j to j + 1
set k to k + 1
if j > jx then
set my xx's item k to yi
set i to i + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item i
set i to i + 1
set k to k + 1
end repeat
return
end if
set yj to my yy's item j
else
set my xx's item k to yi
set i to i + 1
set k to k + 1
if i > ix then
set my xx's item k to yj
set j to j + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item j
set j to j + 1
set k to k + 1
end repeat
return
end if
set yi to my yy's item i
end if
end repeat
end merge
on cmp(x, y)
(* default comparator for sort in ascending order (used if cmp_ = {}) *)
return x > y
end cmp
local d, i, j
if xxl ≤ 1 then return
if cmp_ = {} then set my cmp to cmp
set d to 2
repeat until d > xxl
repeat with i from 1 to (xxl - d + 1) by d
my merge(i, i + d div 2, i + d - 1)
end repeat
set i to i + d
set j to i + d div 2
if j ≤ xxl then my merge(i, j, xxl)
set d to d * 2
end repeat
if i ≤ xxl then my merge(1, i, xxl)
end script
tell o to run
end msort
on transpose(dd)
list dd: two dimentional array. e.g. {{11, 12}, {21, 22}, {31, 32}}
return list: transposed array. e.g. {{11, 21, 31}, {12, 22, 32}}
extra e.g.
{{1, 2, 3}} -> {{1}, {2}, {3}} [or {1, 2, 3} -> {{1, 2, 3}} -> {{1}, {2}, {3}}],
{{1}, {2}, {3}} -> {{1, 2, 3}}
script o
property aa : dd
property xx : {}
property yy : {}
local n
if my aa is {} then return {}
if my aa's item 1's class is not list then set my aa to {my aa} -- as (1,n) array
set n to my aa's item 1's length
repeat with a in my aa
if (count a) is not n then error "lists' lengths mismatch" number 8008
end repeat
repeat with i from 1 to n
set my xx to {}
repeat with a in my aa
set end of my xx to a's item i
end repeat
set end of my yy to my xx
end repeat
return my yy's contents
end script
tell o to run
end transpose
--END OF SCRIPT
Message was edited by: Hiroto -
How do I get itunes to not list the same artist more than once?
How do I get ituens to not list the same artist more than once? I have tried editing the info, sorting different ways and sometimes it works and sometimes not...it's very frustrating to me to have the same artist listed multiple times...
Setting a common Album Artist for each Album does most of the work. For deeper problems see Grouping tracks into albums.
In general you need to make sure that all the values in the tags are used consistently. Same spelling, same capitalization, same accents, no leading, trailing, or multiple spaces, and each value of Artist, Album Artist or Album should only be associated with one value of Sort Artist, Sort Album Artist or Sort Album respectively.
tt2 -
Two sorted lists after adding a new contact
I got a new N73 (actually by Softbank Japan 705NK, language set to English), synchronized it to Outlook, so I had a couple of contacts in the contact list of my phone. They were all correctly sorted.
When I now added new contacts to the phone (not via Outlook, but directly inside the phone), I got a second sorted contact list before the existing one, i.e. all new contacts are not automatically inserted into the existing list of contacts, but a second list of contacts (which is sorted again) is generated. So now I have two sorted lists followed by each other, first the contacts inserted via the phone, second the contacts synchronized via Outlook/Nokia PC Suite.
Did anyone experience this problem? How can I get one sorted list instead of two lists?My thinking about deleting from the phone after synch-ing the contacts to Outlook was indeed that if you don't remove them, the synch won't see any reason to update them on the phone.
Your point about sync deleting them is a good one, which is one reason I thought you might have to remove all contacts from the phone before synching back.
Either way, I'd take a backup before you try anything
Message Edited by patc on 18-Jan-2008 12:43 PM -
Lsgrp - list all members of a group
lsgrp is a small and fast utility written in C that does just one thing: it lists the members of a group. It can be used in scripts that need to do something for each user in a group, such as setting up directories or generating per-user configuration files. There is a section on the project page explaining why a new utility was necessary.
I agree, addressing a new message to a group using Address through the Mail program seems to fill in just the first recipient's name.
A work around is to start your new message, click on Address and select the group you wish to send the message to. Take the extra step to highlight the first person in the group and then command-A to select all. When you then click on the To: button all of the recipient's will be in the address line of your mail message.
Alternately, start your new message and then type the name of the group in the To: line (don't use the Address button at all). You don't have to get all of the name typed in before the group name is identified. When the group name has been properly identified just hit the Return key and all of the group members will be filled in the To: line. This should do what you are hoping for.
Dale -
Get distributiongroupmember from groups listed in a txt file
Hi,
I have a txt file with many distribution groups listed on each row. I would like to use get-distributiongroupmember command to list each DL's members and have them presented in a nice csv or just plain txt with name of the DL, its alias and the members on
separate column. Is that possible?
Thanks,
ChrisWhy not, this will give you want you need...
$dls = Get-Content dls.txt
ForEach($dl in $dls)
Get-DistributionGroupMember $dl | select @{Name="DLName";expression={(Get-DistributionGroup $dl)}}, alias, displayname | Export-CSV dls.csv -append
Blog |
Get Your Exchange Powershell Tip of the Day from here
Hi Amit,
Thanks for this but when I ran the above script it complains about the parameter -Append can't be matched. If I skip -APPEND then I only get the last DL with its members in the output -
To get discret sublist from List
Hi
I need to get a sublist from List but it is not continuous list from the List.
The method subList(int fromindex, int toindex) in List class returns a sublist with the specific range(from-to index).
But how can it be made, such NOT continuous sublist that consists of index 0,1,2,5,6,8,10, ... of base List.A sublist is not a new list, but a certain view (think of it as a "window") of an existing list. So, when something in the original range changes, it changes in the sublist too.
So, when you try to combine sublists of the same List, this will reflect on the original list and lead to your concurrentModificationException.
The question is: is the sublist really what you want? Because the reason for sublists is to examine changes in a certain range, but what you want sounds more like a completely new composed list.
I suggest you create a new List with exactly the items you want to have. For example:
List myList = new ArrayList(someSublist);
myList.add(someItem);
myList.addAll(anotherList);
// ...However, sorting changes in the original List will not reflect in the new List. For that, you might to write your own sublist, that points to the indices you'd like to watch instead of the objects. -
How to get the non technical query name from table?
Hello,
The table RSZCOMPDIR gives me the list of queries. The field COMPID contains the technical query name.
But how can I get the non technical name of a query? Which table holds this information?
Thanks and Regards,
SheetalHi Sheetal,
You can get this info from RSZELTTXT.
Hope this helps... -
Unchecked invocation sort(list) error... please help.
this is the code I have problems with...
List contacts = Contact.search(searchParameters,
toContactTypeArray(
contactSearchForm.getSelectedSearchLocations(),
contactSearchForm.getContactTypeLocationDisplay()));
//todo alphabetize
Collections.sort(contacts);
the contact search was working fine until I added a sort to the code... now I get this message :
Type safety: Unchecked invocation sort(List) of the generic method sort(List<T>) of type
Collections
I am just taking over this project and It apears that the person before me used myEclipse to generate much of the code... I am having a hard time getting arround certain things like this.
Thanks for your help folks! Bryce.Basically from what I read, your list needs to implement the Comparable class, and the elements in the list must all be comparable to each other (i.e. all strings, or all doubles, or all integers, or all a specific type of class or may have the same base class, etc.) If it's a custom list, try this (replace myContactTypeList with whatever your list class is named.)
List<myContactTypeList> contacts = Contact.search(searchParameters,
toContactTypeArray(
contactSearchForm.getSelectedSearchLocations(),
contactSearchForm.getContactTypeLocationDisplay()));
//todo alphabetize
Collections.sort(contacts);
You will pretty much always get a warning with generics. But, if you happen to do a clone of an ArrayList at any point, do this instead (it removes the warning, and should work...code hasn't been tested):
Iterator i = myOriginalList.iterator();
Double value; while((value = (Double) i.next()) != null) { DataList.add(value); } -
Insertion an object into a sorted list
Hello
I have got class MySortedList which encloses List object.
class MySortedList {
private List list = new LinkedList();
public add(Object obj, Comparator cmp) {
Who knows how the add(Object, Comparator) method can be realized better?
All comments...Why am I using the LinkedList?
It is not in principle. I can change this to
ArrayList, for example.
It is depend on what do I use MySortedList class for.
Can you suggest to use something else?LinkedLists are going to be the slowest way to do this. Even calling contains is slow. You have a sorted list but you have to iterate over all the preceeding elements to get at an element even though you know where it is.
There is also a problem with the general design. someone can call the method once with one Comparator and then again with a completely different comparator. For example, if you add 5 elements with a String comparator that sorts them alphabetically and then with a Comparator that sorts them in reverse alphabetically you could end up with a list like:
z, c, d, e, f, g
then you call it with t and the firs comparator and get:
t, z, d, r, f, g
It's then no longer in order with respect to either comparator and the whole thing is broken. You need to set the Comparator in the constructor.
Use an ArrayList and the code becomes:
public synchronized void add(Object obj)
int index = Collections.binarySearch(list, obj, comparator);
if (index == list.size()) list.add(obj);
else if (index < 0) list.add((index * -1) - 1, obj);
} -
Get column values from list of values programmatically
hi all
how i get column values from list of values programmatically in the
returnPopupDataListener methodIf this answers your question , please close this thread by marking it as answered.
Thanks
Maybe you are looking for
-
Questions on the equaliser function in itunes on the shuffle
hi if i activated and applied the equaliser settings to the mp3s in itunes and downloaded to the shuffle, would the shuffle still play the mp3 using the equaliser settings? or this can only be applied to ipod nano and above models? kindly advice as i
-
Check image metadata in Oracle Forms 6.0
Hello, I need to check if an image selected by the user in a Form has the EXIF format because, if so, I need to convert it (using an IrfanView command) before persist it in the database. I am developing using Oracle Forms 6.0 and Oracle 9i. Do you kn
-
Adapter Engine - Messages in To Be Delivered status
Hello, I am using a SAP XI 3.0. Checking the Message Monitoring, I have seen that there are a lot of messages in status To Be Delivered. I think that this status in an initial status because then the message has to be set to Delivering in a next step
-
Are there any issues with using OS X Mavericks and Premiere CC?
Are there any issues with using OS X Mavericks and Premiere CC?
-
For some reason the size of the print when I print out a document has gotten very small in size. How do I change the size so the printing is larger? Thank you!