Can I modulize this code?
I brought a project in from Flash cat and from working on it, the projecthas grown to 1181 lines of code. Modulization is important in any software development project how ever the projet was 900 line sof cod eto begin with.
I see a lot of <fx:DesignLayer> and other types, along with various types of transitions to and from various states. - I am wondering with an application heavy in state transition how do you modulize the main.mxml file to keep it clean and easy to read. When i brough the application in, it created well over 50 componets.
Ideas?
Suggestions?
I checked your entire site, I think. The only place it is used, or found, fo rthat matter, is on the home page where you DO use it for the mouseover function on the
"Listen to our BlogTalk Radio Program"
link.
So, if you want that mouseover to work, you need to leave all the head functions in place.
E. Michael Brandt
www.divahtml.com
www.divahtml.com/products/scripts_dreamweaver_extensions.php
Standards-compliant scripts and Dreamweaver Extensions
www.valleywebdesigns.com/vwd_Vdw.asp
JustSo PictureWindow
JustSo PhotoAlbum, et alia
Similar Messages
-
Can anybody help me to build an interface that can work with this code
please help me to build an interface that can work with this code
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("
t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
StringBuffer out = null;
try
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null )
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
finally
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text)
Iterator it = words.keySet().iterator();
while( it.hasNext() )
String key = (String)it.next();
text = text.replaceAll("\\b"key"
b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin'please help me i don t know how to go about this.my teacher ask me to build an interface that work with the code .
Here is the interface i just build
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.awt.*;
import javax.swing.*;
public class boy extends JFrame
JTextArea englishtxt;
JLabel head,privatetxtwords;
JButton translateengtoprivatewords;
Container c1;
public boy()
super("HAKIMADE");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBackground(Color.white);
setLocationRelativeTo(null);
c1 = getContentPane();
head = new JLabel(" English to private talk Translator");
englishtxt = new JTextArea("Type your text here", 10,50);
translateengtoprivatewords = new JButton("Translate");
privatetxtwords = new JLabel();
JPanel headlabel = new JPanel();
headlabel.setLayout(new FlowLayout(FlowLayout.CENTER));
headlabel.add(head);
JPanel englishtxtpanel = new JPanel();
englishtxtpanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
englishtxtpanel.add(englishtxt);
JPanel panel1 = new JPanel();
panel1.setLayout(new BorderLayout());
panel1.add(headlabel,BorderLayout.NORTH);
panel1.add(englishtxtpanel,BorderLayout.CENTER);
JPanel translateengtoprivatewordspanel = new JPanel();
translateengtoprivatewordspanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
translateengtoprivatewordspanel.add(translateengtoprivatewords);
JPanel panel2 = new JPanel();
panel2.setLayout(new BorderLayout());
panel2.add(translateengtoprivatewordspanel,BorderLayout.NORTH);
panel2.add(privatetxtwords,BorderLayout.CENTER);
JPanel mainpanel = new JPanel();
mainpanel.setLayout(new BorderLayout());
mainpanel.add(panel1,BorderLayout.NORTH);
mainpanel.add(panel2,BorderLayout.CENTER);
c1.add(panel1, BorderLayout.NORTH);
c1.add(panel2);
public static void main(final String args[])
boy mp = new boy();
mp.setVisible(true);
}..............here is the code,please make this interface work with the code
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("
t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
StringBuffer out = null;
try
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null )
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
finally
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text)
Iterator it = words.keySet().iterator();
while( it.hasNext() )
String key = (String)it.next();
text = text.replaceAll("\\b"key"
b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin' -
Can soemone explain this code to me
can someone explain this code to me
import javax.swing.*;
import BreezySwing.*;
import java.util.Random;
public class PennyPinch extends GBFrame
private JButton enterButton;
private JTextArea outputArea;
private int[][] board = {{1,1,1,1,1},{1,2,2,2,1},{1,2,3,2,1},{1,2,2,2,1},{1,1,1,1,1}};
private boolean[][] landing = new boolean[5][5];
private int total;
public PennyPinch()
enterButton = addButton ("Pitch",2,1,1,1);
outputArea = addTextArea("",4,1,3,4);
public void pitch()
Random generator = new Random();
int randomRow = generator.nextInt(5);
int randomColumn = generator.nextInt(5);
total += board[randomRow][randomColumn];
landing[randomRow][randomColumn] = true;
public void buttonClicked (JButton buttonObj)
pitch();
displayList(board, outputArea);
private void displayList(int a[][], JTextArea output)
output.setText("");
for (int row = 0; row < 5; row++)
for (int col = 0; col < 5; col++){
if(landing[row][col] ==true)
output.append(Format.justify('r',"P", 3) + " ");
if (col == 4)
output.append("\n");
else
output.append(Format.justify('r', a[row][col], 3) + " ");
if (col == 4)
output.append("\n"); }
output.append("the total is " + total);
public static void main (String[] args)
PennyPinch theGUI = new PennyPinch();
theGUI.setSize (300, 300);
theGUI.setVisible(true);
}Knowing toilets or studying under George?What kind pervert are you?
What is written in public toilets o/c!Ah yes I see, I found example questions.
2:3.4 please complete the following well known saying
by filling in the blank
Whilst you are reading what I put
You are blank on your foot
2:3.5 Upon seeing the announcement 'Toilet
tennis' and following the instruction ' please
see other wall for details' what is the standard
message on the other wall.2:3.4. is the correct answer 'micturating' ?
2:3.5. I believe the answer is Ibidem. -
How can i run this code correctly?
hello, everybody:
when i run the code, i found that it dons't work,so ,i hope somebody can help me!
the Ball class is this :
package {
import flash.display.Sprite;
[SWF(width = "550", height = "400")]
public class Ball extends Sprite {
private var radius:Number;
private var color:uint;
private var vx:Number;
private var vy:Number;
public function Ball(radius:Number=40, color:uint=0xff9900,
vx:Number =0, vy:Number =0) {
this.radius= radius;
this.color = color;
this.vx = vx;
this.vy = vy;
init();
private function init():void {
graphics.beginFill(color);
graphics.drawCircle(0,0,radius);
graphics.endFill();
and the Chain class code is :
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width = "550", height = "400")]
public class Chain extends Sprite {
private var ball0:Ball;
private var ball1:Ball;
private var ball2:Ball;
private var spring:Number = 0.1;
private var friction:Number = 0.8;
private var gravity:Number = 5;
//private var vx:Number =0;
//private var vy:Number = 0;
public function Chain() {
init();
public function init():void {
ball0 = new Ball(20);
addChild(ball0);
ball1 = new Ball(20);
addChild(ball1);
ball2 = new Ball(20);
addChild(ball2);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
private function onEnterFrame(event:Event):void {
moveBall(ball0, mouseX, mouseY);
moveBall(ball1, ball0.x, ball0.y);
moveBall(ball2, ball1.x, ball1.y);
graphics.clear();
graphics.lineStyle(1);
graphics.moveTo(mouseX, mouseY);
graphics.lineTo(ball0.x, ball0.y);
graphics.lineTo(ball1.x, ball1.y);
graphics.lineTo(ball2.x, ball2.y);
private function moveBall(ball:Ball,
targetX:Number,
targetY:Number):void {
ball.vx += (targetX - ball.x) * spring;
ball.vy += (targetY - ball.y) * spring;
ball.vy += gravity;
ball.vx *= friction;
ball.vy *= friction;
ball.x += vx;
ball.y += vy;
thanks every body's help!ok, thanks for your reply ! I run this code in the Flex builder 3!and the Ball class and the Chain class are all in the same AS project!
and i changed the ball.pv property as public in the Ball class, and the Chain class has no wrong syntactic analysis,but the AS code don't run.so this is the problem.
2010-04-21
Fang
发件人: Ned Murphy <[email protected]>
发送时间: 2010-04-20 23:01
主 题: how can i run this code correctly?
收件人: fang alvin <[email protected]>
I don't see that the Ball class has a pv property, or that you even try to access a pv property in the Chain class. All of the properties in your Ball class are declared as private, so you probably cannot access them directly. They would need to be public. Also, I still don't see where you import Ball in the chain class such that it can use it. -
How can i know how to redeem the code? how can i get this code?
how can i know how to redeem the code? how can i get this code? please i need you help
<Email Edited by Host>You are trying to create a new Apple ID? You don't have one yet? Is that correct?
If so, then see this article on how to creat your Apple ID - and make up a password for it. Remember to write it down immediately.
http://support.apple.com/en-us/HT203993 -
i m login in th my iphone in the itune ti download something after entering cc details its asking about something itune gift card secure code...i am not getting this..where can i get this code in order to dowanload frm itune...
Meen0902 wrote:
... after entering cc details its asking about something itune gift card secure code...i
Try the 3 or 4 digit code on the back of your Credit Card.... -
I forgot the codeslot of my ipod. How can I delete this code?
I forgot the codeslot of my ipod. How can I delete this code? Can anybody help help me? I'm sorry for the bad English.
Connect it to iTunes and Restore it.
-
How can i rewrite this code into java?
How can i rewrite this code into a java that has a return value?
this code is written in vb6
Private Function IsOdd(pintNumberIn) As Boolean
If (pintNumberIn Mod 2) = 0 Then
IsOdd = False
Else
IsOdd = True
End If
End Function
Private Sub cmdTryIt_Click()
Dim intNumIn As Integer
Dim blnNumIsOdd As Boolean
intNumIn = Val(InputBox("Enter a number:", "IsOdd Test"))
blnNumIsOdd = IsOdd(intNumIn)
If blnNumIsOdd Then
Print "The number that you entered is odd."
Else
Print "The number that you entered is not odd."
End If
End Sub873221 wrote:
I'm sorry I'am New to Java.Are you new to communication? You don't have to know anything at all about Java to know that "I have an error," doesn't say anything useful.
I'm just trying to get you to think about what your post actually says, and what others will take from it.
what does this error mean? what code should i replace and add? thanks for all response
C:\EvenOdd.java:31: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=true;
^
C:\EvenOdd.java:35: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=false;
^
2 errors
Telling you "what code to change it to" will not help you at all. You need to learn Java, read the error message, and think about what it says.
It's telling you exactly what is wrong. At line 31 of EvenOdd.java, you're calling isOdd(), with no arguments, but the isOdd() method requires an int argument. If you stop ant think about it, that should make perfect sense. How can you ask "is it odd?" without specifying what "it" is?
So what is this all about? Is this homework? You googled for even odd, found a solution in some other language, and now you're just trying to translate it to Java rather than actually learning Java well enough to simply write this trivial code yourself? -
i downloaded the whatsapp for my phone and i can't find this code i have to put in. Help!
My phone had the same problem with yours before.
Here is my solution.
Install a software that setup an android system to your computer
Inside the "an android system", install Whatsapp
run Whatsapp, input your phone number to get the code
At this time, your phone suppose to receive your code. -
I want to install WhatsApp on my iphone 16gb, but I need a code of 3 figures! Where can I get this code? i tried looking at my messages folder, but i havent got any 3 digit code. plz help
post in the iPhone forum : https://discussions.apple.com/community/iphone/using_iphone
-
Can I use this code to self Generate month ? ie Jan, Feb, Mar
Hi can some one tell me is this possible to do.
I am making a Date Of Birth using combo box�s this is the code I am using to generate the date.
My question is can I use this for the month i.e. Jan, Feb, Mar etc
private void DayOfTheMonth(int highNumber,JComboBox comboBox){
comboBox.addItem(" ");
for (int index = 1; index < highNumber; index++) {
comboBox.addItem(String.valueOf(index));
private void DaySpecificComboBox()
//Day is stopat 32 as there is 31 days in the month
DayOfTheMonth( 32, DayjComboBox);
}Hi,
This can be done with the help of your abaoer, you can have the required texts from the table T009C, otherwise the programmer can hard code the months as you given.
Regards,
Vasu. -
How can i modify this code in BI?
hi friends,
suppose i have data in infosource with deffirent customers.
like from usa,germany,uk.
i created 3 cubes and uploaded records corresponding countries.
i have written code like this in 3.5
loop at data_package.
if data_package-/bic/zcustomer <> 'usa'.
delete data_package.
endif.
endloop.
same logic i need to write in BI 7.0 now where can i write this logic, what modifications i need to change for BI 7.0
regards
suneel.Hi,
Check this link:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
I guess, you just need to change the DATA_PACKAGE to the new naming convention.
Hope this helps.
PB -
Can anyone explain this code snippet
I'm revising for my exams and this is one of the question that came up in the previous exams. Can someone help answe the questions at the end. Also what object is 'time_t' and how why do they use 'input_time -= 24*60*60;'?
Read the following code carefully before answering the questions.
time_t normalise(time_t input_time)
bool finished;
// This produces a formatted time string like:
// Thu_Nov_24_18:22:48_1986
string str_time = format_time( input_time );
while( str_time.substr(1,3) != "Sun")
input_time -= 24*60*60;
str_time = format_time( input_time );
while( str_time.substr(11,2) != "00" )
input_time -= 60*60;
str_time = format_time( input_time );
while( str_time.substr(14,2) != "00")
str_time = format_time( input_time );
input_time -= 60;
while( str_time.substr(17,2) != "00")
input_time -= 1;
str_time = format_time( input_time );
return input_time;
1) Briefly explain what you think the overall purpose of this function is (do not describe each line of code).
2) There are two bugs in this code that prevent it from functioning correctly; circle them.
3) What would actually happen when this code is run?
(a) as originally written
(b) with the first bug fixed?
4) Discuss the efficiency of the code assuming the bugs have been fixed.Looks like it is trying to increment the time parameter back to represent midnight of the previous Sunday.
-
HI,
CAN SOMEONE EXPLAIN TO ME THIS CODE:
FUNCTION DISP_QATD return VARCHAR2 is
BEGIN
SRW.REFERENCE(:P_CURRENCY_CODE);
SRW.REFERENCE(:P_QATD1);
SRW.USER_EXIT('FND FORMAT_CURRENCY
CODE = ":P_CURRENCY_CODE"
DISPLAY_WIDTH = "19"
AMOUNT = ":P_QATD1"
DISPLAY = ":DISP_QATD"
PRECISION = "STANDARD"');
RETURN(:DISP_QATD);
END;Hello,
For details about SRW.REFERENCE :
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_reference.htm?tp=true
Regards -
Can someone check this code?
What I am trying to achieve is an "active" button state. I
have six buttons. When one is clicked, i need it to change to a
color which denotes that it is the active button.
someone provided me with this code, but I can't seem to get
it to work. I followed the directions precisely.
The directions were as follows:
One thing I think you could do is create another invisible
layer of buttons above all your other buttons. You could make them
all invisible, unless a button is clicked.
Let's say your original layer of buttons is called a_but,
b_but, and c_but.
Then you could have another invisible layer of buttons called
invA_but, invB_but, and invC_but. This layer of buttons would each
be the color you want displayed while the button is selected. The
code would look something like-
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
a_but.onRelease=function(){
invA_but._visible=true;
invB_but._visible=false;
invB_but._visible=false;
b_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=true;
invC_but._visible=false;
c_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=trueinvA_but, invB_but, and invC_but refer to instance names for
your buttons, not layer names as suggested in the description. It
should work if you have the instance names for the buttons right. I
would probably add code to make the nomal state invisible instead
of just having the active button covering the inactive one. EX:
a_but.onRelease=function(){
invA_but._visible=true; //show the buttons active state
a_but._visible = false; //hide the off state of the button
invB_but._visible=false; //hides the active state of button b
invC_but._visible=false; //hides the active state of button c
Maybe you are looking for
-
Can't seem to change the permissions on an external hard drive
HEELLLLPPP! We have a Western Digital terabyte hard drive that we initially set up on our Mac. We backed up both my husband's and my iTunes libraries to this hard drive from our individual work PCs, and reconnected to the Mac to do some duplicate fil
-
I am trying to pull some dates out of my database, and have them show up in a <cfselect> that users than then pick. I have: <cfselect name="ClassDate" size="1" required="yes" message="Please select the date the class began." query="RequestDate" value
-
Hi Expers, I have one doubt. If iam Developing the scenario HTTp To File Then do we need Any RFC Connection. When Do We need RFC Connection In case if we r implementing with HTTP Please clear me. Regards Khanna
-
Adobe Genuine Software Validation Failure
Can't download Adobe Application Manager. Keep getting "Adobe Genuine Software Validation Failure: The product you are trying to install is not an Adobe Genuine Software and appears to be counterfeit." What do I do? I've tried several times and I kee
-
My iMac has always run like a champ but it suddenly started running very slowly today. I haven't done anything different. I'm not running all kinds of programs. I've restarted several times and it takes about 20 minutes to start up. The little co