I need a little help with the console
Ok, I'm writing a calender class, and i have an add method in it. It basically adds a certain number of days to a certain date and tells you what you get. I'm having some problems getting it to work right so I'm debugging it by having it print out every date as it adds one. Well, the dates I have to use for school (yeah it's a project) are 7 years apart (to include 2 leap years), but when I run the test program the console window is only so big and I can only read what it printed about 6 months back. Anyone know how to make the console window bigger?
Nevermind, I fixed it. Thanks anyway.
(I don't know how to delete this so if somebody else
can, please do)Wrong approach. Tell us what you did, so if anyone will see this at a later stage (like if they had a similar problem and searched the forums), they will benefit from your findings...
Kind regards,
lutha
Similar Messages
-
So I need a little help with the Flash Colors
I always use the Red, Blue and Green gradient Flash colors below for metalic stuff, but how can I get the effect in this red color in different colors like Yellow?
If you want to use the preset gradients, what you could do is first color whatever area you intend to with one of them, and then select the fill and use the Color panel to change the red to whatever other color you prefer. If you have never worked with the gradient section of the Color panel, you will probably find it a bettter tool to create and fine-tune transitions.
You just doubleclick that little red square in the lower left and it opens a color swatch like the one you showed to select another color -
Creating a card dealing animation - Need a little help with the Math
Hi Guys,
This isn't a Java specific query per se but your advice would be greatly appreciated in order to add animation to Java card game I've developed.
If I've posted this in the wrong forum, please let me know and I'll re-post it elsewhere.
What I am trying to achieve is card dealing animation whereby a card is show moving from the deck position to its final position.
The trouble I am having is how to achieve the path from where the card is dealt from to its final dealt position.
Could somebody please point me to the right Math?
A visual representation of what I am trying to achieve is at the below link:
http://img266.imageshack.us/img266/3235/exampleg.jpg
The black square represents the deck. The red square represents where the next card is dealt to with an animation showing the card leaving the deck and following a specific path to its final position in one of the red squares.
Any advice would be appreciated.
Edited by: Faz_86 on Jun 20, 2010 2:46 PMIf you make a mathematically clean even animation from point A to point B, it looks artificial. Our brains are designed to spot tiny details. You can see this in the development of (hand-drawn) animation: early cartoons looked too smooth; later (by the 30's I think) animators learned tricks to make things seem more realistic or at least visually engaging.
So if you look at the frames of a character moving, sometimes the first frame in the movement goes in the opposite direction of the larger motion. I believe you'd want something like this when the action is supposed to be driven by a conscious mind, as opposed to, say, a physics simulation.
Applying this... if you're dealing cards, maybe the cards will leave the deck first moving in the opposite direction for a couple frames, then going in the correct direction, to make it look like a dealer is moving them. I'm just brainstorming ideas here.
If you get a book on traditional animation techniques, it'll probably have some good ideas. -
Need a little Help with my new xfi titanium
+Need a little Help with my new xfi titanium< A few questions here.
st question? Im using opt out port on the xfi ti. card and using digital li've on a windows 7 64 bit system,? I would like to know why when i use 5. or 7. and i check to make sure each speakear is working the rear speakers wont sound off but the sr and sl will in replace of the rear speakers. I did a test tone on my sony amp and the speaker are wired correctly becasue the rear speakers and the surrond? left and right sound off when they suppose too. Also when i try to click on? the sl and sr in the sound blaster control panel they dont work but if i click on the rear speakers in the control panel the sl and sr sound off. Do anyone know how i can fix this? So i would like to know why my sl and sr act like rears when they are not?
2nd question? How do i control the volume from my keyboard or from windows period when using opt out i was able to do so with my on board? sound max audio using spidf? Now i can only control the audio using the sony receiver.
Thank you for any help../Re: Need a little Help with my new xfi titanium? ?
ZDragon wrote:
I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard. -
Need a little help with syncing my iPod.
I got a new macbook pro for cristmas and a few cds. After i tried to sync my ipod to itunes i put a symbol next to each song that i got from other cds saying that they were downloading but they werent. Also the cds i downloaded to my ipod for the first time didnt appear at all. Need help.
/Re: Need a little Help with my new xfi titanium? ?
ZDragon wrote:
I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard. -
Need a little help with dial setup on CME
I've got a CME I'm using for testing and I think I need a little help figuring out the proper config to get the system to accept numbers I dial and have those numbers be passed on to an Avaya system (including the leading 9 for ARS in Avaya) via H.323 IP trunks. I have it working well for internal 5 digit extension calls across the H.323 trunks and I also have it working well for some types of outside calls that gets passed on to the Avaya and then the Avaya dials the call out to the PSTN. My only real problem is, I can't figure out how to correctly configure CME to examine the digits I'm dialing and only send the digits once I'm finished dialing....not as soon as it sees an initial match.
What's happening is this. I can dial local numbers in my area as 7 digits or 10 digits. The phone company doesn't yet force us to dial area code and number for local calls (10 digits). I can still dial 7 digits. But...if I put an entry in CME that looks like this....
(by the way, the 192.168.1.1 IP is not the real IP address, that's just an example, but the rest of this entry is what I really have entered in CME)
dial-peer voice 9 voip
description Outside 7 Dig Local Calls Via Avaya
destination-pattern 9.......
session target ipv4:192.168.1.1
dtmf-relay h245-alphanumeric
no vad
...Then it will always try to dial out immediately after seeing the first 8 digits I dial (9 plus the 7 digit number I called)...even though I have a speicifc entry in the system that accounts for calls to 9 plus area code 513. I would have assumed that if I put the specific entry in for 9513....... it would see that and wait to see if I was actually dialing something to match 9513....... instead of 9....... Understand what I mean? Because 9513....... is more specific than 9....... but it still tries to send the call out immediately after seeing the first 8 digits I dialed.
dial-peer voice 9513 voip
description Outside 10 Dig Local Calls Via Avaya
destination-pattern 9513.......
session target ipv4:192.168.1.1
dtmf-relay h245-alphanumeric
no vad
...BUT...here's the interesting thing. If I trace the 10 digit call in Avaya, I see that the number being presented to the Avaya PBX is only the first 7 digits of the number....not the full 10 digits...BUT I see a few more of the digits I dialed (like the 8th and 9th digits) after the call is already setup and sent to the PSTN. It's like the CME is trying to send the rest of the 10 digits I dialed, but at that point it's already too late. It setup the call as a 7 digit call (9 plus 7 digits), not 10 digit like I wanted.
I'm more familiar with how to setup dialing in the Avaya via ARS. My background is Avaya, not Cisco, so this dial-peer config is a little difficult for me until I understand the reasoning of how it examines the numbers and what I should do to make it wait for me to finish dialing....or to tell the system that what I'm dialing will be a minimum or a certain amount of digits and maximum of a certain amount of digits, like the Avaya does. I just need some pointers and examples to look at :-) I think I've almost got it....but I'm just missing something at the moment.
Just so you understand, the call flow should be like this: Cisco phone registered to CME > CME to Avaya via H.323 trunks > Avaya to PSTN via ISDN PRI trunks connected to Avaya. I have to be sure I send the 9 to the Avaya also, because 9 triggers ARS in the Avaya.
Thanks for your helpHere is a good document that explains how dial-peers are matched in the Cisco world:
http://www.cisco.com/en/US/tech/tk652/tk90/technologies_tech_note09186a008010fed1.shtml#topic7
In your case, it is variable length dial plan you are trying to implenent. To fix it, you need to add a T to force the system to wait for more digits to be entered if there is any.
dial-peer voice 9 voip
description Outside 7 Dig Local Calls Via Avaya
destination-pattern 9.......T
session target ipv4:192.168.1.1
dtmf-relay h245-alphanumeric
no vad
dial-peer voice 9513 voip
description Outside 10 Dig Local Calls Via Avaya
destination-pattern 9513.......
session target ipv4:192.168.1.1
dtmf-relay h245-alphanumeric
no vad
You can also configure the inter-digits timeout using the command timeouts interdigit under telephony-service.
Please rate helpful answers! -
Need a little help with a Jbutton not working out the way I planned
The following code is to fulfill an assignment I am working on. The problem I am having is with the btnCalc. For some reason when the button is used, the results I get is from another button. I think the variables are set right for the program to function properly but I am really hung up on this. Do anyone have any suggestions?
import java.awt.*; //Contains classes for creating GUI
import java.awt.event.*; //For listener events
import javax.swing.*; // Imports the Main Swing Package
import javax.swing.event.*;
import javax.swing.text.*; // Positions text box
import java.text.NumberFormat; // For number format such as currency
import java.text.*; // Imports the Main Text Package
import java.util.*; // Utility Package
public class MPC extends JFrame implements ActionListener //Creates Class for MPC
//double dblLoanAmount, dblInterestRate, dblMonthlyPayment;
TextField txtTotalMort;
//JButton fixRates = new JButton("Choose Fixed Rates");
JLabel lblTotalMort = new JLabel("How much is the loan?"); // Label for dblLoanAmount amount
JTextField txtYears = new JTextField(10);
JLabel lblPayment = new JLabel("Your monthly payment is "); // Label for Payment
JTextField txtPayment = new JTextField(10);
JLabel lblYears = new JLabel("How many years?");
// add(lblYears);
JTextField txtYearsInput = new JTextField(10);
//a dd(txtYears);
JLabel lblInterestRate = new JLabel("What is the interest rate?");
//add(lblInterestRate);
JTextField txtInterestRate = new JTextField(10);
//add(txtInterestRate);
//JLabel lblPayment = new JLabel("Your monthly payment is:");
//add(lblPayment);
//JTextField txtPayment = new JTextField(10);
//txtPayment.setEditable(false);
//add(txtPayment);
JButton btnCalc = new JButton("Calculate");
//add(btnCalc);
//btnCalc.addActionListener(this);
JButton year7InterestRateBtn = new JButton("7 years at 5.35%"); // Mortgage Term and Interest Rate
JButton year15InterestRateBtn = new JButton("15 years at 5.50%");
JButton year30InterestRateBtn = new JButton("30 years at 5.75%");
JButton reset = new JButton("Clear All");
JTextArea boxSpace = new JTextArea(100,200); // Morgtage table size
JScrollPane scroll = new JScrollPane(boxSpace); // ScrollPane
public MPC() // Method
super("MPC"); // Frame Title
JMenuBar mb = new JMenuBar(); // Menu Bar
setJMenuBar(mb);
setSize(325, 500); // Frame Size
JPanel pane = new JPanel();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); //Grid box configuration
Container grid = getContentPane();
grid.setLayout(new GridLayout(8,2,8,8)); // Grid Layout
pane.add(grid); // Adds grid
pane.add(scroll); // Adds scrollPane
grid.setBackground(Color.white);
Setting color of text and backgrounds
txtYears.setBackground(Color.white);
txtYears.setForeground(Color.black);
txtYears.setFont(new Font("Arial", Font.PLAIN, 10));
txtPayment.setBackground(Color.white);
txtPayment.setForeground(Color.black);
txtPayment.setFont(new Font("Arial", Font.PLAIN, 10));
boxSpace.setBackground(Color.white);
boxSpace.setForeground(Color.black);
boxSpace.setFont(new Font("Arial", Font.PLAIN, 10));
grid.add(lblYears);
grid.add(txtYearsInput);
grid.add(lblInterestRate);
grid.add (txtInterestRate);
grid.add(lblTotalMort); // Adds the Mortgage Amount Label
grid.add(txtYears); // Adds the Mortgage Amount Text Field
grid.add(lblPayment); // Adds the Payment Label
grid.add(txtPayment); // Adds the Monthly Payment Text Field
txtPayment.setEditable(false); // Disables editing in this Text Field
grid.add(btnCalc);
grid.add(year7InterestRateBtn); // Adds 1st Loan and Rate Button
grid.add(year15InterestRateBtn); // Adds 2nd Loan and Rate Button
grid.add(year30InterestRateBtn); // Adds the Exit Button
grid.add(reset); // Adds the New Calc Button
setContentPane(pane); // Enables the Content Pane
setVisible(true); // Sets JPanel to be Visable
reset.addActionListener(this); // Adds Action Listener to the New Calc Button
txtYearsInput.addActionListener(this);
txtInterestRate.addActionListener(this);
btnCalc.addActionListener(this);
year7InterestRateBtn.addActionListener(this); // Adds Action Listener to the 1st loan Button
year15InterestRateBtn.addActionListener(this); // Adds Action Listener to the 2nd loan Button
year30InterestRateBtn.addActionListener(this); // Adds Action Listener to the 3rd loan Button
txtYears.addActionListener(this); // Adds Action Listener to the Mortgage Amount Text Field
txtPayment.addActionListener(this); // Adds Action Listener to the Monthly payment Text Field
public void actionPerformed(ActionEvent e) // Tests to Verify Which Button is Pressed
Object command = e.getSource(); // Enables command to get data
int intYears = 0; // Declares intYears
double dblLoanAmount, dblInterestRate, interestRate, intRate;
if (command == year7InterestRateBtn) // Activates the 1st Loan Button
intYears = 0; // Sets 1st value of Array
if (command == year15InterestRateBtn) // Activates the 2nd Loan Button
intYears = 1; // Sets 2nd value of Array
if (command == year30InterestRateBtn) // Activates the 3rd Loan Button
intYears = 2; // Sets 3rd value of Array
if (command == btnCalc)
//dblLoanAmount = Double.parseDouble(txtTotalMort.getText() ); // Loan amount
//interestRate = Double.parseDouble(txtInterestRate.getText() ); // /100 )/ 12; // Devides rate
intRate = (Double.parseDouble(txtInterestRate.getText() )/100 )/ 12;
//int intYearsMonths = Integer.parseInt(txtYearsInput.getText() );// * 12; //Multiplies loan length
int months = Integer.parseInt(txtYearsInput.getText() )* 12;
dblLoanAmount = 0; // Declares and Initializes dblLoanAmount
dblInterestRate = 0; // Declares and Initializes dblInterestRate
double [][] dblTrmLoanRate = {{7, 5.35}, {15, 5.50}, {30, 5.75},}; // Array Data for Calculation
try
dblLoanAmount = Double.parseDouble(txtYears.getText()); // Gets user input from txtYears Text Field
catch (NumberFormatException nfe) // Checks for correct user input
JOptionPane.showMessageDialog(null, "You must enter a valid number.", "MPC", JOptionPane.INFORMATION_MESSAGE);
return;
interestRate = dblTrmLoanRate [intYears][1];
//dblInterestRate=interestRate;
intRate = (interestRate / 100) / 12; // Calculates Interst Rate
double intYearsMonths = dblTrmLoanRate [intYears] [0]; // Calculates Loan Term in Months
int months = (int)intYearsMonths * 12; // Devides by months
double interestRateMonthly = (intRate / 12); // Devides Rate
double payment = dblLoanAmount * intRate / (1 - (Math.pow(1/(1 + intRate), months))); // Calculates monthly payment
double dblRmnLoan = dblLoanAmount; //Left over balance
double txtPaymentInterest = 0; // Payment
double txtPaymentPrincipal = 0; // Payment of principal
NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.US); // Curreny format
txtPayment.setText(currency.format(payment));
boxSpace.setText("Month\tPrincipal\tInterest\tBalance Left\n");
for (;months > 0 ; months -- )
txtPaymentInterest = (dblRmnLoan * intRate);
txtPaymentPrincipal = (payment - txtPaymentInterest); // Calculates monthly payment
dblRmnLoan = (dblRmnLoan - txtPaymentPrincipal);
boxSpace.setCaret (new DefaultCaret()); // Scroll position
boxSpace.append(String.valueOf(months) + "\t" + // Table data
currency.format(txtPaymentPrincipal) + "\t" +
currency.format(txtPaymentInterest) + "\t" +
currency.format(dblRmnLoan) + "\n");
if(command == reset)
Clears fields
txtYearsInput.setText(null);
txtInterestRate.setText(null);
txtYears.setText(null);
txtPayment.setText(null);
boxSpace.setText(null);
public static void main(String[] args) //This is the signature of the entry point of all the desktop apps
new MPC();
}This portion to be exact. All the buttons work for me except this one. I need to calculate user input and also use the fixed data that can be found in the dblTrmLoanRate array. When I choos to use user input instead, the program either crashes or for some reason uses the year7InterestRateBtn instead.
if (command == btnCalc)
//dblLoanAmount = Double.parseDouble(txtTotalMort.getText() ); // Loan amount
//interestRate = Double.parseDouble(txtInterestRate.getText() ); // /100 )/ 12; // Devides rate
intRate = (Double.parseDouble(txtInterestRate.getText() )/100 )/ 12;
//int intYearsMonths = Integer.parseInt(txtYearsInput.getText() );// * 12; //Multiplies loan length
int months = Integer.parseInt(txtYearsInput.getText() )* 12;
I was going to leave out the remed portion but thought it might help you with the navigation. I am sorry I did not use code tags, but I am going to go find out what those are and use them in the future. -
Encrypted MAPI on WAAS 5.0.3a I need a little help with troubleshooting
So, I stumbled upon this portion of the 5.0.1 configuration guide that spells out step by step how to configure encrypted mapi acceleration:
http://www.cisco.com/en/US/docs/app_ntwk_services/waas/waas/v501/configuration/guide/policy.html#wp1260556
1. Configure DNS settings - Done
2. Configure NTP settings - Done
3. Verify WAE devices are registered and online with the WAAS Central Manager - Done
4. Configure SSL Peering Service - Did this, seems to be working, but it would be great if someone could provide me with some show commands that will verify this is configured properly.
5. Verify WAN Secure mode is enabled - Did this, but the command "show accelerator wansecure" shows it is enabled and running, but seems like useless information, anyone know any better commands to verify this? No tcp session are coming up wansecure...
6. Configure windows domain settings and perform domain join - I did this on the Data Center WAE-674 only, the computer account was created in the domain.
7. Configure domain identities - Ok, I was a little confused here, but I used the machine account name that I created in the previous step, seems to be working, the lack of explanation/troubleshooting at this point is very frustrating. The image shown uses a different name than the device name in the picture...
8. Enable Windows Domain Encrypted Service - Done, very strait forward
9. Enable Encrypted MAPI Traffic Optimization - Done, also very strait forward
So, from the WAE, I run the command "show stat conn" I still see the TG connections with 0.00% to the mail server. Called user, had them exit from (and I verified session closed) and reconnect to exchange, still TG 0.00%. Not sure if this one was useful or not, but "show stat conn | inc W" no sessions with W.
I did find that this command "show windows-domain encryption-service keylist" seems to be the most useful (even though I didn't find it on any Cisco support page, found it by stumbling through available commands, trying each one in turn) showing the two requests to the two exchange servers were successful. Which makes me think I did something right, who knows exactly what since the EMAPI is still not decrypted.
I have no errors showing on the CM Management console. I did have some errors pop up when I was generating the self signed certificates, but they all cleared when I finished all the devices. I am going to reboot the WAE tonight and see if things start picking up tomorrow or if I get any errors after reboot.
I am hoping that someone has some good show commands or debug commands that will point to where or what the problem is.Ok, I got it working. Well, it is meeting the criteria I specified above anyway.
1. to verify your SSL is working properly: "show crypto ssl services host peering"
2. Wansecure is enabled/disabled, there is no verification, very strait forward.
3. DO use the computer account you create when you join the domain as the machine account.
Show commands to verify you did everything correctly:
"accelerator mapi verify encryption-settings"
"show windows-domain encryption-service keylist"
If you did everything correctly, you should get keys from the exchange server(s).
Now, the issue I ran into. Our 2 exchange servers are both behind a Citrix Netscaler for load balancing. If a user connects directly to the exchange servers, it works, if they connect to the netscaler, it fails to accelerate. I can not get a key from the netscaler, not sure if there is a way to manually exchange keys and force the to devices to trust each other. Anyone who may have seen this, your help would be greatly appreciated.
Just to clarify, MAPI acceleration works fine through the netscaler, it is just the EMAPI that fails. EMAPI and MAPI both work fine through exchange, but then I lose the load balancing the netscaler provides. -
Need a little help with Slimbox (Lightbox clone) and Spry data sets
Hello guys!
First of all let me say that I'm not a programmer in any way,
shape or form, and somehow I managed to build me a dynamic
thumbnail gallery that reads data from an XML file and displays it
on my webpage using a Spry data set and a slider widget (yay!)
This is of course only thanks to the many great examples
provided by the Adobe Spry team, and me being stubborn enough to
keep at it, even though I don't really understand what I'm doing :D
But I got to this point where I have basically everything
working, except that I can't get the Slimbox (Lightbox clone)
script to work with the Spry-generated thumbnail gallery.
From what I could understand from other threads on this
forum, is that I need to add an observer somewhere, only that I'm
not sure where and how (those threads are pretty old and the
examples aren't available anymore).
I'm sure you guys know what I'm talking about, anyway, here's
what I got so far:
http://www.riotdesign.com.ar/misc/gallery/test1.html
I have the thumbnail gallery populated from the external XML
file, a basic page navigation using the Sliding Panels widget, and
the Slimbox script which works only on the static test image.
Okay I guess that's it for now, sorry for the long post and
of course any help with this will be GREATLY appreciated :)
Thanks & bye!Kev,
Where exactly does the .evalScripts = true; text need to go?
Does it go in the href call?
<a href="ManageNotes.asp" title="Manage Notes" onClick="this.blur();
Modalbox.show(this.href, {title: 'Manage Notes', width: 575}); return false;">View your notes.</a>
Thanks for any assistance.
J Bishop -
Need a little help with RAF logic
So Im making a program to give different users, different rights. This is the method that appends them to file and Map
* Writes the players rights to the appendages
* @param playerName Player to update
* @param playerRights Rights to give the player
* @param pointer The lines index in the files
* @throws IOException If a read/write error occours
public void writeRights(String playerName, Rights playerRights, long pointer) throws IOException {
rightsRAF.seek(pointer);
rightsRAF.write(("\n" + playerName + "::" + playerRights).getBytes());
if(rightsRAF.read() != '\n') {
rightsRAF.seek(rightsRAF.getFilePointer()-1);
rightsRAF.write("\n".getBytes());
rightsMap.put(playerName, playerRights);
}1. The RAF goes to the predetermined index in the file, pointer, which is the line the users name starts on. Entries are stored in the file as "name::RIGHTS"
2.It writes out the players name, and rights
3. It checks to see if it accidentally wrote over the \n
My problem now, is that some rights are longer than others. For example, if there was already an entry, "name::MODERATOR" and you overwrite it, with "name::OWNER" then it would turn into "name::OWNERATOR" because the rest of the line wasn't overwritten.
I need some help with logic to determine how to overwrote the entire line, because sometimes you could go from a short one, to a long one, and need to append a new \n character, and sometimes you could go the other way around from long to short and end up with two words fused, I cant figure out how to determine whats a word that got partially overwritten and whats a new line totally.
ThanksAs pointed out you need to have fixed size records, or at least a maximum size.
You also have another problem nobody commented on yet (I don't think) with the getBytes() calls. At that point in your code you will mangle most unicode Strings.
All things being equal here I think your best solution is to use an embedded database like JavaDB with JDBC. I think you will find an XML solution to slow for your purposes.
If you decide to continue the RAF route though here is an example. I know this is not exactly what you are doing but you can extrapolate from this...
public void updatePlayerName(String playerName, int playerIndex){
int recordlength = 200;
byte[] buff = playerName.getBytes("UTF-8");
if(buff.length>recordlength){
//truncate bytes. this is also not great because a character at the end could be mangled
byte[] temp = new byte[recordlength];
System.arraycopy(buff,0,temp,0,temp.length);
buff = temp;
long pointer = playerIndex * (recordlength+4);// plus 4 bytes per record for actual length
raf.seek(pointer);
raf.writeInt(buff.length);
raf.write(buff);
public String getPlayerName(int playerindex){
int recordlength = 200;
long pointer = playerIndex * (recordlength+4);
raf.seek(pointer);
int lengthToRead = raf.readInt();
//length to read should be checked for sanity or bad things will happen next
byte[] buff = new byte[lengthToRead];
raf. readFully(buff);
return new String(buff,"UTF-8");
}And then of course you'd have to add storing the "rights". It gets complicated in a hurry. I do really recommend the JDBC route. -
Need a little help with G3 Clameshell...Please
I just received this Clameshell, and it only has OS9 on it, I haven't used 9 in forever, and really need to get OSX on it. I have retail Panther cd's. But I hear I need to update the firmware, if it isn't updated yet.
I know I can find out which I have in System Profiler, but I can't find it in there. Is it called something else? What part of System Profiler is it in(in OS9).
Also, I have Cable net, this Clamshell was always used with dial up, how can I switch things around in it so I can hook up my ethernet cable and run with it? Is that possible with OS9? Or will I have to update the firmware a different way.
I am stuck. Need lots of help.
Thanks!!!
veganjusticeIs it called something else? What part of System Profiler is it in(in OS9).
It is in the field called "Boot ROM".
...how can I switch things around in it so I can hook up my ethernet cable and run with it?
Open the TCP/IP control panel. Configure it to use Ethernet and DHCP to get an IP address. -
Need a little help with some errors.
Receiving some errors..
btn2.addActionListener(new ActionListener() {
and also
frame.setLocation(400,400);
frame.setVisible(true);
}<<~~has 2 errors here...
Both above have class or interface expected errors..clueless on what i'm missing at the moment.
Anyone mind pointing out what {'s and }'s i'm missing?
btn1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btn1actions();
private void btn1actions() {
if (radio1.isSelected()) System.out.println("Radio Button 1 is selected.");
if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.");
btn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btn2actions();
private void btn2actions() {
if (radio1.isSelected()) System.out.println("Radio Button 1 is selected.");
if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.");
btn3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btn1actions();
private void btn3actions() {
txt1.setText("");
txt1.requestFocus();
public static void main(String[] args) {
Test2 frame = new Test2();
frame.setTitle("Test Frame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 300);
frame.setLocation(400,400);
frame.setVisible(true);
}All my code..finally posted...just need help with more errors.
F:\DocumentsTest2.java:169: ';' expected
btn1.addActionListener(new ActionListener()) {
^
F:\Documents\Test2.java:176: illegal start of expression
private void btn1actions() {
^
F:\Documents\Test2.java:191: illegal start of expression
private void btn2actions() {
^
F:\Documents\.java:202: illegal start of expression
private void btn3actions() {
^
4 errors
Tool completed with exit code 1
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test2 extends JFrame{
static JButton btn1,btn2,btn3;
static JTextField txt1;
static JRadioButton radio1,radio2;
public Test2() {
Container container = getContentPane();
container.setLayout(new BorderLayout());
//Create Panels
JPanel Panel1 = new JPanel();
JPanel Panel2 = new JPanel();
JPanel Panel3 = new JPanel();
JPanel Panel4 = new JPanel();
JPanel Panel5 = new JPanel();
JPanel Panel6 = new JPanel();
JPanel Panel7 = new JPanel();
JPanel Panel8 = new JPanel();
JPanel Panel9 = new JPanel();
JPanel Panel10 = new JPanel();
//Set Layout for Panels
Panel3.setLayout(new BorderLayout());
Panel4.setLayout(new BorderLayout());
Panel5.setLayout(new BorderLayout());
Panel6.setLayout(new BorderLayout());
Panel10.setLayout(new BorderLayout());
//Create the Various Fonts and Colors for this GUI
Font font1 = new Font("SansSerif", Font.BOLD, 20);
Font font2 = new Font("Serif", Font.PLAIN, 15);
Color color1 = new Color(3,15,125);//A Dark Blue Color
Color color2 = new Color(201,29,10);//A Red Color
Color color3 = new Color(127,127,127);//A Grey Color
//Create Buttons and Labels
btn1 = new JButton("Submit");
btn2 = new JButton("Display Schedule");
btn3 = new JButton("Enter New Name");
JLabel label1 = new JLabel("Student Name");
JLabel label2 = new JLabel("Course Number");
JLabel label3 = new JLabel("Welcome to the Java Community College");
JLabel label4 = new JLabel("Registration System!");
//Declare Text Field For Entering Student Names
txt1 = new JTextField(15);
//"Put Course Number from another Method Here"
String[] courseStrings = { "CISM2230 A", "CISM2230 B", "CISM1110 A", "CISM1110 B", "CISM1120 A", "CISM1120 B" };
JComboBox Combo1 = new JComboBox(courseStrings);
//Declare Radio Buttons for Add and Drop Course
radio1 = new JRadioButton("Add a Course", false);
radio2 = new JRadioButton("Drop a Course", false);
ButtonGroup radioButtons = new ButtonGroup();
radioButtons.add(radio1);
radioButtons.add(radio2);
//Panel 10 is the Main Displaying Panel
Panel10.add(Panel3, BorderLayout.NORTH);
Panel10.add(Panel4, BorderLayout.CENTER);
Panel10.add(Panel8, BorderLayout.SOUTH);
//Panel 3 Used to Display Label 3 and 4 using Panels 1 and 2
Panel3.add(Panel1, BorderLayout.NORTH);
Panel3.add(Panel2, BorderLayout.CENTER);
Panel1.add(label3);
Panel2.add(label4);
//Panel 4 Used to Display Student Name, Txt1, Course Number, Combo Box and Radio Buttons
Panel5.add(label1, BorderLayout.NORTH);
Panel5.add(txt1, BorderLayout.CENTER);
Panel6.add(label2, BorderLayout.NORTH);
Panel6.add(Combo1, BorderLayout.CENTER);
Panel7.add(radio1, BorderLayout.NORTH);
Panel7.add(radio2, BorderLayout.CENTER);
Panel4.add(Panel5, BorderLayout.NORTH);
Panel4.add(Panel6, BorderLayout.CENTER);
Panel4.add(Panel7, BorderLayout.SOUTH);
//Panel 8 Used to Display the Buttons
Panel9.add(btn1, BorderLayout.CENTER);
Panel9.add(btn2, BorderLayout.CENTER);
Panel9.add(btn3, BorderLayout.SOUTH);
Panel8.add(Panel9, BorderLayout.CENTER);
//Setting Background, ForeGround and Font of all Text.
Panel1.setBackground(color3);
Panel2.setBackground(color3);
Panel3.setBackground(color3);
Panel4.setBackground(color3);
Panel5.setBackground(color3);
Panel6.setBackground(color3);
Panel7.setBackground(color3);
Panel8.setBackground(color3);
Panel9.setBackground(color3);
Panel10.setBackground(color3);
btn1.setBackground(color3);
btn2.setBackground(color3);
btn3.setBackground(color3);
radio1.setBackground(color3);
radio2.setBackground(color3);
btn1.setFont(font2);
btn2.setFont(font2);
btn3.setFont(font2);
Combo1.setFont(font2);
Combo1.setBackground(color3);
Combo1.setForeground(color1);
label1.setFont(font2);
label2.setFont(font2);
label3.setFont(font1);
label4.setFont(font1);
label1.setForeground(color2);
label2.setForeground(color2);
label3.setForeground(color1);
label4.setForeground(color1);
container.add(Panel10);
//Setting Keyboard Shortcuts to Radio Buttons and Regular Buttons
btn1.setMnemonic('S');
btn2.setMnemonic('D');
btn3.setMnemonic('E');
radio1.setMnemonic('A');
radio2.setMnemonic('C');
//ActionListener
btn1.addActionListener(new ActionListener()) {
public void actionPerformed(ActionEvent evt) {
btn1actions();
private void btn1actions() {
if (radio1.isSelected()){ System.out.println("Radio Button 1 is selected. Button 1")};
if (radio2.isSelected()){ System.out.println("Radio Button 2 is selected. Button 1")};
btn2.addActionListener(new ActionListener()) {
public void actionPerformed(ActionEvent evt) {
btn2actions();
private void btn2actions() {
if (radio1.isSelected()) System.out.println("Radio Button 1 is selected(Button 2).");
if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.Button 2");
btn3.addActionListener(new ActionListener()) {
public void actionPerformed(ActionEvent evt) {
btn1actions();
private void btn3actions() {
txt1.setText("");
txt1.requestFocus();
public static void main(String[] args) {
JavaCollegeTest2 frame = new JavaCollegeTest2();
frame.setTitle("Project 4");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 300);
frame.setLocation(400,400);
frame.setVisible(true);
} -
Almost there! Need a little help with CSS Menu
Hi folks,
I am almost there with a menu system. The problems I discovered were mostly to do with layout.css nav elements interfering with my custom code. http://bendannie2.businesscatalyst.com/flexi2.html
Here are the problems I can't seem to resolve.
There appears a red diamond list element and I can't seem to remove it or find it in the Inspector on any css link
the secondary menus blink and are hard to select on hover over tertiary menus (see On Sale>Cartier> )
the tertiary menus are a little crowded towards the secondary menus.
the css classes in inspector seem to repeat ad infinitum
Any help most deeply appreciated...
BTW, it works better on a smart phone!
JeffThanks, Don't know why I didn't see that...
I'm stil having a problem with the hover area for selecting sub menus... The problem appears to be the js, I think!, I'm not qualified to analyze jquery.
The behaviors are as follows:
The On Sale submenus stay active even when you roll off that menu and select another.
The hover area after the first scrollover appears to be below the existing text of the top level and not on the text itself.
there is something going on as you scroll down through the submenus where they are blinking on and off as you pass each sub tab... This uses jQuery 1.7.2, so if that has been fixed in a later edition, I don't know...
Perhaps it is the way I set the CSS but I didn't, to my knowledge, change a hover/selection area for the menus...
TIA,
JEff -
Need a little help with strings
So I would like to have the user input a month by using the abbreviation ex. (mar or apr) instead. So I want month to be a string right? When I tried that I get an error. What should this look like?
import java.util.*;
public class MonthSwitch
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
int month;
System.out.print("Enter a Month: ex. Jan, Feb, Mar ect...");
month = console.nextInt();
System.out.println();
switch (month)
case 1: System.out.println("First Quarter");
case 2: System.out.println("First Quarter");
case 3: System.out.println("First Quarter");
break;
case 4: System.out.println("Second Quarter");
case 5: System.out.println("Second Quarter");
case 6: System.out.println("Second Quarter");
break;
case 7: System.out.println("Third Quarter");
case 8: System.out.println("Third Quarter");
case 9: System.out.println("Third Quarter");
break;
case 10: System.out.println("Fouth Quarter");
case 11: System.out.println("Fouth Quarter");
case 12: System.out.println("Fouth Quarter");
break;
default: System.out.println("Sorry Input is Invalid");
}Edited by: NewJavaKid on Apr 29, 2009 10:47 PMIf you use an enum construct, then you can create a switch that operates on the abbreviated month value. Note that I made a correction in the Scanner input code, and converted the input to lowercase (to assure a match with the enum) in case capitals were used. The switch was revised to work correctly with enums, which requires the try/catch to catch illegal input.
import java.util.Scanner;
public class Xy
static Scanner console = new Scanner(System.in);
enum Month
jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
public static void main(String[] args)
System.out.print("Enter a Month: ex. Jan, Feb, Mar etc...");
String shortMonth = console.next().toLowerCase();
System.out.println();
try
switch (Month.valueOf(shortMonth))
case jan:
case feb:
case mar:
System.out.println("First Quarter");
break;
case apr:
case may:
case jun:
System.out.println("Second Quarter");
break;
case jul:
case aug:
case sep:
System.out.println("Third Quarter");
break;
case oct:
case nov:
case dec:
System.out.println("Fouth Quarter");
catch (IllegalArgumentException iae)
System.out.println("Sorry, input is invalid");
} -
Need a little help with JAR creation
I've created a JAVA program with the Forte IDE and now I want to make it executable without the IDE. I read on this forum that all I had to do was create a JAR file, so I tried but I get an error (see below). Could someone point out my error please.
Directory Tree:
vio082\vio\app\
DOS command to create executable JAR:
"java -jar cmf trackerManifest.txt trackerTest.jar trackerTest.Class"
ERROR I RECEIVED:
"Exception in thread "main" java.util.zip.ZipException: The system cannot find the file specified
at java.util.zip.ZipFile.open<Native Method>
at java.util.zip.ZipFile.<init><Unknown Source>
at java.util.zip.ZipFile.<init><Unknown Source>
at java.util.zip.ZipFile.<init><Unknown Source>"
This was my file trackerManifest.txt:
Main Class: trackerTest
[cr]
This is the begining of my file trackerTest.Class:
package vio.app;
import javax.comm.*;
import vio.tracker.*;
import java.net.*;
import java.io.*;
public class trackerTest {
public static void main (String argv[]) {Thanks for the help so far. My first problem was that the directory with the "jar" command was not in my path (now that fixed). My application still won't execute and I think it has to do with the following:
My application uses the serial port to communicate with a device and uses a socket server to communicate with a C++ program. The following JAVA utilities are imported to make my application work:
javax.comm.
java.net.
ijava.io.
If I use the command:
"jar cvfm trackerTest.jar trackerManifest.txt trackerTest.Class"
will the appropriate files from javax.comm, java.net and ijava.io also be incorporated into the jar file? If not, how are they made available when I distribute my jar to other users?
Second question:
Should I be using:
"jar cvfm trackerTest.jar trackerManifest.txt vio082/*.*"
to capture all the other classes required by my package that are in other directories above and below the trackerTest.class directory?
Any help is greatly appreciated.
JAM
Maybe you are looking for
-
Problems with Adobe ID/licensing the software Creative Cloud
Hello, I have problem with licensing the software of Creative Cloud. All programs installed on my computer and working fine. But the software keeps asking (around 1/2 days), for licensing the software. For example: when I tried to open Photoshop this
-
File not found, Error= –43
Everytime i try to make a new project logic pro does not accept audiophiles i use from other project-folders (File not found, Error= -43). Even with the newest logic-version (10.0.7) and also a new mac book pro (moving via migration assistant) it doe
-
Mail Version 2.0.5 (746/746.2) This is how I have my Mail.app window arranged: I have the main Mail window open on the left, the address window on the right and the Activity Viewer window below the address window. If I right click > Edit Card on a na
-
Deep linking in pdf and I.E. 8
I've read all the instructions on how to create links within a pdf document for a webpage, and it works in Firefox. However, it's not working in I.E. 8. Does anybody know why it wouldn't work in I.E. 8? I've used both filename.pdf#nameddest=name a
-
Enable System Wide DEP Support via command line
Hello all, I am trying to deploy EMET to our organization, but I notice on my test installation on a Windows 7 PC, systemwide DEP was not enabled by default. I figured I can activate this through the command line, but I seem to be running into some t