Ps -ef -o args
Hi Guys!
I'm working on some perl scripts which need to check some config files from running processes. My problem is that the with of the args column of the ps command sometimes is too small to display the full path of the config file.
Till now I haven't found a solution to enlarge the column.
Has anybody got some suggestions?
greets
kleinerroemer
/usr/bin/ps displays the kernel buffer that holds a portion of the initial execution string. That buffer is limited to 80 characters.
You can display the process's buffer (ARGV[0]) via 'pargs' if you have sufficient privileges (or via /usr/ucb/ps on older systems), but be aware that the process can change that buffer as it runs.
Darren
Similar Messages
-
Performance problem: Query explain plan changes in pl/sql vs. literal args
I have a complex query with 5+ table joins on large (million+ row) tables. In it's most simplified form, it's essentially
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between 123 and 456;
Its performance was excellent with literal arguments (1 sec per execution).
But, when I used pl/sql bind argument variables instead of 123 and 456 as literals, the explain plan changes drastically, and runs 10+ minutes.
Ex:
CREATE PROCEDURE runQuery(param1 INTEGER, param2 INTEGER){
CURSOR LT_CURSOR IS
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between param1 AND param2;
BEGIN
FOR aRecord IN LT_CURSOR
LOOP
(print timestamp...)
END LOOP;
END runQuery;
Rewriting the query 5 different ways was unfruitful. DB hints were also unfruitful in this particular case. LargeTable.pk_id was an indexed field as were all other join fields.
Solution:
Lacking other options, I wrote a literal query that concatenated the variable args. Open a cursor for the literal query.
Upside: It changed the explain plan to the only really fast option and performed at 1 second instead of 10mins.
Downside: Query not cached for future use. Perfectly fine for this query's purpose.
Other suggestions are welcome.AmandaSoosai wrote:
I have a complex query with 5+ table joins on large (million+ row) tables. In it's most simplified form, it's essentially
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between 123 and 456;
Its performance was excellent with literal arguments (1 sec per execution).
But, when I used pl/sql bind argument variables instead of 123 and 456 as literals, the explain plan changes drastically, and runs 10+ minutes.
Ex:
CREATE PROCEDURE runQuery(param1 INTEGER, param2 INTEGER){
CURSOR LT_CURSOR IS
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between param1 AND param2;
BEGIN
FOR aRecord IN LT_CURSOR
LOOP
(print timestamp...)
END LOOP;
END runQuery;
Rewriting the query 5 different ways was unfruitful. DB hints were also unfruitful in this particular case. LargeTable.pk_id was an indexed field as were all other join fields.
Solution:
Lacking other options, I wrote a literal query that concatenated the variable args. Open a cursor for the literal query.
Upside: It changed the explain plan to the only really fast option and performed at 1 second instead of 10mins.
Downside: Query not cached for future use. Perfectly fine for this query's purpose.
Other suggestions are welcome.Best wild guess based on what you've posted is a bind variable mismatch (your column is declared as a NUMBER data type and your bind variable is declared as a VARCHAR for example). Unless you have histograms on the columns in question ... which, if you're using bind variables is usually a really bad idea.
A basic illustration of my guess
http://blogs.oracle.com/optimizer/entry/how_do_i_get_sql_executed_from_an_application_to_uses_the_same_execution_plan_i_get_from_sqlplus -
Hello,
I am currently working with digital accelerometer LIS35DE from ST Microelectronics. I want to start with tests of this device. For that purpose I used NI 845x USB to connect with accelerometer via I2C. Unfortunately, when I made electrical connections and set up parameters of communication and run the program (I found it in examples) the following error occured:
Error -301713 occurred at Property Node (arg 2) in General I2C Read.vi
Possible reason(s):
NI-845x: An input parameter, or combination of parameters, is invalid. An example of this error may be setting an invalid baud rate or enabling I2C ACK polling while using 10-bit addressing.
The code can be found in attachements. I couldn't find any extended description of this problem. What could be a problem: incorrect device address, register address, configuration parameters?
Any help is appreciated!
Best regards,
Michael
Attachments:
General I2C Read.vi 24 KBHi MicMac89!
First of all could you please post which version of LabView are you using?
Could you please tell me which version of 845X hw are you using? (8451 or 8452)
I opened the example you attached. As you wrote the error occurs at the second argument of the property node. (I guess this is the first property node where the error occurs.)
This argument of the property node enables the onboard pull-up resistors. But not all NI-845x hardware support pull-up resistors. (Because of this is important to know which hw version are you using.)
Did you try the example with disabling the pull-up resistors?
I suggest you to go through the Manual of this product, (if you did this not yet) This could make it clear where and when to use what kind of pull-up resistors.
For example: If you are using 8452, you must enable pull-up resistors, for Vref ≤ 1.8 V for the FPGA to properly detect a low-to-high transition
Manual: http://www.ni.com/pdf/manuals/371746d.pdf
HW specification: http://www.ni.com/pdf/manuals/290598a.pdf
Please post if my suggestions helped. Of course if you have any questions, don't hesitate to post them.
Best regards,
Balazs Nagy -
Error 1073807202 occurred at Property Node (arg 1) in VISA Configure
I am working with the 30-day evaluation version of LabVIEW
(Version 9.0 32-bit). I am attempting to perform the serial loopback test
described in NI's Developer Zone Tutorial, executing Basic Serial Read and
Write.vi. When I click the Run arrow a dialog box appears with the
following legend:
"Error 1073807202 occurred at Property Node (arg 1) in VISA Configure
Serial Port (Instr).vi>Basic Serial Read and Write.vi. LabVIEW: VISA or
code library could not be located. ...required drive not installed..."
I can find the "smplserl.vi" driver in the /examples folder on my PC.
What's wrong?Did you do a search for that error? Install NI-VISA.
-
how do i call this from jsp? <%spServicelnd temp = new spServicelnd();%> does not work because the program has a main. can i make another 2nd.java to call this spServiceInd.java then call 2nd.java by jsp? if yes, how??? The code is found below...
import java.net.MalformedURLException;
import java.io.IOException;
import com.openwave.wappush.*;
public class spServiceInd
private final static String ppgAddress = "http://devgate2.openwave.com:9002/pap";
private final static String[] clientAddress = {"1089478279-49372_devgate2.openwave.com/[email protected]"};
// private final static String[] clientAddress = {"+639209063665/[email protected]"};
private final static String SvcIndURI = "http://devgate2.openwave.com/cgi-bin/mailbox.cgi";
private static void printResults(PushResponse pushResponse) throws WapPushException, MalformedURLException, IOException
System.out.println("hello cze, I'm inside printResult");
//Read the response to find out if the Push Submission succeded.
//1001 = "Accepted for processing"
if (pushResponse.getResultCode() == 1001)
try
String pushID = pushResponse.getPushID();
SimplePush sp = new SimplePush(new java.net.URL(ppgAddress), "SampleApp", "/sampleapp");
StatusQueryResponse queryResponse = sp.queryStatus(pushID, null);
StatusQueryResult queryResult = queryResponse.getResult(0);
System.out.println("Message status: " + queryResult.getMessageState());
catch (WapPushException exception)
System.out.println("*** ERROR - WapPushException (" + exception.getMessage() + ")");
catch (MalformedURLException exception)
System.out.println("*** ERROR - MalformedURLException (" + exception.getMessage() + ")");
catch (IOException exception)
System.out.println("*** ERROR - IOException (" + exception.getMessage() + ")");
else
System.out.println("Message failed");
System.out.println(pushResponse.getResultCode());
}//printResults
public void SubmitMsg() throws WapPushException, IOException
System.out.println("hello cze, I'm inside SubmitMsg");
try
System.out.println("hello cze, I'm inside SubmitMsg (inside Try)");
//Instantiate a SimplePush object passing in the PPG URL,
//product name, and PushID suffix, which ensures that the
//PushID is unique.
SimplePush sp = new SimplePush(new java.net.URL(ppgAddress), "SampleApp", "/sampleapp");
//Send the Service Indication.
PushResponse response = sp.pushServiceIndication(clientAddress, "You have a pending Report/Request. Please logIn to IRMS", SvcIndURI, ServiceIndicationAction.signalHigh);
//Print the response from the PPG.
printResults(response);
}//try
catch (WapPushException exception)
System.out.println("*** ERROR - WapPushException (" + exception.getMessage() + ")");
catch (IOException exception)
System.out.println("*** ERROR - IOException (" + exception.getMessage() + ")");
}//SubmitMsg()
public static void main(String[] args) throws WapPushException, IOException
System.out.println("hello cze, I'm inside main");
spServiceInd spsi = new spServiceInd();
spsi.SubmitMsg();
}//main
}//class spServiceIndIn general, classes with main method should be called from command prompt (that's the reason for main method). Remove the main method, put the class in a package and import the apckage in your jsp (java classes should not be in the location as jsps).
When you import the package in jsp, then you can instantiate the class and use any of it's methods or call the statis methods directly:
<%
spServiceInd spsi = new spServiceInd();
spsi.SubmitMsg();
%> -
Potential Args, Computer shutting down while playing a game
I've only had this mac for 5 months, but it keeps shutting down while I'm playing StarCraft II. It should be able to handle the game, but it keeps telling me to restart and I have no idea what the error says or means. I'm not sure what (4 potential args on stack) means. I'm not sure if it is a frame rate issue and how to fix it or change the frame rate if needed. Any help would be much appreciated. The error is below:
Interval Since Last Panic Report: 145971 sec
Panics Since Last Report: 2
Anonymous UUID: 1017C80F-D5F3-488B-91B6-01EB174E0122
Mon Apr 11 21:51:18 2011
panic(cpu 2 caller 0x2aab59): Kernel trap at 0x0097efb5, type 14=page fault, registers:
CR0: 0x80010033, CR2: 0x0000003c, CR3: 0x00100000, CR4: 0x00000660
EAX: 0x00000000, EBX: 0x00000000, ECX: 0x00000000, EDX: 0x5724a710
CR2: 0x0000003c, EBP: 0x5724a658, ESI: 0x5724a710, EDI: 0x00000000
EFL: 0x00010202, EIP: 0x0097efb5, CS: 0x00000008, DS: 0x00000010
Error code: 0x00000000
Backtrace (CPU 2), Frame : Return Address (4 potential args on stack)
0x5724a448 : 0x21b510 (0x5d9514 0x5724a47c 0x223978 0x0)
0x5724a498 : 0x2aab59 (0x59aeec 0x97efb5 0xe 0x59b0b6)
0x5724a578 : 0x2a09b8 (0x5724a590 0x0 0x5724a658 0x97efb5)
0x5724a588 : 0x97efb5 (0xe 0x48 0x10 0x10)
0x5724a658 : 0x98180d (0xaed6000 0x0 0x0 0x2)
0x5724a998 : 0x9825bd (0xaed6000 0x50d79590 0x7d0 0x2a9268)
0x5724a9b8 : 0x985c8c (0xaed6000 0x50d79590 0x19 0x99e9b3)
0x5724a9f8 : 0x985f04 (0xaed6000 0xaed6114 0xaed62c4 0x0)
0x5724aa58 : 0x9549fb (0xaed6000 0x141f3c00 0x8ffa86f9 0xc1)
0x5724ab08 : 0x951533 (0xaed6000 0x0 0x5724ab6c 0x5724ab68)
0x5724ab88 : 0x56a738 (0xaed6000 0x0 0x5724addc 0x5724ac14)
0x5724abd8 : 0x56afd7 (0xa4b880 0xaed6000 0x889bf88 0x1)
0x5724ac28 : 0x56b88b (0xaed6000 0x10 0x5724ac70 0x0)
0x5724ad48 : 0x285be0 (0xaed6000 0x10 0x889bf88 0x1)
0x5724bdf8 : 0x21d8be (0x889bf60 0xaedf5a0 0x20ca0 0x4807)
0x5724be38 : 0x210a3e (0x889bf00 0x0 0x9f91bd0 0x9f921f0)
0x5724be98 : 0x216ca1 (0x889bf00 0x0 0x0 0x0)
0x5724bf18 : 0x294e25 (0x5724bf44 0x0 0x0 0x0)
0x5724bfc8 : 0x2a1028 (0x9b91280 0x0 0x10 0x9b93d40)
Kernel Extensions in backtrace (with dependencies):
com.apple.ATIRadeonX3000(6.2.6)@0x948000->0xb54fff
dependency: com.apple.iokit.IOPCIFamily(2.6)@0x908000
dependency: com.apple.iokit.IONDRVSupport(2.2)@0x93b000
dependency: com.apple.iokit.IOGraphicsFamily(2.2)@0x919000
BSD process name corresponding to current thread: SC2
Mac OS version:
10J869
Kernel version:
Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
System model name: iMac11,3 (Mac-F2238BAE)
System uptime in nanoseconds: 1303791505121
unloaded kexts:
com.apple.driver.AppleUSBUHCI 4.1.5 (addr 0x1148000, size 0x65536) - last unloaded 128377333974
loaded kexts:
com.razer.naga.driver 2.0.0
com.apple.driver.AGPM 100.12.19
com.apple.driver.AppleHWSensor 1.9.3d0
com.apple.driver.AppleMikeyHIDDriver 1.2.0
com.apple.driver.AppleUpstreamUserClient 3.5.4
com.apple.driver.AppleMCCSControl 1.0.17
com.apple.driver.AppleHDA 1.9.9f12
com.apple.kext.ATIFramebuffer 6.2.6
com.apple.driver.AppleMikeyDriver 1.9.9f12
com.apple.driver.AudioAUUC 1.54
com.apple.ATIRadeonX3000 6.2.6
com.apple.DontSteal_Mac_OSX 7.0.0
com.apple.driver.AudioIPCDriver 1.1.6
com.apple.driver.AirPort.Atheros21 424.14.5
com.apple.driver.ACPISMCPlatformPlugin 4.5.0d5
com.apple.driver.AppleLPC 1.4.12
com.apple.driver.AppleBacklight 170.0.34
com.apple.filesystems.autofs 2.1.0
com.apple.driver.AppleIRController 303.8
com.apple.driver.AppleUSBCardReader 2.5.8
com.apple.BootCache 31
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.iokit.SCSITaskUserClient 2.6.5
com.apple.iokit.IOAHCIBlockStorage 1.6.3
com.apple.driver.AppleUSBHub 4.1.7
com.apple.driver.AppleFWOHCI 4.7.1
com.apple.iokit.AppleBCM5701Ethernet 2.3.9b6
com.apple.driver.AppleEFINVRAM 1.4.0
com.apple.driver.AppleUSBEHCI 4.1.8
com.apple.driver.AppleAHCIPort 2.1.5
com.apple.driver.AppleACPIButtons 1.3.5
com.apple.driver.AppleRTC 1.3.1
com.apple.driver.AppleHPET 1.5
com.apple.driver.AppleSMBIOS 1.6
com.apple.driver.AppleACPIEC 1.3.5
com.apple.driver.AppleAPIC 1.4
com.apple.driver.AppleIntelCPUPowerManagementClient 105.13.0
com.apple.security.sandbox 1
com.apple.security.quarantine 0
com.apple.nke.applicationfirewall 2.1.11
com.apple.driver.AppleIntelCPUPowerManagement 105.13.0
com.apple.driver.AppleBluetoothHIDKeyboard 141 - last loaded 37170530879
com.apple.driver.IOBluetoothHIDDriver 2.4.0f1
com.apple.driver.AppleHIDKeyboard 141
com.apple.driver.DspFuncLib 1.9.9f12
com.apple.driver.AppleProfileReadCounterAction 17
com.apple.driver.AppleProfileTimestampAction 10
com.apple.driver.AppleProfileThreadInfoAction 14
com.apple.driver.AppleProfileRegisterStateAction 10
com.apple.driver.AppleProfileKEventAction 10
com.apple.driver.AppleProfileCallstackAction 20
com.apple.driver.AppleSMBusController 1.0.8d0
com.apple.kext.ATI5000Controller 6.2.6
com.apple.kext.ATISupport 6.2.6
com.apple.iokit.IOFireWireIP 2.0.3
com.apple.iokit.IOSurface 74.2
com.apple.iokit.IOBluetoothSerialManager 2.4.0f1
com.apple.iokit.IOSerialFamily 10.0.3
com.apple.iokit.IOAudioFamily 1.8.0fc1
com.apple.kext.OSvKernDSPLib 1.3
com.apple.driver.AppleHDAController 1.9.9f12
com.apple.iokit.IOHDAFamily 1.9.9f12
com.apple.iokit.IO80211Family 314.1.1
com.apple.iokit.AppleProfileFamily 41
com.apple.driver.AppleSMC 3.1.0d3
com.apple.driver.IOPlatformPluginFamily 4.5.0d5
com.apple.driver.AppleSMBusPCI 1.0.8d0
com.apple.iokit.IONDRVSupport 2.2
com.apple.iokit.IOGraphicsFamily 2.2
com.apple.driver.BroadcomUSBBluetoothHCIController 2.4.0f1
com.apple.driver.AppleUSBBluetoothHCIController 2.4.0f1
com.apple.iokit.IOBluetoothFamily 2.4.0f1
com.apple.iokit.IOUSBHIDDriver 4.1.5
com.apple.iokit.IOSCSIBlockCommandsDevice 2.6.5
com.apple.iokit.IOUSBMassStorageClass 2.6.5
com.apple.driver.AppleUSBMergeNub 4.1.8
com.apple.driver.AppleUSBComposite 3.9.0
com.apple.iokit.IOSCSIMultimediaCommandsDevice 2.6.5
com.apple.iokit.IOBDStorageFamily 1.6
com.apple.iokit.IODVDStorageFamily 1.6
com.apple.iokit.IOCDStorageFamily 1.6
com.apple.driver.XsanFilter 402.1
com.apple.iokit.IOAHCISerialATAPI 1.2.5
com.apple.iokit.IOSCSIArchitectureModelFamily 2.6.5
com.apple.iokit.IOUSBUserClient 4.1.5
com.apple.iokit.IOFireWireFamily 4.2.6
com.apple.iokit.IONetworkingFamily 1.10
com.apple.iokit.IOUSBFamily 4.1.8
com.apple.iokit.IOAHCIFamily 2.0.4
com.apple.driver.AppleEFIRuntime 1.4.0
com.apple.iokit.IOHIDFamily 1.6.5
com.apple.iokit.IOSMBusFamily 1.1
com.apple.kext.AppleMatch 1.0.0d1
com.apple.security.TMSafetyNet 6
com.apple.driver.DiskImages 289
com.apple.iokit.IOStorageFamily 1.6.2
com.apple.driver.AppleACPIPlatform 1.3.5
com.apple.iokit.IOPCIFamily 2.6
com.apple.iokit.IOACPIFamily 1.3.0
Model: iMac11,3, BootROM IM112.0057.B00, 2 processors, Intel Core i3, 3.2 GHz, 4 GB, SMC 1.59f2
Graphics: ATI Radeon HD 5670, ATI Radeon HD 5670, PCIe, 512 MB
Memory Module: global_name
AirPort: spairportwireless_card_type_airportextreme (0x168C, 0x8F), Atheros 9280: 2.1.14.5
Bluetooth: Version 2.4.0f1, 2 service, 19 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Network Service: AirPort, AirPort, en1
Serial ATA Device: SAMSUNG HD103SJ, 931.51 GB
Serial ATA Device: OPTIARC DVD RW AD-5680H
USB Device: Hub, 0x0424 (SMSC), 0x2514, 0xfd100000
USB Device: Razer Naga, 0x1532, 0x0015, 0xfd130000
USB Device: IR Receiver, 0x05ac (Apple Inc.), 0x8242, 0xfd120000
USB Device: Built-in iSight, 0x05ac (Apple Inc.), 0x8502, 0xfd110000
USB Device: Hub, 0x0424 (SMSC), 0x2514, 0xfa100000
USB Device: BRCM2046 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000
USB Device: Bluetooth USB Host Controller, 0x05ac (Apple Inc.), 0x8215, 0xfa111000
USB Device: Internal Memory Card Reader, 0x05ac (Apple Inc.), 0x8403, 0xfa120000You are only just beginning to feel the pain of Starcraft II on your Mac. Have you seen this List of problems?
Blizzard created the junk, and it's up to them to properly patch it. The list of other well known and respected programs it's incompatible with (LittleSnitch, AppCleaner, FileVault, and PeerGuardian to name a few) doesn't give me a warm and fuzzy.
The page also mentions that your CPU can overheat, for whatever reason, and that means total failure for a laptop or early component damage to a motherboard. Gee, that sounds like something that shouldn't be run on a regular basis. -
It looks like my MBP optical drive is dead - arg!
I have a Macbook Pro - circa 2006. This one does not have apple care.
I've got a blank cdr stuck inside it. As near as I can tell the macbook
does not even know it has a cd/dvd drive anymore. The drive is spinning,
but the OS does not see a disk. Nothing in disk utility. Holding down
mouse button or eject key does nothing. Trying drutil seems to do nothing.
Choosing about this mac tells me there no Disc Burning device was found.
Arg.
I don't burn things on this machine often, so it is not critical, but is nice to have. The geniuses I run into seem to know less than the people here. I guess I should give them a try, but I'm already afraid of what they'll estimate for repair.
I'm thinking just buy an external cd/dvd drive/burner would be a good option for this machine. Any specific suggestions? Anything more I should try before I throw money at it?
The other issue is, I hate wasting battery spinning a disk the machine cannot seem to see. Do I have to open the machine up (or pay somebody to do it) to turn
off the defective internal drive?
Is there a reasonably priced internal (or external) drive that would be recognised by the system should I have to reload or update the OS at some point?
Thanks for your help.It may be something of a long shot, but you might check to see that DVD player is still in your applications folder. Also, you could try verifying both permissions and the disk, and repair if necessary. I don't know if that will help, but it won't hurt anything. It may even be worth trying to reinstall the OS, just in case it has somehow gotten corrupted and is not recognizing the optical drive. It might be worth booting from your install disc and navigate to Disk Utility and see if you can see the optical drive then.
It's also possible that one of the cables to the optical drive has come undone and needs to be reseated.
On the other hand, I have been reading about optical drive problems on this forum for some time, and some people thing the internal optical drive is just not of the best possible quality. So investing in a good external optical drive may not be a bad strategy.
Good luck! -
I have an iphone 4 that I recently upgraded to IOS 7, and now I cant drag music to it. It says "preparing to update" eternally. Weird thing is... I have an iphone 3s that is IOS 6, and it takes new music all day. arg.
I have tried direct connecting the iphone 4, via wifi, everything. I hate itunes with a passion, but it seems to be a necessary evil. I dont know why I would have no trouble with my iphone 3. I am using the same technique for both phones. Find the music I want in the library and drag it to the iphone. Works on IOS 6, not IOS 7.
WHat else should I try?Hi jeffmbellucci,
If you are having issues dragging music to your iPhone 4 after a recent upgrade to iOS 7, you may want to verify that the phone is still set to "Manually manage music and videos." You may find the following article helpful:
Apple Support: Managing content manually on iPhone, iPad, and iPod
http://support.apple.com/kb/ht1535
Regards,
- Brenden -
Arg! Airport Extreme to Extreme- Can't Connect via ethernet
Hello- Arg! Frustrated and can't figure out what's going on.
Goal: Wirelessly connect an airport extreme to another airport extreme and use the 2nd Extreme as a local wired hub.
Problem: Everything works fine, but any machine that is hooked up to the 2nd extreme isn't getting a DHCP assigned and can't see it. But wireless can see it and works great.
Setup: (here goes)
- Airport extreme 1 (AE1) is hooked up to a comcast cable modem. Works great
- Airport extreme 2 (AE2) has been configured to wirelessly join AE1- This also works great.
- 2 Mac pros are connected to AE2 via ethernet cable
visual example:
(comcast) - (AE1) ~~ (AE2) - Mac pros "~" = wireless, "-" = wired
I've tried different machines and cables... no luck. If I reset AE2, they can all connect.
What am I doing wrong here... seems like ethernet is being disabled.
All AE have been updated and along with computer software. All wireless works fine.
Thanks!
Message was edited by: mr.billGot it... Instead of joining, I had to select extend and ensure that AE1 had extend network enabled. Seems to be working now. Sweet!
-
Req help in conversion of string to array of args
Hi,
i need help in converting a string into array of args just like command line args
i have a string s1 = 12 13 56 etc
now i want to copy that into an array a[]
a[0] = 12
a[1] = 13 etc
Thanks for helpU can use String tokenizer.Why prefer that over split?Yah Bobby u can use split too..
J2SE 1.4 added the split() method to simplify the task of breaking a string into substrings, or tokens.
Thanks BigDaddy.. I realized after you told.
try this too..
String str = "Your string";
String[] arr = str.split (" ");
for (int i=0; i < arr.length; i++)
System.out.println (arr); -
A problem with args[i]
Hi, I'm totally new to Java and I have a problem with my first program. It has to read the numbers from the input and checks wheter it is a prime number.
This is what I have so far:
public class PrimeNumbers
public static boolean isPrime(int n)
if (n<2) return false;
if (n==2||n==3) return true;
boolean prime=true;
int limit=(int)Math.sqrt(n);
for (int i=2; i<=limit; i++)
if ( n%i==0 )
prime = false;
break;
return prime;
public static void main ( String[] args )
int n,i;
for(i=0;i<=args.length;i++)
n=args;
if (isPrime (n))
System.out.println (n+ "is Prime");
else
System.out.println (n+ "is not Prime");
It shows an error in line : "n=args[i];". Can you tell me how to fix it? Thanks :*Integer.parseInt(args)
-
Problem opening a file from a command line executed program with args
I have to run my program from the command prompt like this:
c:\ java Parser template.txt keyvalue.dat output.txt
I figured out how to read the args in, and I know they are being assigned to the proper variables. My template.txt, etc are in the same directory that I am in when I run the program. They are also all lowercase, just like the command.
The only error it throws is the one that I coded (Error opening file template.txt) I would make my message better if I knew what the problem was!!!!
Any ideas (either for what I'm missing or how to improve my error handling) :\
JenAfter catching the exception, call the printStackTrace() to have it print out the error it caught, as well as the file and line number it occured on...
-
GetTreeCellRendererComponent(): get path to value without using row-arg?
I'm using a JTree to display hierarchical data which include cyclic dependencies (i.e. an item may be its own ancestor).
If a node shows up for the second time in a hierarchical tree path, I put a stop to further expansion (using the getPath() of a TreeExpansionEvent in a TreeWillExpandListener), and I give the node a special display (using a tree-cell renderer with a custom implementation of getTreeCellRendererComponent()). The implementation uses tree.getPathForRow(row) to get the path by which can be detected if a node is cyclic, but this does not always work: sometimes tree.getPathForRow(row).getLastPathComponent() corresponds to the value-object given as argument to getTreeCellRendererComponent(), but sometimes it does not.
The example below shows the difference (switch the lines marked "Not OK" by the line marked "OK"; to keep it simple, I left the cyclic dependencies out).
Checking the swing source files reveals that if getTreeCellRendererComponent() is called by paintRow() in BasicTreeUI, value and row correspond. But if getTreeCellRendererComponent() is called by getNodeDimensions() in one of the LayoutCache-classes, the given value-object does not correspond to the object at the given tree-row. Somewhere I read that getNodeDimensions() is called to determine preferred sizes of nodes before they are shown for the first time. If that's the case, it is logical that value and row do not correspond, although I would have liked to get a hint, e.g. a row value of -1.
To detect a cyclic node, I need a treepath, but the row-argument is unreliable. Is there another way to determine the path corresponding to the value-object passed to getTreeCellRendererComponent(), so without having to use the row-argument?
* treeUpdate.java
package treeupdate;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.event.EventListenerList;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
public class treeUpdate extends javax.swing.JFrame {
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTree jTree1;
private ItemInHierarchy root = null;
private SimpleTreeModel htm = new SimpleTreeModel();
private SimpleTreeCellRenderer htcr = new SimpleTreeCellRenderer();
public treeUpdate() {
initComponents();
generateHierarchy();
jTree1.setModel(htm);
jTree1.setCellRenderer(htcr);
// init
private void initComponents() {
setTitle("row-value correspondence");
setSize(new Dimension(300,500));
jScrollPane1 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jScrollPane1.setViewportView(jTree1);
add(jScrollPane1);
// generate data
private void generateHierarchy() {
root = new ItemInHierarchy("Joverra");
ItemInHierarchy c1 = new ItemInHierarchy("Kondat Kalbendate");
c1.children.add(new ItemInHierarchy("Linovar Welchessante Somtanessia"));
c1.children.add(new ItemInHierarchy("Muzarra Frontiminoi Wioppallae"));
c1.children.add(new ItemInHierarchy("Niobitia Fyttichiokla Quantianou"));
root.children.add(c1);
ItemInHierarchy c2 = new ItemInHierarchy("Orud Kalbene");
c2.children.add(new ItemInHierarchy("Pascalite Welchessante Somtanessia"));
c2.children.add(new ItemInHierarchy("Quinnime Frontiminoi Wioppallae"));
c2.children.add(new ItemInHierarchy("Ruttinovi Fyttichiokla Quantianou"));
root.children.add(c2);
ItemInHierarchy c3 = new ItemInHierarchy("Si Kae");
c3.children.add(new ItemInHierarchy("Tonniate Welchessante Somtanessia"));
c3.children.add(new ItemInHierarchy("Uvverten Frontiminoi Wioppallae"));
c3.children.add(new ItemInHierarchy("Vlioppala Fyttichiokla Quantianou"));
root.children.add(c3);
* Tree model
private class SimpleTreeModel implements TreeModel {
protected EventListenerList listenerList = new EventListenerList();
public Object getRoot() {
return root;
public Object getChild(Object parent, int index) {
ItemInHierarchy i = (ItemInHierarchy)parent;
return i.children.get(index);
public int getChildCount(Object parent) {
ItemInHierarchy i = (ItemInHierarchy)parent;
return i.children.size();
public boolean isLeaf(Object node) {
ItemInHierarchy i = (ItemInHierarchy)node;
return i.children.size()==0;
public void valueForPathChanged(TreePath path, Object newValue) {
// do nothing
public int getIndexOfChild(Object parent, Object child) {
ItemInHierarchy i = (ItemInHierarchy)parent;
for (int k = 0; k < i.children.size(); k++) {
if (i.children.get(k).equals((ItemInHierarchy)child)) {
return k;
return -1;
public void addTreeModelListener(TreeModelListener l) {
listenerList.add(TreeModelListener.class, l);
public void removeTreeModelListener(TreeModelListener l) {
listenerList.remove(TreeModelListener.class, l);
* Cell renderer
private class SimpleTreeCellRenderer extends JLabel implements TreeCellRenderer {
public SimpleTreeCellRenderer() {
setOpaque(true);
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
// OK
// setText(value.toString());
// Not OK
TreePath tp = tree.getPathForRow(row);
if (tp!=null) {
setText(tp.getLastPathComponent().toString());
} else {
setText("?");
return this;
* Item in hierarchy
public class ItemInHierarchy {
public List<ItemInHierarchy> children = new ArrayList<ItemInHierarchy>();
public String name;
public ItemInHierarchy() {
public ItemInHierarchy(String name) {
this.name = name;
@Override
public String toString() {
return name;
// main
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new treeUpdate().setVisible(true);
}Kleopatra wrote:
The only general way to hack-around, as far as I remember, is to force the VariableSomething out of the way and make a FixedSomething takes it place. No api, but you can reach that by doing both:
- tree.setLargeModel(true)
- tree.setRowHeight(somevalueabovezero)
Your memory's fine. I ran a short test, this seems to make row- and value-arguments correspond to each other consistently.
Kleopatra wrote:
... before expanding a node it calls the renderer with the row set to the the row following the row of the node to expand (same for all children)...I suspected something like this, and it opens up a way to solve my question, but it seemed like a too shallow basis for coding. I'm satisfied with fixed row heights, so I'll stick to your suggestion above, and I'll include a short equality test in getTreeCellRendererComponent(), just to make sure:
value.equals(tree.getPathForRow(row).getLastPathComponent())Thanks for the help - Jan -
Japanese characters from args giving question marks on Japanese OS
Hi,
We are internationalising our product to japanese, and one of the features is to be able to open a file containing japanese characters from a double click on a japanese windows OS.
The double click is set up in the registry, and indeed it works properly for most characters. There are a few characters though (unicode character 20060 among them) that it doesn't work for, and what happens is that between the double clicking of the file, and the command line name of the file to open ("%1" in the registry / args[0] in java), the character in question is converted into the literal character for "?" (ascii 63), and java can't open the file.
Testing wordpad directly with this character is fine, the file opens. I've written a simple C++ app and a simple JAVA app which fork wordpad with the fileName param passed to it from the registry, and it didn't open the file passed because of that character.
So our java application, a simple java program and a simple C++ program can't resolve the fileName passed to it because of this character.
The thing is, wordpad is using the same regedit method to get its parameters as we do ("appName.exe" "%1" in shell/open/command) and it opens files containing this character without a problem.
Any ideas on what I'm missing?
Thanks very much
JackHi,
We are internationalising our product to japanese,
and one of the features is to be able to open a file
containing japanese characters from a double click on
a japanese windows OS.
The double click is set up in the registry, and
indeed it works properly for most characters. There
are a few characters though (unicode character 20060
among them) that it doesn't work for, and what
happens is that between the double clicking of the
file, and the command line name of the file to open
("%1" in the registry / args[0] in java), the
character in question is converted into the literal
character for "?" (ascii 63), and java can't open the
file.
Testing wordpad directly with this character is fine,
the file opens. I've written a simple C++ app and a
simple JAVA app which fork wordpad with the fileName
param passed to it from the registry, and it didn't
open the file passed because of that character.
So our java application, a simple java program and a
simple C++ program can't resolve the fileName passed
to it because of this character.
The thing is, wordpad is using the same regedit
method to get its parameters as we do ("appName.exe"
"%1" in shell/open/command) and it opens files
containing this character without a problem.
Any ideas on what I'm missing?
Thanks very much
JackUnicode 20060 belongs to an extended part of JIS Kanji code set and there can be many
applications or systems that do not support those characters. Shift_JIS doesn't and
EUC-JP use 24 bit code for representig those chars which, unfortunately, aren't supported
by most exixting apps. -
Problem with vmargs at ARGS property in imqbrokerd.conf
Hi @ all,
I'm currently testing Sun Message Queue and would like to give the Queue a little bit more of memory.
I read the docs and tried to set the vmargs parameter at the ARGS property in the imqbrokerd.conf.
But when I try to start the Queue I get a Exception in thread "main" java.lang.NoClassDefFoundError: "-Xms256m error and I'm a bit confused.
My ARGS look like this:
ARGS=-name testqueue-vmargs "-Xms256m -Xmx512m"
I also tested with escaping the like
ARGS=-name testqueue-vmargs \"-Xms256m -Xmx512m\"
but this also doesn't helps.
Could somebody help me with this?
Thanks, NoOne1337Could it be the missing space?
That won't work...
ARGS=-name testqueue-vmargs "-Xms256m -Xmx512m"
But that, might...
ARGS=-name testqueue -vmargs "-Xms256m -Xmx512m"
TE -
Hello guys,
maybe its a simple problem, but i have it ;) . My javafx 1.3.1 applet starts with the jnlp below without any problems. But on a MAC OS X 10.6 it dont work. Without the java-vm-args -attribute, it will start, but the applet runs into an "OutOfMemory.PermGen"-Error, so i need the attributes to rise the size. Can anyone help me ?
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://www.persoware.de/newPersoware4338/" href="Persoware_browser.jnlp">
<information>
<title>Persoware</title>
<vendor>maier</vendor>
<homepage href="http://www.persoware.de/newPersoware4338/"/>
<description>Persoware</description>
<icon kind="splash" href="http://dl.javafx.com/1.3/splash.png"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" java-vm-args="-d32 -XX:PermSize=64m -XX:MaxPermSize=256m"/>
<property name="jnlp.packEnabled" value="true"/>
<property name="jnlp.versionEnabled" value="true"/>
<extension name="JavaFX Runtime" href="http://dl.javafx.com/1.3/javafx-rt.jnlp"/>
<jar href="Persoware.jar" main="true" size="12153804"/>
<jar href="lib/JFXtras-Controls-0.7rc2.jar" size="1435119"/>
<jar href="lib/jtds-1.2.5.jar" size="306199"/>
<jar href="lib/JFXtras-Common-0.7rc2.1.jar" size="1291808"/>
<jar href="lib/miglayout-3.7.jar" size="201034"/>
<jar href="lib/jdom-1.1.2.jar" size="156628"/>
<jar href="lib/TableView_abdm.jar" size="85407"/>
<jar href="lib/sqljdbc4.jar" size="525491"/>
</resources>
<applet-desc name="Persoware" main-class="com.sun.javafx.runtime.adapter.Applet" progress-class="com.javafx.progressbar.ProgressManager" width="800" height="600">
<param name="MainJavaFXScript" value="gui.Main"/>
</applet-desc>
<update check="always"/>
</jnlp>JavaFX 1.3 has multiple memory leaks problems:
http://javafx-jira.kenai.com/browse/RT-6921
You are not alone in this issue...actually I didn't know that JavaFX 1.3 applets work on MAC ;)
You'll have to migrate to JavaFX 2.XX and wait for the JavaFX runtime on MAC
Best
Edited by: alabala on 2012-2-28 9:02
Maybe you are looking for
-
Workaround for Flash Player 10 crash bug
My company develops Flash based e-learning modules, we've been building modules based on our current codebase for a few years now without problem. In our most recent project we've run into a new bug where the Flash Player completely stalls the browse
-
Keywords added to new files....
I am not sure about the origin of this behaviour but when I open a new file it already has a group of keywords that I have used in the past. I am unable to determine where I can turn this behaviour off. I generally move the images from flash drive to
-
Hi, I am generating a XML using DOM (org.w3c.dom ) which holds the form values. The XML schema is like this <root> <data> <id>1</id> <check>True</check> </data> <data> <id>2</id> <check>false</check> </data> </root> What im doing in my code - I/P : R
-
Our international offices have a legal requirement to print each journal entry posted to their general ledger. They currently use FB03 to print each entry. I cannot find another report or other program to allow multiple entries to be printed at once
-
Configuring SAP Provided oData services
Hi All, I saw that sap has many pre-delivered many oData services. SAP NetWeaver Gateway Supported OData Channel Scenarios - SAP NetWeaver Gateway - SAP Library Has anyone configured them and got to work? I have a Hub Scenario and see that IW_CNT is