Please help, sorting...
I have to sort a doubly linked list containing strings
I have to hard code a merge sort for this, but I have nooooo idea how to do this...
I know what a merge sort is, and how to do it with an int array, but string? and even worse, not an array but a doubly linked list...
please, I've been trying to understand this for hours now....
- Dan
It is just like the collections "LinkedList", and I have a node class
class Node
Node next;
Node previous;
String element;
Node()
Node(String data)
element = data;
Node(String data, Node nextNode, NodePrevNode)
element = data;
next = nextNode;
previous = prevNode
}//class Node
my big problem is to sort the nodes in alphabetical order, I have tried to convert a mergesort for int[] but it doesn't work...
And I kind of have to use this kind of sort because it have to work well for very large n...
any help is very welcome - Dan
Similar Messages
-
I followed this procedure to check my files:
Please read this whole message before doing anything.
The following procedure will help whether your system has been modified. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac.
These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing.
Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects.
Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then either copy or drag it. The headings “Step 1” and so on are not part of the commands.
Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply.
Launch the Terminal application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Terminal in the page that opens.
When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign.
Step 1
Copy or drag — do not type — the line below into the Terminal window, then press return:
kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}'
Post the lines of output (if any) that appear below what you just entered (the text, please, not a screenshot.) You can omit the final line ending in “$”.
Step 2
Repeat with this line:
sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|edu\.mit|org\.(amavis|apache|cups|isc|ntp|postfix|x)/{print $3}'
This time, you'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. You don't need to post the warning.
Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step.
Step 3
launchctl list | sed 1d | awk '!/0x|com\.apple|edu\.mit|org\.(x|openbsd)/{print $3}'
Step 4
ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null
Step 5
osascript -e 'tell application "System Events" to get name of every login item' 2> /dev/null
Remember, steps 1-5 are all drag-and-drop or copy-and-paste, whichever you prefer — no typing, except your password. Also remember to post the output.
You can then quit Terminal.
I believe that I have a keylogger or some sort of spyware installed on my mac, please help!
POST YOUR OUTPUT FOR REVIEW/COMMENT.
After running these commands, here is the output. Can you please tell me if you see anything here. I would be so grateful.
com.oxsemi.driver.OxsemiDeviceType00 (1.28.13)
at.obdev.nke.LittleSnitch (4052)
Password:
com.wdc.WDSmartWareServer
com.wdc.WDDMservice
com.sierrawireless.SwitchTool
com.oracle.java.JavaUpdateHelper
com.oracle.java.Helper-Tool
com.microsoft.office.licensing.helper
com.lacie.desktopmanager.service
com.google.keystone.daemon
com.adobe.fpsaud
at.obdev.littlesnitchd
jp.buffalo.NASPower
com.oracle.java.Java-Updater
com.lacie.eventsactions.launcher.agent
com.hp.messagecenter.launcher
com.hp.devicemonitor
com.google.keystone.system.agent
at.obdev.LittleSnitchUIAgent
com.nds.pcshow.uninstall
com.nds.pcshow
com.facebook.videochat.thomasbrown.updater
com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae
com.adobe.AAM.Scheduler-1.0
LaCie DiscRecording/LaCie DiscRecording.pkg:
Contents
/Library/Address Book Plug-Ins:
/Library/Components:
/Library/Extensions:
/Library/Frameworks:
AEProfiling.framework
AERegistration.framework
Adobe AIR.framework
AudioMixEngine.framework
EWSMac.framework
HPDeviceModel.framework
HPPml.framework
HPScan.framework
HPServicesInterface.framework
HPSmartPrint.framework
HPSmartX.framework
NyxAudioAnalysis.framework
PluginManager.framework
Snapfish.framework
iLifeFaceRecognition.framework
iLifeKit.framework
iLifePageLayout.framework
iLifeSQLAccess.framework
iLifeSlideshow.framework
iTunesLibrary.framework
/Library/Input Methods:
/Library/Internet Plug-Ins:
AdobePDFViewer.plugin
Flash Player.plugin
JavaAppletPlugin.plugin
Quartz Composer.webplugin
QuickTime Plugin.plugin
SharePointBrowserPlugin.plugin
SharePointWebKitPlugin.webplugin
Silverlight.plugin
flashplayer.xpt
googletalkbrowserplugin.plugin
iPhotoPhotocast.plugin
npgtpo3dautoplugin.plugin
nsIQTScriptablePlugin.xpt
o1dbrowserplugin.plugin
/Library/Keyboard Layouts:
/Library/LaunchAgents:
at.obdev.LittleSnitchUIAgent.plist
com.adobe.AAM.Updater-1.0.plist
com.google.keystone.agent.plist
com.hp.devicemonitor.plist
com.hp.messagecenter.launcher.plist
com.lacie.eventsactions.launcher.agent.plist
com.oracle.java.Java-Updater.plist
jp.buffalo.NASPower.plist
jp.buffalo.NASPower_pla.plist
/Library/LaunchDaemons:
at.obdev.littlesnitchd.plist
com.adobe.fpsaud.plist
com.apple.remotepairtool.plist
com.google.keystone.daemon.plist
com.lacie.desktopmanager.service.plist
com.microsoft.office.licensing.helper.plist
com.oracle.java.Helper-Tool.plist
com.oracle.java.JavaUpdateHelper.plist
com.sierrawireless.SwitchTool.plist
com.wdc.WDDMservice.plist
com.wdc.WDSmartWareServer.plist
/Library/PreferencePanes:
Flash Player.prefPane
HP Scanjet.prefPane
JavaControlPanel.prefPane
/Library/PrivilegedHelperTools:
.DS_Store
NasNavigator2.app
com.microsoft.office.licensing.helper
com.oracle.java.JavaUpdateHelper
/Library/QuickLook:
GBQLGenerator.qlgenerator
iWork.qlgenerator
/Library/QuickTime:
AppleIntermediateCodec.component
AppleMPEG2Codec.component
/Library/ScriptingAdditions:
/Library/Spotlight:
GBSpotlightImporter.mdimporter
Microsoft Entourage.mdimporter
Microsoft Office.mdimporter
iWeb.mdimporter
iWork.mdimporter
/Library/StartupItems:
ChmodBPF
HP IO
LocSvc
/etc/mach_init.d:
/etc/mach_init_per_login_session.d:
/etc/mach_init_per_user.d:
Library/Address Book Plug-Ins:
SkypeABDialer.bundle
SkypeABSMS.bundle
Library/Fonts:
04b-08.suit
Arial
Brush Script
Times New Roman
Verdana
Wingdings
Wingdings 2
Wingdings 3
encodings.dir
fonts.dir
fonts.list
fonts.scale
Library/Frameworks:
EWSMac.framework
Library/Internet Plug-Ins:
FacebookVideoCalling.bundle
Move-Media-Player.plugin
PlayerPlugin.bundle
fbplugin_1_0_3.plugin
Library/Keyboard Layouts:
Library/LaunchAgents:
com.adobe.AAM.Updater-1.0.plist
com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae.plist
com.facebook.videochat.thomasbrown.plist
com.nds.pcshow.plist
com.nds.pcshow.uninstall.plist
Library/PreferencePanes:
Opera Preferences
TomTomHOMERunner, LDMStatusItem, apple-scc-20130209-112927
thank you much for helping...sincerely. tlenbro.I followed this procedure to check my files:
Please read this whole message before doing anything.
The following procedure will help whether your system has been modified. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac.
These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing.
Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects.
Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then either copy or drag it. The headings “Step 1” and so on are not part of the commands.
Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply.
Launch the Terminal application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Terminal in the page that opens.
When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign.
Step 1
Copy or drag — do not type — the line below into the Terminal window, then press return:
kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}'
Post the lines of output (if any) that appear below what you just entered (the text, please, not a screenshot.) You can omit the final line ending in “$”.
Step 2
Repeat with this line:
sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|edu\.mit|org\.(amavis|apache|cups|isc|ntp|postfix|x)/{print $3}'
This time, you'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. You don't need to post the warning.
Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step.
Step 3
launchctl list | sed 1d | awk '!/0x|com\.apple|edu\.mit|org\.(x|openbsd)/{print $3}'
Step 4
ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null
Step 5
osascript -e 'tell application "System Events" to get name of every login item' 2> /dev/null
Remember, steps 1-5 are all drag-and-drop or copy-and-paste, whichever you prefer — no typing, except your password. Also remember to post the output.
You can then quit Terminal.
I believe that I have a keylogger or some sort of spyware installed on my mac, please help!
POST YOUR OUTPUT FOR REVIEW/COMMENT.
After running these commands, here is the output. Can you please tell me if you see anything here. I would be so grateful.
com.oxsemi.driver.OxsemiDeviceType00 (1.28.13)
at.obdev.nke.LittleSnitch (4052)
Password:
com.wdc.WDSmartWareServer
com.wdc.WDDMservice
com.sierrawireless.SwitchTool
com.oracle.java.JavaUpdateHelper
com.oracle.java.Helper-Tool
com.microsoft.office.licensing.helper
com.lacie.desktopmanager.service
com.google.keystone.daemon
com.adobe.fpsaud
at.obdev.littlesnitchd
jp.buffalo.NASPower
com.oracle.java.Java-Updater
com.lacie.eventsactions.launcher.agent
com.hp.messagecenter.launcher
com.hp.devicemonitor
com.google.keystone.system.agent
at.obdev.LittleSnitchUIAgent
com.nds.pcshow.uninstall
com.nds.pcshow
com.facebook.videochat.thomasbrown.updater
com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae
com.adobe.AAM.Scheduler-1.0
LaCie DiscRecording/LaCie DiscRecording.pkg:
Contents
/Library/Address Book Plug-Ins:
/Library/Components:
/Library/Extensions:
/Library/Frameworks:
AEProfiling.framework
AERegistration.framework
Adobe AIR.framework
AudioMixEngine.framework
EWSMac.framework
HPDeviceModel.framework
HPPml.framework
HPScan.framework
HPServicesInterface.framework
HPSmartPrint.framework
HPSmartX.framework
NyxAudioAnalysis.framework
PluginManager.framework
Snapfish.framework
iLifeFaceRecognition.framework
iLifeKit.framework
iLifePageLayout.framework
iLifeSQLAccess.framework
iLifeSlideshow.framework
iTunesLibrary.framework
/Library/Input Methods:
/Library/Internet Plug-Ins:
AdobePDFViewer.plugin
Flash Player.plugin
JavaAppletPlugin.plugin
Quartz Composer.webplugin
QuickTime Plugin.plugin
SharePointBrowserPlugin.plugin
SharePointWebKitPlugin.webplugin
Silverlight.plugin
flashplayer.xpt
googletalkbrowserplugin.plugin
iPhotoPhotocast.plugin
npgtpo3dautoplugin.plugin
nsIQTScriptablePlugin.xpt
o1dbrowserplugin.plugin
/Library/Keyboard Layouts:
/Library/LaunchAgents:
at.obdev.LittleSnitchUIAgent.plist
com.adobe.AAM.Updater-1.0.plist
com.google.keystone.agent.plist
com.hp.devicemonitor.plist
com.hp.messagecenter.launcher.plist
com.lacie.eventsactions.launcher.agent.plist
com.oracle.java.Java-Updater.plist
jp.buffalo.NASPower.plist
jp.buffalo.NASPower_pla.plist
/Library/LaunchDaemons:
at.obdev.littlesnitchd.plist
com.adobe.fpsaud.plist
com.apple.remotepairtool.plist
com.google.keystone.daemon.plist
com.lacie.desktopmanager.service.plist
com.microsoft.office.licensing.helper.plist
com.oracle.java.Helper-Tool.plist
com.oracle.java.JavaUpdateHelper.plist
com.sierrawireless.SwitchTool.plist
com.wdc.WDDMservice.plist
com.wdc.WDSmartWareServer.plist
/Library/PreferencePanes:
Flash Player.prefPane
HP Scanjet.prefPane
JavaControlPanel.prefPane
/Library/PrivilegedHelperTools:
.DS_Store
NasNavigator2.app
com.microsoft.office.licensing.helper
com.oracle.java.JavaUpdateHelper
/Library/QuickLook:
GBQLGenerator.qlgenerator
iWork.qlgenerator
/Library/QuickTime:
AppleIntermediateCodec.component
AppleMPEG2Codec.component
/Library/ScriptingAdditions:
/Library/Spotlight:
GBSpotlightImporter.mdimporter
Microsoft Entourage.mdimporter
Microsoft Office.mdimporter
iWeb.mdimporter
iWork.mdimporter
/Library/StartupItems:
ChmodBPF
HP IO
LocSvc
/etc/mach_init.d:
/etc/mach_init_per_login_session.d:
/etc/mach_init_per_user.d:
Library/Address Book Plug-Ins:
SkypeABDialer.bundle
SkypeABSMS.bundle
Library/Fonts:
04b-08.suit
Arial
Brush Script
Times New Roman
Verdana
Wingdings
Wingdings 2
Wingdings 3
encodings.dir
fonts.dir
fonts.list
fonts.scale
Library/Frameworks:
EWSMac.framework
Library/Internet Plug-Ins:
FacebookVideoCalling.bundle
Move-Media-Player.plugin
PlayerPlugin.bundle
fbplugin_1_0_3.plugin
Library/Keyboard Layouts:
Library/LaunchAgents:
com.adobe.AAM.Updater-1.0.plist
com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae.plist
com.facebook.videochat.thomasbrown.plist
com.nds.pcshow.plist
com.nds.pcshow.uninstall.plist
Library/PreferencePanes:
Opera Preferences
TomTomHOMERunner, LDMStatusItem, apple-scc-20130209-112927
thank you much for helping...sincerely. tlenbro. -
Need to sort two vectors at the same time! please help!
I have
vectorA: 2 4 9 1 7 6 8
vectorB: two four nine one seven six eight
i want to sort these two vectors in parallel
what is the best way?
i could just do Collection.sort(vectorA) and get
1 2 4 6 7 8 9
but i want the vectorB to have a corresponding order
please help!!
thankspublic class Pair implements Comparable {
private int value;
private String name;
public int getValue() {
return this.value;
public void setValue(int value) {
this.value = value;
public String getName() {
return this.name;
public void setName(String name) {
this.name = name;
public int compareTo(Object o) {
Pair that = (Pair) o;
return this.value - that.value;
place both in a Collection (vector is a bad choice if you are going to do sorting LinkedList is better) the Collections.sort method will sort
according to the compareTo method. -
Sort Not working - Please help
Hello,
I have design2003 parameter. Im displaying table with following logic. Problem is it is not activating SORT icon thats comes in table header text line which sorts the column. What could be wrong? Please help.
<htmlb:tableView id = "table_prod_cat"
design = "alternating"
fillUpEmptyRows = "true"
headerText = "Category_List"
headerVisible = "true"
onRowSelection = "prod_cat_rowselection"
selectionMode = "none"
table = "<%= lt_prod_cat_list %>"
visibleRowCount = "<%= l_sprec_display %>"
width = "100%" >
<htmlb:tableViewColumns>
<%-- Product Category ID --%>
<htmlb:tableViewColumn columnName = "product_cat"
onItemClick = "prod_cat_id_itemclick"
width = "80"
sort = "X"
title = "<B>Category</>"
type = "link" />
<%-- Product Category Description --%>
<htmlb:tableViewColumn columnName = "CATEGORY_TEXT"
title = "<B> Category Text</>"
sort = "X"
width = "200" />
<htmlb:tableViewColumn columnName = "PRODUCT_GRP"
title = "<B>Product Group</>"
sort = "X"
width = "200" />
<htmlb:tableViewColumn columnName = "PRODUCT_SGRP"
title = "<B>Product Sub-Group</>"
sort = "X"
width = "200" />
</htmlb:tableViewColumns>
</htmlb:tableView>Ajay,
You should use sort = "server" or sort = "none" .
sort - Use this attribute to activate sorting for the
individual rows and to determine who is responsible for the sorting.
NONE (default, there is no sorting), SERVER (HTMLB carries out the
sorting) and APPLICATION (the application carries out the sorting) If
you specify SERVER, you should also set the attributes keyColumn and
onHeaderClick.
I have changed your code..use this code and let me know if you get any issue.
<htmlb:tableView id = "table_prod_cat"
design = "alternating"
fillUpEmptyRows = "true"
headerText = "Category_List"
headerVisible = "true"
onRowSelection = "prod_cat_rowselection"
selectionMode = "none"
<b>sort = "server"</b>
table = "<%= lt_prod_cat_list %>"
visibleRowCount = "<%= l_sprec_display %>"
width = "100%" >
<htmlb:tableViewColumns>
<%-- Product Category ID --%>
<htmlb:tableViewColumn columnName = "product_cat"
onItemClick = "prod_cat_id_itemclick"
width = "80"
<b>sort = "true"</b>
title = "<B>Category</>"
type = "link" />
<%-- Product Category Description --%>
<htmlb:tableViewColumn columnName = "CATEGORY_TEXT"
title = "<B> Category Text</>"
<b>sort = "true"</b>
width = "200" />
<htmlb:tableViewColumn columnName = "PRODUCT_GRP"
title = "<B>Product Group</>"
<b>sort = "true"</b>
width = "200" />
<htmlb:tableViewColumn columnName = "PRODUCT_SGRP"
title = "<B>Product Sub-Group</>"
<b>sort = "true"</b>
width = "200" />
</htmlb:tableViewColumns>
</htmlb:tableView>
Thanks!
Lakshmikandh<b></b>
Message was edited by:
Lakshmikandh Chinnasamy -
I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks
- If you used PhotoStream then try getting some of them from your PhotoStream. See that topic of:
iOS: Importing personal photos and videos from iOS devices to your computer
- Maybe from the restored iPod via
How to perform iPad recovery for photos, videos
Wondershare Dr.Fone for iOS: iPhone Data Recovery - Wondershare Official
http://www.amacsoft.com/ipod-data-recovery.html -
Apple Senior tech lady deleted all my external drive data while sorting out other problem. How can I restore all my photos , music etc back to my Mac Pro?(I am so scared, I haven't connected iPhone to sync! Please help)
It was tele tech. I couldn't open my Page Numbers etc. Frist tech chat idiot - following dumping few things in bin, asked me yo upgrade to Yosemite. But the problem still persists. This morning I was asked to do it via telephone and like yesterday, after wasting 20 min, I was put to this apparent Tech Queen ( my foot!). She eventually decided to reinstall Yosemite asked me to connect my external drive while I connected to her. She was moving cursor asking me to move files and delete and I followed her like a dummy. It took 3/4 hours and she called me 3 times once the lengthy process was completed. I suspected from the beginng for the fact that why should be asking me to click all my backup from the very beginning! Eventually she said I deleted... Or someone else or may be my children ! It was a blatant lie. I run my small business from home and I was simply staying in front of the Mac whole day! Children were at school. Then she said I must have used another computer! I only have laptop and the iPad. I will talk to their manager first thing in the morning. In the mean time please let me know as to how can I transfer photos, music etc back to my laptop from my Iphone and IPad .? I am will connect to laptop as I am worried the new BLANK iPhoto may supersede iphone/iPad stuff? Will it? Please let me know. I am not a very tech savvy person. My son who could help me, is in Manchester Uni and Inam in London.
-
Sort a string :: Please help.
Hello Everyone,
I am having this very simple problem of sorting a String. please help.
static String sortString(String str){
List list = Arrays.asList(str);
Collections.sort(list);
for(int i=0, n=list.size();i<n;i++){
System.out.println(","+ list.get(i));
The function is supposed to take a String and sort it & print it out. This should be simple. Where am I making mistakes? Please help!!Hello Everyone,
I am having this very simple problem of sorting a String. please help.
static String sortString(String str){
List list = Arrays.asList(str);
Collections.sort(list);
for(int i=0, n=list.size();i<n;i++){
System.out.println(","+ list.get(i));
return str;
The function is supposed to take a String and sort it & print it out. This should be simple. Where am I making mistakes? Please help!! -
Well, i was on my laptop now and all of a sudden a pop up message appeared and said "your download is complete" so i went to go check it out and it was 'MacProtector'. i cant delete it and it keeps opening unwanted web pages, please help me sort this out someone?
Refer to: http://cantalktech.com/2011/05/08/mac-protector/.
-
How to sort taxonomy with Java api? Please Help
Can someone please help me out? I understand and can display the contents of a taxonomy. But I need it to be displayed in alphabetical order. Manual ordering does not exist for taxonomies. How do you sort a taxonomy in java?
The following snip of code can get the taxonomy and loop through it but isn't ordered correctly. Can some kind of comparator be used somehow? Points will be rewarded! Please help.
//Get connection to KMCM path
RID rid = RID.getRID(strPathToKMCM);
IResource resource = ResourceFactory.getInstance().getResource(rid, context);
ICollection collection = (ICollection) resource;
IResourceList children = collection.getChildren();
for (int i = 0; i < children.size(); i++){
IResource ir = children.get(i);I'd also be interested to know how to do this.
I found this code section to sort by date, but couldn't change it to get it to work to sort alphabetically.
private void sortResouceListByDate(IResourceList resourceList) throws Exception {
// create property names to index properties
IPropertyName iPropSort = new PropertyName("http://sapportals.com/xmlns/cm", "modified");
//create a comparator to order the resource list
ResourcePropertyComparator rRPC = new ResourcePropertyComparator(iPropSort, false);
//order the resource list
resourceList.sort(rRPC);
Link where code was found:
https://forums.sdn.sap.com/thread.jspa?forumID=42&threadID=148468&messageID=1670970#1670970
We are using:
Portal 6.0.15.0.0
KM 6.0.15.4.0
Thanks!! -
Sorting problem in TreeMap, please help urgent :-((
Hi
Following is a program, please execute it to see the problem. I am adding four elements in the TreeMap. The problem is when I add the elements it never compares the newly added element with the first element. I was sick of it so to test the TreeMap I created my own small class and defined a Comparator for that class. Following is the code which shows the problem in TreeMap. Am I doing something wrong? Please help its urgent.
import java.util.*;
public class SortingCollection {
public static void main(String[] args) {
SortingCollection sortingCollection = new SortingCollection();
sortingCollection.sortingTest();
public void sortingTest() {
TreeMap treeMap = new TreeMap();
treeMap.put(new Test("Bhushan", 1022), new Integer(1022));
treeMap.put(new Test("Wasil", 1023), new Integer(1023));
treeMap.put(new Test("Ifti", 1020), new Integer(1020));
treeMap.put(new Test("Roshan", 1021), new Integer(1021));
System.out.println(treeMap);
Test test = new Test("Bhushan", 1028);
treeMap.put(test, new Integer(1022));
System.out.println(treeMap);
public class Test implements Comparable {
public String name;
public int age;
public Test(String name, int age) {
this.name = name;
this.age = age;
public int compareTo(Object toBeCompared) {
Test casted = (Test) toBeCompared;
if (name.equals(casted.name)) {
System.out.println("Returning 0 for " + name + " " + casted.name);
return 0;
System.out.println("Returning -1 for " + name + " " + casted.name);
return -1;
public String toString() {
return "[" + name + ", " + age + "]";
}If you are using TreeMap, you should want the keys to be immutable. You can't change the state of the keys of a Map such that their natural order will change, or chaos will happen.
If the key is the GateKeeperInfo class (which has host, port, and # of users as its data members) and the value is "some other object reference which you need", and this reference is closely tied to the GateKeeperInfo, have you considered making it a member of the GateKeeperInfo?
That way you don't need this TreeMap business. You can have the natural ordering imposed on the GateKeeperInfo class (which is apparently comparing the host and port only). You can also have a Comparator object that can compare these objects in a different way (# of users, for instance).
public class MyClass implements Comparable
String host;
int port;
int currNumUsers;
Object someOtherObjectReferenceINeed;
// or if the object reference you need is an Integer, make that last member
// an int...
// Also, let's keep a Comparator in here for comparing # of users.
// See further down for actual implementation...
public static final Comparator BY_NUM_USERS = new NumUsersComparator();
// Use the equal methods to determine whether or not host and port matches
public boolean equals( Object obj )
// Use the compareTo method to compare 2 instances in terms of host and port
public int compareTo( Object obj )
// Make this object take care of changing # of users, outside of the
// Comparable interface.
public int getNumUsers();
public int bumpNumUsers( int byThisAmount ); // changes # of users...
// Beef up this object to take advantage of someOtherObjectReferenceINeed
// Use this Comparator object to compare 2 instances of MyClass
// according to # of users.
public class NumUsersComparator implements Comparator
public int compare( Object a, Object b )
MyClass left = (MyClass)a;
MyClass right = (MyClass)b;
// I am assuming both # of users are of the same sign...positive
return ( right.getNumUsers() - left.getNumUsers() );
// Now when you need to compare, you can do it 2 different ways...
// You can use whatever Collection you fits, List, Set, ...
// I am going to use List in this case
List gateways = new ArrayList;
// add the objects...
gateways.add( /* . . . */ );
// Now let's sort in terms of user/port
Collections.sort( gateways );
// Let's sort in terms of number of users...
Collections.sort( gateways, MyClass.BY_NUM_USERS );
// I am going to mix them around now...
Collections.shuffle( gateways );
// Now let's find the gateway w/ the largest # of users...
MyClass currMaxGateway = Collections.max( gateways, MyClass.BY_NUM_USERS );
. -
PLEASE HELP: Artist Naming. Why is it sorting by LAST NAME?
Hey there everyone. Im sorry ahead of time. I'm a total newbie when it comes to itunes but hey I'm really trying to learn here. I have a 2nd Gen iPod Touch and when I click on artist it starts at A of course but what I dont' like is .... for example .... My library is like this...
a-ha
Paula Abdul
Ace of Base
Aerosmith
Afroman
Christina Aguilera
Clay Aiken
Alice DeeJay
All Saints
Gary Allan
Apocalyptica
Az Yet
ect ect ect....
Ok now my question... I HATE that like for example Paula Abdul is under "A"... I wish it would show up under "P" for Paula... NOT "A" for Adbul... Same thing with Christina Aguilera ... I would love for it to be under "C" for Christina and NOT "A" for Aguilera .... is there anyway that I can change this some how to where it will put everything in order by the FIRST letter of the artist name... and not by the lastname? PLEASE PLEASE PLEASE HELP!!!If you right click on the song and then Get Info. Under the Sorting Tab, is the Sort Artist field different from the Artist field?
-
Why can't I buy any app ? Iv tried creating a new Appel account ect but it says the same thing everytime . Sorry your payment was declined . How can I sort this ? Please help
- Try another payment method.
- Contact iTunes
Apple - Support - iTunes - Contact Us
- Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card -
Can't get my table to sort. Please help
Can't seem to get my table to sort. That was a non-issue with the previous version of Numbers but now if I try to sort ascending by totals it just shuffles my numbers with no visible logic. Please help, this is such a simple task, shouldn't be so hard. I tried all suggestions on the forum and nothing works. This is a snapshot of the table:
And this is the result after sorting descending by Totals column:
Any and all help welcome!Hi Dannie,
Sorting in Numbers 3 follows a different pattern from Numbers 2. Formulas do not automatically adjust.
When Numbers 3 was installled, it was placed in your Applications folder. Numbers 2 was moved to a subfolder called iWork '09 within your applications folder.
With your document open in Numbers 3, File > Export To > Numbers '09. Then use Numbers '09 (Numbers 2) to work on it.
Wayne Contello has written a User Tip for working with the old and new versions of iWork.
https://discussions.apple.com/docs/DOC-6991
The trick is to drag icons for both versions to your Dock. Right click or control click on each and Options > Keep in Dock. That puts you in charge of which version you launch.
Here is a screen shot of both Numbers icons on my Dock.
Numbers 2.3 (Numbers '09) on the left with a three column graph.
Numbers 3.2 on the right with a four column graph.
Both versions will run happily together. Just be sure which version is opening your document.
Instead of double clicking the document, run whichever version of Numbers/Pages/Keynote suits and use File > Open.
Regards,
Ian. -
I am unable to download and always asking the password it's ok for the once and it's asking more and no results only repeating the same so I am unable to download please help me to sort out this problem and my request please sort out from your side or let me guide .
Thanks Eric for responding.
I checked and it does not appear in the Applications folder.
I tried yesterday on an ethernet connection with a download speed of 2 Mbps but, unfortunately the connection died(It happened from the ISP end, which is out of my control) in between after which there was no trace of the download that happened for so long(till the internet connection death).
One more serious query which I am unable to understand. If the internet connection, dies in the midst of the download is in progress why is it so that the state does not persist and one has to restart the entire process again. Is there no solution for this?
I tried so many times and its the same case after some amount of download it vanishes. So many unsuccessful attempts. I am ****** off now. Is it not possible to see Mavericks? Why does different machines of Apple behave differently? Somewhere it goes smoothly and somewhere like my mine. Why did not Apple release a non apple store version? Is this not a bad sign of letting the users struggle when something is being offered for free?
The reason I asked as whether we can download the .app of Mavericks is that, there are so many applications that I have downloaded web and have installed. All that works fine. Can't we do the same here? You download a copy of Mavericks installer application and upload it for me in Google drive or like online storage places which can be downloaded and used by me? Help me understand.
Thanks again. -
evidence of a freakin' rootkit (of sorts) haunting my remaining neurons for the last year @ all my android devices (including this new tablet).
PLEASE HELP ME
Jose Carlos Amaral Morgado
Tomar, Portugal
'''...personally identifying information removed'''Sorry Morgado. This is a Firefox for Android support forum. Not a general purpose. Android forum. Please ask in an Android OS forum.
Locking this thread.
Cheers!
...Roland
Maybe you are looking for
-
Questions on the @ServiceClient annotation and Asynchronous webservices
1. Is their a way to invoke a webservice in an asynchronous manner without using the @ServiceClient annotation? I've tried a few things to get access to the async versions of the web methods and each time I get an exception stating "java.rmi.RemoteEx
-
How do I change my ipod to another computer?
My computer crashed and I purchased a new one. How do I take all of my music off my ipod and put it on the new computer? Any help please!
-
How does it work if you have an ipod then buy a nano? Help please
Okay i have just bought a nano but I already have an ipod Im afraid to load the cd incase it wipes my origignal ipod library...what do I do? Can you run two from one library?
-
Is Jump Query is possible in Webi Intelligence ?
Hello Friends, I am from a SAP BI background. I am very new to Bussiness Object tool...... In my current client there is a requirement where I need to do a Jump query from one query , by passing the variables and the query result. 1) I know this is p
-
Someone. Please. Help. Me. In one of my websites www.acsmechanical.net, the images aren't lining up with the background I created. It looks perfect in Dreamweaver itself, but when I upload it or preview it in a browser there is a "gap". I'm thinking