Help with dragdrop using mx:List and mx:DataGrid
I have drag and drop working. The problem I have is when an item in the list is selected, the list's scrollbar participates in the drag drop. So, scrolling looks to the user as if a drag drop operation is taking place. I'm using a MouseDown handler to initiate the drag drop. I suspect this is part of the problem.
What other event(s) should I be using?
Thank you in advance,
Richard Bailey
because I read that linked lists is the best approach for sparse array matrices,
where most of the elements are zeros, and just a few elements are not. which will reduce the memory space if lets say generate a 100x100 grid.
Similar Messages
-
Can anyone help with issue whereby Music, Podcasts and Audiable Book Apps keep stopping when listing via Headphones following IOS 7.06 Updates on Iphone 4?
I have tried the following all ready:
Resetting Phone
Resetting Settings on phone
Change Headsets to speakers
Reinstalled Phone
Updated to IOS 7.1
No of the above has resolved the issue does anyone have any ideas?Can anyone help with issue whereby Music, Podcasts and Audiable Book Apps keep stopping when listing via Headphones following IOS 7.06 Updates on Iphone 4?
I have tried the following all ready:
Resetting Phone
Resetting Settings on phone
Change Headsets to speakers
Reinstalled Phone
Updated to IOS 7.1
No of the above has resolved the issue does anyone have any ideas? -
Hi i would like help with:
When I draw circle and add stroke I can not see stroke
I use Photoshop CS 5Make sure the stroke is set to a color and not to the symbol that appears here for Fill
-
need help with how to reset bios and admin password to reformat hard drive in 8440p elitebook? removal of cmos, resetting laptop, using cccleaner, windows password recovery and hiren's was noneffective, any help is appreciated. thanks
Hi,
As your notebook is a business class machine, security is more stringent - the password is stored in non-volatile memory and there are no 'backdoor' passwords. Your best option would be to contact HP regarding this.
Regards,
DP-K
****Click the White thumb to say thanks****
****Please mark Accept As Solution if it solves your problem****
****I don't work for HP****
Microsoft MVP - Windows Experience -
Logging with whereabouts using open source and freeware
You can find the html version of this at:
http://www.acelet.com/whitepaper/loggingWithWhereabouts.html
Logging with whereabouts using open source and freeware
The purpose of logging is to find out what had happened when needed. When the
time comes to read log messages, you want to know both the log message and its
whereabouts (class name, method name, file name and line number). So you need
to hard code whereabouts.
But hard coded whereabouts are very difficult to maintain: when you modify your
source code, line number changes; when you copy and paste a line, its class name
and method name change. If whereabouts are wrong, you introduce bugs in your logging
logic and the log messages are useless at the best.
This article shows you an example of using freeware Redress tool to rectify whereabouts
programmatically in your Makefile or Ant build file. So your whereabouts are always
correct for both Java and JSP source file.
Redress tool is part of SuperLogging at http://www.ACElet.com. SuperLogging also
provides an open source wrapper Alog.java, which redirects log method calls to
your favorite logging package. Redress tool can rectify whereabouts information
on all Alog's method calls in your application. So, if you call Alog's log methods,
these calls will be rectified by Redress.
JDK 1.4 introduces a new utility package java.util.logging. The example in this
article is based on JDK logging. Log4J is a cousin of JDK logging. Log4J users
should have no difficulties to modify this example for Log4J. Both JDK logging
and Log4J are excellent logging software for single JVM.
Note: Redress tool rectifies method calls on Alog, not JDK logging. You need to
call Alog instead of JDK logging in your application.
Source code of Alog.java
The following is the source code of Alog's JDK logging version. It serves as an
library file and should be on your CLASSPATH:
* Copyright Acelet Corp. 2000. All rights reserved
* License agreement begins >>>>>>>>>> <br>
* This program (com.acelet.opensource.logging.Alog) ("Software") is an
* open source software. <p>
* LICENSE GRANT. The Software is owned by Acelet Corporation ("Acelet").
* The Software is licensed to you ("Licensee"). You are granted a
* non-exclusive right to use, modify, distribute the Software for either
* commercial or non-commercial use for free, as long as: <br>
* 1. this copyright paragraph remains with this file. <br>
* 2. this source code (this file) must be included with distributed
* binary code.<br>
* NO WARRANTY. This comes with absolutely no warranty. <p>
* <<<<<<<<<< License agreement ends <p><p>
* The purpose of releasing this open source program is to prevent vendor
* lock in. <p>
* You can code your program using this class to indirectly use Acelet
* SuperLogging (com.acelet.logging). If later you want to swith to other
* logging package, you do not need to modify your program. All you have
* to do is: <p>
* 1. modify this file to redirect to other logging packages. <br>
* 2. replace existing com.acelet.opensource.Alog with your modified one. <br>
* 3. you may have to reboot your EJB server to make the changes effect.<br>
* <p>
* This program is just a wrapper. For detail information about the methods
* see documents of underline package, such as com.acelet.logging.Logging.
* <p>
* Visit http://www.ACElet.com for more information.
* <p>
* This file is a modified for using JDK logging as an EXAMPLE.
* <br>
* You can use Redress tool to keep your whereabouts information
* always correct. See http://www.ACElet.com/freeware for detail.
* <p>
* Please see http://www/ACElet.com/opensource if you want to see the
* original version.
package com.acelet.opensource.logging;
import java.util.logging.*;
public final class Alog {
* Log level value: something will prevent normal program execution.
public static int SEVERE = 1000;
* Log level value: something has potential problems.
public static int WARNING = 900;
* Log level value: for significant messages.
public static int INFO = 800;
* Log level value: for config information in debugging.
public static int CONFIG = 700;
* Log level value: for information such as recoverable failures.
public static int FINE = 500;
* Log level value: for information about entering or returning a
* method, or throwing an exception.
public static int FINER = 400;
* Log level value: for detail tracing information.
public static int FINEST = 300;
static Logger logger;
static {
logger = Logger.getLogger("");
public Alog() {
public static void alert(String subject, String message) {
public static void error(String text, int level, String fullClassName,
String methodName, String baseFileName, int lineNumber) {
String[] para = {lineNumber + "", baseFileName};
logger.logp(getLevel(level), fullClassName, methodName, text, para);
public static Level getLevel(int levelValue) {
if (levelValue == SEVERE)
return Level.SEVERE;
else if (levelValue == WARNING)
return Level.WARNING;
else if (levelValue == INFO)
return Level.INFO;
else if (levelValue == CONFIG)
return Level.CONFIG;
else if (levelValue == FINE)
return Level.FINE;
else if (levelValue == FINER)
return Level.FINER;
else if (levelValue == FINEST)
return Level.FINEST;
else
return Level.ALL;
public static void log(String text, int level, String fullClassName,
String methodName, String baseFileName, int lineNumber) {
String[] para = {lineNumber + "", baseFileName};
logger.logp(getLevel(level), fullClassName, methodName, text, para);
public static void sendMail(String to, String from, String subject,
String text) throws Exception {
public static void sendMail(String to, String cc, String bcc, String from,
String subject, String text) throws Exception {
Test program
The simple test program is Test.java:
import com.acelet.opensource.logging.Alog;
public class Test {
public static void main(String argv[]){
Alog.log("Holle world", Alog.SEVERE, "wrongClassName", "wrongMethod",
"wrongFileName", -1);
How to run the test program
1. Compile Alog.java (JDK 1.4 or later, not before):
javac Alog.java
2. Download freeware Redress tool from http://ACElet.com/freeware.
3. Run Redress tool:
java -cp redress.jar Test.java
4. Check Test.java. The Alog.log method call should be rectified.
5. Run test program:
java Test
You should see log message with correct class name and method name.Hi;
I found this code and would like to share it with you :
JCoDestination destination = JCoDestinationManager
.getDestination(DESTINATION_NAME2);
JCoFunction function = destination.getRepository().getFunction(
"RFC_FUNCTION_SEARCH");
if (function == null)
throw new RuntimeException("RFC_FUNCTION_SEARCH not found in SAP.");
function.getImportParameterList().setValue("FUNCNAME", "*");
function.getImportParameterList().setValue("GROUPNAME", "*");
try {
function.execute(destination);
JCoTable funcDetailsTable = function.getTableParameterList()
.getTable("FUNCTIONS");
int totalNoFunc = funcDetailsTable.getNumRows();
if (totalNoFunc > 0) {
for (int i = 0; i < totalNoFunc; i++) {
System.out.println("Function Name: "
+ funcDetailsTable.getValue(i));
} catch (AbapException e) {
System.out.println(e.toString());
return;
System.out.println("RFC_FUNCTION_SEARCH finished");
It is working and retrieving FM.
Regards
Anis -
Can we do poduct costing with out using cost sheet and overhead rates
Hi,
can we do product costing with out using cost sheets and overhead rates.
In that cast , how the cost estimation happens ?Hi,
a costing sheet is used to calculate (on a base) overhead values. If you dont need / want to use this functionality just create/use a costing variant where not costing sheet is assigned.
Use this costing variant in CK11N or KKPAN, depending if ou have a quantity structure or not.
best regards, Christian -
Need help trying to use close button and i really like to know why it off
need help trying to use close button and i really like to know why it off
And in English? You need to explain better.
Mylenium -
Need help with problem using sound and vibration examples. question repost
I am generating a wav file using the sound and vibration example vi "SVXMPL_Wav Recorder(DAQmx)" using a ni 7422 board. Then, using the example vi SVXMPL_Getting started with SVT(Simulated)" attempting to play back that file. the wav file will load and play back on the graphs fine but when I click the "Play Wav File" which sends the audio to the computers speaker, I get the error "Cannot recognise sound Format". It plays the shipped example files fine. I can also play the wav files I generate on a Windows audio player. Don't know a lot about the sound and vibration toolkit or wav file formats but need to get these two to work together. Using LV 8.5 and sound and vibration toolkit 4.0. This is a bit of a repost of the same question ask last week but not answered. Thanks
Did you see Coq Rouge's reply in your original thread? Which thread are you going to continue?
-
Help with if statement in cursor and for loop to get output
I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
Here is my cursor:
/*Cursor for Email procedure. It is working Shows userid and the string
You need to update these folders*/
DECLARE
a_user varchar2(200) := null;
v_assigneduser varchar2(20);
v_folderrsn varchar2(200);
v_emailaddress varchar2(60);
v_subject varchar2(200);
Cursor c IS
SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
--MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
WHERE f.foldertype = 'HJ'
AND f.statuscode NOT IN (20, 40)
AND f.folderrsn = fp.folderrsn
AND fp.processrsn = fpa.processrsn
AND vu.userid = fp.assigneduser
AND vu.statuscode = 1
GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
ORDER BY fp.assigneduser;
BEGIN
FOR c1 IN c LOOP
IF (c1.assigneduser = v_assigneduser) THEN
dbms_output.put_line(' ' || c1.folderrsn);
else
dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
END IF;
a_user := c1.assigneduser;
v_assigneduser := c1.assigneduser;
v_folderrsn := c1.folderrsn;
v_emailaddress := c1.emailaddress;
v_subject := 'Subject: Project for';
END LOOP;
END;
The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
emailaddress
Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
v_folderrsn
v_folderrsn
etc
[email protected]......
Subject: 'Project for: ' Jim...'not updated in the last 30 days'
284087
292709
[email protected].....
Subject: 'Project for: ' Kim...'not updated in the last 30 days'
185083
190121
190132
190133
190159
190237
284109
286647
294631
322922
[email protected]....
Subject: 'Project for: Joe...'not updated in the last 30 days'
183332
183336
[email protected]......
Subject: 'Project for: Sam...'not updated in the last 30 days'
183876
183877
183879
183880
183881
183882
183883
183884
183886
183887
183888
This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
JIM......... jim@ aol.com.... 284087............. 9/28/2006.......10/5/2006...........690
JIM......... jim@ aol.com.... 292709............. 3/20/2007.......3/28/2007............516
KIM......... kim@ aol.com.... 185083............. 8/31/2004.......2/9/2006............. 928
KIM...........kim@ aol.com.... 190121............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190132............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190133............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190159............. 2/13/2006.......2/14/2006............923
KIM...........kim@ aol.com.... 190237............. 2/23/2006.......2/23/2006............914
KIM...........kim@ aol.com.... 284109............. 9/28/2006.......9/28/2006............697
KIM...........kim@ aol.com.... 286647............. 11/7/2006.......12/5/2006............629
KIM...........kim@ aol.com.... 294631............. 4/2/2007.........3/4/2008.............174
KIM...........kim@ aol.com.... 322922............. 7/29/2008.......7/29/2008............27
JOE...........joe@ aol.com.... 183332............. 1/28/2004.......4/23/2004............1585
JOE...........joe@ aol.com.... 183336............. 1/28/2004.......3/9/2004.............1630
SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............ 1631
PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............ 48
PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............ 175
NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
[email protected]/27/2004.......3/8/2004............1631
How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
Edited by: user4653174 on Aug 25, 2008 2:40 PManalytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
CASE
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
Incorporating either of these into your query should assist you in returning the desired results. -
PLEASE HELP! I use 1 track, and i get an alert saying "too many tracks"
i just bought brand new MacBook Pro 2.16 with an extra Giga in RAM (2.0)...
I use Garageband 3.0.4 (and no other application running) and im making a project with 4 very simple tracks (no effects and plug-ins). When i run the project for the first time i always get a message saying that im using a lot of software tracks! (its impossible, im sure is not a matter of number of tracks, nor a power issue). I have the buffer size at the highest level...
should i re-install mac-os x?
please help, y really need this software... was my reason to buy the computer, and is not working at all!so most of the artists and djs that play live with
mac computers... use external drives??
Most don't use GarageBand. DJ would use DJ software, and a musician might use GB as his synth, but not many people would do what you're trying with GB.
this is my first mac experience
Blame GB rather than the Mac, for all its eye candy and ease of use, it is a resource hog.
other mac users doesnt seem to have the problem that
i do... could it be just an error in my software??
Actually I've seen this question posted many time, so others do have similar probs. Unfortunately it's really impossible to guess why one person has trouble and another doesn't. I was doing 12 tracks easy, with half your machine (but en external drive). I've seen posts where people complain that they can't record 1 track without an error. Without having the machine in front of me, it's just not possible to guess why B-(>
error that could be fixed with a reinstlation??
I doubt an reinstall would help. You might try running your Activity Monitor app to see what processes are running and using what resources.
<hr width="250" align="left">
HangTime [Will Compute for Food] B-)>
♪♫ The Bullets and Bones Band ♫♪
Disclaimer<hr width="250" align="left"> -
Help with importing PC photo files and then organizing it all in iPhoto
Hi everyone,
I'm relatively new to mac but I am just loving my purchase! I need some serious help with getting all of my photos organized though so I can easily find it for editing in iMovie.
I've accumulated over 10,000 photos stored on my PC which I've since transferred over to my LaCie external drive for my MacBook Pro via a wireless network connecting my PC & Mac. Some of these I've put onto my laptop internal hard drive and those I've imported into the iPhoto library. However, do I need to move the rest of the photos from my LaCie drive into my internal hard drive to import the photos into iPhoto, or can I tell iPhoto to look for the files in the external drive. If so, how do I do that? I know I'll then have to create albums in order to sort them, which I know how to do. Is there any fast way to do it by date? I had it sorted into different file folders by month & year so I could easily find them on my PC and would like to do the same using albums.
I am quickly running out of hard drive space on my laptop which is why I've put most of my photos on the external drive. Once I organize my existing collection, I would like to be able to import new pictures and have it stored on my external drive, not my internal drive. How do I do that?
Any other tips on organizing a massive photo library would be greatly appreciated.
Thanks,
KarenKaren,
Is there any fast way to do it by date? I had it sorted into different file folders by month & year so I could easily find them on my PC and would like to do the same using albums.
This is where you get to enjoy the power of iPhoto's database. You can change the Sort in the View menu. Check out View > Sort Photos > by Date.
Or, click the little calendar icon near the lower left corner of the iPhoto window. This allows you to filter the library by year, month, week, or date. You can Command-click to add another date to your filter. You can Option-click to choose a recurring date: you get that month or date for all years in your library. [Want to see your kid's birthday for every year? Just Option-Click that date. Cool.]
The keywords filter is similar. There is a preference setting where you choose to filter based on ALL keywords chosen (where by choosing more keywords you narrow your field) or ANY keyword (where the more keywords you choose, the larger your field will be). Click on a keyword to filter your library by all photos containing that keyword. Use Command-click to add more keywords to the filter. A difference is that Option-click will eliminate photos with that keyword from your filter. [You can find all pictures of your kids with your dog but NOT at Halloween.]
You can create Smart Albums to combine the use of dates, keywords, ratings, titles, comments and more. The more information you enter into the database, the more powerful the tools become.
When your task of importing is complete and you are ready to play with iPhoto's features it may help to look at the iPhoto multimedia tutorial. Better organized than trying to read through the Help files, it can help you get acquainted with many of iPhoto's features.
Have fun. -
Need Help with timing using multiple clips
I am in need of some help. I am trying to have a total of 16 video clips appear to slide across the screen from the right to the left, all while being equally spaced apart, going the same speed without them crossing over one another. I am using the center and anchor point in the motion tab, but once i get the the third clip i just cant seem to get the time right. I basically want them to come into the screen from the left and out of the screen from the right, all while scrolling acrossed. Please let me know if you have any suggestions.
I even trued manipulating idvd and imovie themes in Quartz Composer, ended up starting fresh and new, and then again got into the mess with timing. Please help!!!!
Thanks so much,Try this:
Copy one clip that works OK and use Paste Attributes on the shonky one.
Al -
Help with Hidden Drop Down Lists in RBList subforms
I have created a form that contains 3 isolated Radio Button lists, each with hidden subforms that are unique per each button.
Two of my RBLists and subforms work perfectly, showing hidden Drop Down List options and other fields as they should when a button is selected.
However, RBList3 presents the Drop Down lists as user entry fields only. Each hidden subform in RBList3 contains one drop down menu and one text box for instructions.
I've used the same javascript to hide/show hidden fields when buttons are selected. All settings seem to match up. Here is a sample of my code:
if(RBList3.F.rawValue != 2)
this.presence = "hidden";
newsubform.presence = "hidden";
else if(RBList3.F.rawValue == 2)
this.presence = "visible";
newsubform.presence = "hidden";
Does anyone have any suggestions for how to make my Drop Down Lists in RBList3 show as functional Drop lists?
I have attached the form for reference.Hi Paul,
I see that the code works for radio button G selection in the change event. However, what I really need to happen...is for the RBList options to be present on the screen without any subform data until the user clicks button E, F or G. If either E or F is selected, then the drop list and the text box would pop up as you currently have them placed on screen.
My original problem was that the EdgeDropDown2 list loses its functionality when wrapped in a hidden subform (i.e. SubformE or SubformF).
Can I add code to the change event to make EdgeDropDown2 and PanzDrawTxt appear only if either E or F are chosen. The code you wrote below works only for G selection.
if(this.rawValue != 3)
EdgeDropDown2.presence = "visible";
PanzDrawTxt.presence = "visible";
EdgePanelChkBxTxt.presence = "hidden";
}else {
PanzDrawTxt.presence = "hidden";
EdgeDropDown2.presence = "hidden";
EdgePanelChkBxTxt.presence = "visible"; -
How to call a stored procedure on time basis with out using sql job and GOTO
Hi,
I wanted to call a stored proc, on time basis ,
please tel me how it can be done with out using sql job , goto .
1) That is, is there any timer aviable in sqlserver.
q2) And which one is better GOTO or sql job.
yours sincerleyRaj, Check if my explanation helps you:
Your job runs every 10 seconds.
Lets say first time you are scheduling and running your job at 12:00:00 PM
Now your proc will start executing.
Say it got finished at 12:00:07.
Now the next schedule time is 12:00:10 PM.
The moment this time hits, the job will get invoked and start executing the proc.
Lets say this time it finished at 12:00:22 PM (It took 2 extra seconds)
This time the scheduled time is already gone (12:00:20 PM), thus it'll now run at the next schedule that is 12:00:30 PM.
Thus if anytime your job takes more than 10 seconds to run, it'll just miss those particular schedules overlapping with execution time. Otherwise you are good to go.
PS: A job is the best way to handle this, in your problem statement you don't need a job but that would be wrong. You have another way to do that, if you keep running your procedure all the time and the moment your timestamp hits a multiple of 10
seconds you can run your logic and then returning to the timer. But this is extremely wrong for a system. Even if your requirement is extremely transactional and complex, I would not suggest this. If the job is taking more than 10seconds (which it might if
your logics inside are complex), you should optimize your code and table architecture.
Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
The climb is all there is. -
Can someone help with splitting a Linked List.??
Any help would be awesome!!!
My code just will not work!! Any help would be appreciated! My problem is in the last method SplitAt. These are the conditions set and my code:
Splitting a Linked List at a Given Node, into Two Sublists
a. Add the following as an abstract method to the class
LinkedListClass:
public void splitAt (LinkedListClass<T> secondList, T item);
//This method splits the list at the node with the info item into two sublists.
//Precondition: The list must exist.
//Postcondition: first and last point to the first and last nodes of the first sublist,
// respectively. secondList.first and secondList.last point to the first
// and last nodes of the second sublist.
Consider the following statements:
UnorderedLinkedList<Integer> myList;
UnorderedLinkedList<Integer> otherList;
Suppose myList points to the list with the elements 34, 65, 18, 39, 27, 89, and 12 (in this order). The statement
myList.splitAt(otherList, 18);
splits myList into two sublists: myList points to the list with elements 34 and 65, and otherList points to the sublist with elements 18, 39, 27, 89, and 12.
b. Provide the definition of the method splitAt in the class UnorderedLinkedList. Also write a program to test your method.
public class UnorderedLinkedList<T> extends LinkedListClass<T>
//Default constructor
public UnorderedLinkedList()
super();
//Method to determine whether searchItem is in
//the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public boolean search(T searchItem)
LinkedListNode<T> current; //variable to traverse
//the list
boolean found;
current = first; //set current to point to the first
//node in the list
found = false; //set found to false
while (current != null && !found) //search the list
if (current.info.equals(searchItem)) //item is found
found = true;
else
current = current.link; //make current point to
//the next node
return found;
//Method to insert newItem in the list.
//Postcondition: first points to the new list
// and newItem is inserted at the
// beginning of the list. Also,
// last points to the last node and
// count is incremented by 1.
public void insertFirst(T newItem)
LinkedListNode<T> newNode; //variable to create the
//new node
newNode =
new LinkedListNode<T>(newItem, first); //create and
//insert newNode before
//first
first = newNode; //make first point to the
//actual first node
if (last == null) //if the list was empty, newNode is
//also the last node in the list
last = newNode;
count++; //increment count
//Method to insert newItem at the end of the list.
//Postcondition: first points to the new list and
// newItem is inserted at the end
// of the list. Also, last points to
// the last node and
// count is incremented by 1.
public void insertLast(T newItem)
LinkedListNode newNode; //variable to create the
//new node
newNode =
new LinkedListNode(newItem, null); //create newNode
if (first == null) //if the list is empty, newNode is
//both the first and last node
first = newNode;
last = newNode;
else //if the list is not empty, insert
//newNode after last
last.link = newNode; //insert newNode after last
last = newNode; //set last to point to the
//actual last node
count++;
}//end insertLast
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list. Also, first points to the first
// node, last points to the last
// node of the updated list, and count
// is decremented by 1.
public void deleteNode(T deleteItem)
LinkedListNode<T> current; //variable to traverse
//the list
LinkedListNode<T> trailCurrent; //variable just
//before current
boolean found;
if ( first == null) //Case 1; the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else
if (first.info.equals(deleteItem)) //Case 2
first = first.link;
if (first == null) //the list had only one node
last = null;
count--;
else //search the list for the given info
found = false;
trailCurrent = first; //set trailCurrent to
//point to the first node
current = first.link; //set current to point to
//the second node
while (current != null && !found)
if (current.info.equals(deleteItem))
found = true;
else
trailCurrent = current;
current = current.link;
}//end while
if (found) //Case 3; if found, delete the node
count--;
trailCurrent.link = current.link;
if (last == current) //node to be deleted
//was the last node
last = trailCurrent; //update the value
//of last
else
System.out.println("Item to be deleted is "
+ "not in the list.");
}//end else
}//end else
}//end deleteNode
public void splitAt(LinkedListClass<T> secondList, T item)
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
int i;
boolean found;
if (first==null)
System.out.println("Empty.");
first=null;
last=null;
count--;
else
current=first;
found=false;
i=1;
while(current !=null &&!found)
if(current.info.equals(secondList))
found= true;
else
trailCurrent=current;
i++;
if(found)
if(first==current)
first=first;
last=last;
count=count;
count=0;
else
first=current;
last=last;
last=null;
count = count- i+1;
count = i-1;
else
System.out.println("Item to be split at is "
+ "not in the list.");
first=null;
last=null;
count=0;
}Edited by: romeAbides on Oct 10, 2008 1:24 PMI dont have a test program at all. The program is supposed to prompt for user input of numbers. (it does) Take the input and end at input of -999 (it does). Then it asks user where it wants to split list (it does). When I enter a number it does nothing after that. I am going to post updated code and see if that helps along with all the classes. Thanks!
This is the class to prompt:
import java.util.*;
public class Ch16_ProgEx6
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
UnorderedLinkedList<Integer> list
= new UnorderedLinkedList<Integer>();
UnorderedLinkedList<Integer> subList =
new UnorderedLinkedList<Integer>();
Integer num;
System.out.println("Enter integers ending with -999.");
num = console.nextInt();
while (num != -999)
list.insertLast(num);
num = console.nextInt();
System.out.println();
System.out.println("list: ");
list.print();
System.out.println();
System.out.println("Length of list: " + list.length());
System.out.print("Enter the number at which to split list: ");
num = console.nextInt();
list.splitAt(subList, num);
System.out.println("Lists after splitting list");
System.out.print("list: ");
list.print();
System.out.println();
System.out.println("Length of list: " + list.length());
System.out.print("sublist: ");
subList.print();
System.out.println();
System.out.println("Length of sublist: " + subList.length());
}This is the ADT:
public interface LinkedListADT<T> extends Cloneable
public Object clone();
//Returns a copy of objects data in store.
//This method clones only the references stored in
//each node of the list. The objects that the
//list nodes point to are not cloned.
public boolean isEmptyList();
//Method to determine whether the list is empty.
//Postcondition: Returns true if the list is empty;
// false otherwise.
public void initializeList();
//Method to initialize the list to an empty state.
//Postcondition: The list is initialized to an empty
// state.
public void print();
//Method to output the data contained in each node.
public int length();
//Method to return the number of nodes in the list.
//Postcondition: The number of nodes in the list is
// returned.
public T front();
//Method to return a reference of the object containing
//the data of the first node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the first node
// is returned.
public T back();
//Method to return a reference of object containing
//the data of the last node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the last node
// is returned.
public boolean search(T searchItem);
//Method to determine whether searchItem is in the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public void insertFirst(T newItem);
//Method to insert newItem in the list.
//Postcondition: newItem is inserted at the
// beginning of the list.
public void insertLast(T newItem);
//Method to insert newItem at the end of the list.
//Postcondition: newItem is inserted at the end
// of the list.
public void deleteNode(T deleteItem);
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list.
public void splitAt(LinkedListClass<T> secondList, T item);
}This is the linked list class:
import java.util.NoSuchElementException;
public abstract class LinkedListClass<T> implements LinkedListADT<T>
protected class LinkedListNode<T> implements Cloneable
public T info;
public LinkedListNode<T> link;
//Default constructor
//Postcondition: info = null; link = null;
public LinkedListNode()
info = null;
link = null;
//Constructor with parameters
//This method sets info pointing to the object to
//which elem points to and link is set to point to
//the object to which ptr points to.
//Postcondition: info = elem; link = ptr;
public LinkedListNode(T elem, LinkedListNode<T> ptr)
info = elem;
link = ptr;
//Returns a copy of objects data in store.
//This method clones only the references stored in
//the node. The objects that the nodes point to
//are not cloned.
public Object clone()
LinkedListNode<T> copy = null;
try
copy = (LinkedListNode<T>) super.clone();
catch (CloneNotSupportedException e)
return null;
return copy;
//Method to return the info as a string.
//Postcondition: info as a String object is
// returned.
public String toString()
return info.toString();
} //end class LinkedListNode
public class LinkedListIterator<T>
protected LinkedListNode<T> current; //variable to
//point to the
//current node in
//list
protected LinkedListNode<T> previous; //variable to
//point to the
//node before the
//current node
//Default constructor
//Sets current to point to the first node in the
//list and sets previous to null.
//Postcondition: current = first; previous = null;
public LinkedListIterator()
current = (LinkedListNode<T>) first;
previous = null;
//Method to reset the iterator to the first node
//in the list.
//Postcondition: current = first; previous = null;
public void reset()
current = (LinkedListNode<T>) first;
previous = null;
//Method to return a reference of the info of the
//current node in the list and to advance iterator
//to the next node.
//Postcondition: previous = current;
// current = current.link;
// A refrence of the current node
// is returned.
public T next()
if (!hasNext())
throw new NoSuchElementException();
LinkedListNode<T> temp = current;
previous = current;
current = current.link;
return temp.info;
//Method to determine whether there is a next
//element in the list.
//Postcondition: Returns true if there is a next
// node in the list; otherwise
// returns false.
public boolean hasNext()
return (current != null);
//Method to remove the node currently pointed to
//by the iterator.
//Postcondition: If iterator is not null, then the
// node that the iterator points to
// is removed. Otherwise the method
// throws NoSuchElementException.
public void remove()
if (current == null)
throw new NoSuchElementException();
if (current == first)
first = first.link;
current = (LinkedListNode<T>) first;
previous = null;
if (first == null)
last = null;
else
previous.link = current.link;
if (current == last)
last = first;
while (last.link != null)
last = last.link;
current = current.link;
count--;
//Method to return the info as a string.
//Postcondition: info as a String object is returned.
public String toString()
return current.info.toString();
} //end class LinkedListIterator
//Instance variables of the class LinkedListClass
protected LinkedListNode<T> first; //variable to store the
//address of the first
//node of the list
protected LinkedListNode<T> last; //variable to store the
//address of the last
//node of the list
protected int count; //variable to store the number of
//nodes in the list
//Default constructor
//Initializes the list to an empty state.
//Postcondition: first = null, last = null,
// count = 0
public LinkedListClass()
first = null;
last = null;
count = 0;
//Method to determine whether the list is empty.
//Postcondition: Returns true if the list is empty;
// false otherwise.
public boolean isEmptyList()
return (first == null);
//Method to initialize the list to an empty state.
//Postcondition: first = null, last = null,
// count = 0
public void initializeList()
first = null;
last = null;
count = 0;
//Method to output the data contained in each node.
public void print()
LinkedListNode<T> current; //variable to traverse
//the list
current = first; //set current so that it points to
//the first node
while (current != null) //while more data to print
System.out.print(current.info + " ");
current = current.link;
}//end print
//Method to return the number of nodes in the list.
//Postcondition: The value of count is returned.
public int length()
return count;
//Method to return a reference of the object containing
//the data of the first node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the first node
// is returned.
public T front()
return first.info;
//Method to return a reference of object containing
//the data of the last node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the last node
// is returned.
public T back()
return last.info;
//Returns a copy of objects data in store.
//This method clones only the references stored in
//each node of the list. The objects that the
//list nodes point to are not cloned.
public Object clone()
LinkedListClass<T> copy = null;
try
copy = (LinkedListClass<T>) super.clone();
catch (CloneNotSupportedException e)
return null;
//If the list is not empty clone each node of
//the list.
if (first != null)
//Clone the first node
copy.first = (LinkedListNode<T>) first.clone();
copy.last = copy.first;
LinkedListNode<T> current;
if (first != null)
current = first.link;
else
current = null;
//Clone the remaining nodes of the list
while (current != null)
copy.last.link =
(LinkedListNode<T>) current.clone();
copy.last = copy.last.link;
current = current.link;
return copy;
//Method to return an iterator of the list.
//Postcondition: An iterator is instantiated and
// returned.
public LinkedListIterator<T> iterator()
return new LinkedListIterator<T>();
//Method to determine whether searchItem is in
//the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public abstract boolean search(T searchItem);
//Method to insert newItem in the list.
//Postcondition: first points to the new list
// and newItem is inserted at the
// beginning of the list. Also,
// last points to the last node and
// count is incremented by 1.
public abstract void insertFirst(T newItem);
//Method to insert newItem at the end of the list.
//Postcondition: first points to the new list and
// newItem is inserted at the end
// of the list. Also, last points to
// the last node and
// count is incremented by 1.
public abstract void insertLast(T newItem);
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list. Also, first points to the first
// node, last points to the last
// node of the updated list, and count
// is decremented by 1.
public abstract void deleteNode(T deleteItem);
public abstract void splitAt(LinkedListClass<T> secondList, T item);
}And this is the UnorderedLinked Class with the very last method the one being Im stuck on. The SplitAt Method.
public class UnorderedLinkedList<T> extends LinkedListClass<T>
//Default constructor
public UnorderedLinkedList()
super();
//Method to determine whether searchItem is in
//the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public boolean search(T searchItem)
LinkedListNode<T> current; //variable to traverse
//the list
boolean found;
current = first; //set current to point to the first
//node in the list
found = false; //set found to false
while (current != null && !found) //search the list
if (current.info.equals(searchItem)) //item is found
found = true;
else
current = current.link; //make current point to
//the next node
return found;
//Method to insert newItem in the list.
//Postcondition: first points to the new list
// and newItem is inserted at the
// beginning of the list. Also,
// last points to the last node and
// count is incremented by 1.
public void insertFirst(T newItem)
LinkedListNode<T> newNode; //variable to create the
//new node
newNode =
new LinkedListNode<T>(newItem, first); //create and
//insert newNode before
//first
first = newNode; //make first point to the
//actual first node
if (last == null) //if the list was empty, newNode is
//also the last node in the list
last = newNode;
count++; //increment count
//Method to insert newItem at the end of the list.
//Postcondition: first points to the new list and
// newItem is inserted at the end
// of the list. Also, last points to
// the last node and
// count is incremented by 1.
public void insertLast(T newItem)
LinkedListNode newNode; //variable to create the
//new node
newNode =
new LinkedListNode(newItem, null); //create newNode
if (first == null) //if the list is empty, newNode is
//both the first and last node
first = newNode;
last = newNode;
else //if the list is not empty, insert
//newNode after last
last.link = newNode; //insert newNode after last
last = newNode; //set last to point to the
//actual last node
count++;
}//end insertLast
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list. Also, first points to the first
// node, last points to the last
// node of the updated list, and count
// is decremented by 1.
public void deleteNode(T deleteItem)
LinkedListNode<T> current; //variable to traverse
//the list
LinkedListNode<T> trailCurrent; //variable just
//before current
boolean found;
if ( first == null) //Case 1; the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else
if (first.info.equals(deleteItem)) //Case 2
first = first.link;
if (first == null) //the list had only one node
last = null;
count--;
else //search the list for the given info
found = false;
trailCurrent = first; //set trailCurrent to
//point to the first node
current = first.link; //set current to point to
//the second node
while (current != null && !found)
if (current.info.equals(deleteItem))
found = true;
else
trailCurrent = current;
current = current.link;
}//end while
if (found) //Case 3; if found, delete the node
count--;
trailCurrent.link = current.link;
if (last == current) //node to be deleted
//was the last node
last = trailCurrent; //update the value
//of last
else
System.out.println("Item to be deleted is "
+ "not in the list.");
}//end else
}//end else
}//end deleteNode
public void splitAt(LinkedListClass<T> secondList, T item)
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
int i;
boolean found;
if (first==null)
System.out.println("Empty.");
first=null;
last=null;
count--;
count=0;
else
current=first;
found=false;
i=1;
while(current !=null &&!found)
if(current.info.equals(item))
found= true;
else
trailCurrent=first;
current=first;
i++;
if(found)
if(first==current)
first.link=first;
last.link=last;
count--;
count=0;
else
first.link=current;
last.link=last;
last=null;
count = count- i+1;
count = i-1;
} else {
System.out.println("Item to be split at is "
+ "not in the list.");
first=null;
last=null;
count=0;
Any help or just advice would be fine. Im not the best at Java, better at VB. Am completely stumped! Thanks so much!
Maybe you are looking for
-
Urgent!!!!!!!t-output a repot data form bkpf bseg .
hi experts, i need a report data from bkpf bseg. is there any stand program have this kind of function ? many many thanks .
-
If I'm Getting my iPhone an Out-of-Warranty Replacment
If I'm Getting my iPhone an Out-of-Warranty Replacment for a cracked screen, do I need to tell them any information? I live in Edmonton, Alberta, Canada and going to West Edmonton Mall to have an out-of-warranty replacment.
-
HT1688 My IMEI is unlocked but I can't activate my iPhone 3GS 011950006982337
My IMEI is unlocked but I can't activate my iPhone 3GS 011950006982337
-
Calling servlets from a jsp in a directory
Hello, I use JBuilder 9 to develop a web application, and I organize all jsp files in directories inside root directory. The problem is that when I try to use any servlet in the project, I have to use the following address "http://localhost8080/servl
-
Openning a browser inside a view
I know that we can open a external browser window for eg SAP.com in a new window. But i need to open a browser window inside a view with out using a iFrame( since it is outdated). Can any one help me