Need help in SRB matrix .
Hello every one .
I have installed the matrix for the srb and and tried a lot to set the classpath so as it accesses the jar files , but all in vain ....
These are the errors
[adnan@localhost UsingXMLeditor]$ javac DGLSender.java
1. ERROR in DGLSender.java
(at line 14)
import javax.xml.bind.JAXBContext;
^^^^^^^^^^^^^^
The import javax.xml.bind cannot be resolved
2. ERROR in DGLSender.java
(at line 15)
import javax.xml.bind.Marshaller;
^^^^^^^^^^^^^^
The import javax.xml.bind cannot be resolved
3. ERROR in DGLSender.java
(at line 16)
import javax.xml.bind.Unmarshaller;
^^^^^^^^^^^^^^
The import javax.xml.bind cannot be resolved
4. ERROR in DGLSender.java
(at line 17)
import javax.xml.soap.MessageFactory;
^^^^^^^^^^^^^^
The import javax.xml.soap cannot be resolved
Hi , thanks for the reply
I have installed apache-tomcat -5.5.17 and j2sdk1.4.2_13, I installed the SRB system of the san deigo (SDSC) , and the matrixi s the interface ,
I have tried to set the classpath by
export CLASSPATH=/usr/local/j2sdk1.4.2_13/lib/tools.jar , but i still dont know why it is unable to access the libraries and returns those errors
It will be great help , if i get to know what is it that i am doing wrong.
Thanks
Similar Messages
-
Need help with Color Matrix Filter.
need help. still can't find the answer. thanks in advance!
Darin.K wrote:
Yes there are two bugs, I found the other one first but figured if you fixed the result the other would be obvious. This is homework so only a hint:
look at what happens (and does not happen) to pixel.
the first bug was that i had to use the 'result[][]' array instead of the 'image[][]' array in my last loop, right?
the 2nd bug I really can't find :s been lookin at it for almost an hour now and trying new stuff but nothing works,
first i thought i had to put this line " result[x][y] = min(max(int((factor2 * pixel) + bias2), 0), 255);" inside the for loop above but that didn't fix my problem,
maybe the problem is in my 'imageX' and 'imageY' variable, i don't know? any more tips?
I'm sorry for being such a newb but programming isn't my strongest quality.
cedhoc wrote:
Just one more advice:
Look at the format of the "image" array. The way how to use the values from this array depends on the "image depth" parameter.
In your case, because the image is 8bit, you need to use the "colors" array containing the real RGB value.
Look at the Help for the "Read BMP File VI", you should be able to properly handle your pixels from there.
thanks for pointing that out for me, so I connect the 'totalpix' array with the 'colors' array from the image data instead of the 'image' array, that's correct right? -
Need help to write matrix query
Hi all,
I have the query . I'm getting output like this
chargetype amount start_date
DA1 170 04/01/2005
DA2 1170 04/01/2005
DA3 1730 04/01/2005
DA4 17 04/01/2005
DA5 -120 04/01/2005
DA6 0 04/01/2005
DA1 170 04/02/2005
DA2 2005 04/02/2005
DA3 590 04/02/2005
DA4 201 04/02/2005
DA5 340 04/02/2005
DA6 120 04/02/2005
I need my output like this
chargetype 04/01/2005 04/02/2005 04/03/2005 ......
DA1 170 170
DA2 1170 2005
DA3 1730 590
DA4 17 201
DA5 -120 340
DA6 0 120
pls help me out. your help is greatly appreciated.
the real query is .
SELECT st . sttl_item_nme charge_type,
SUM ( NVL ( sd . sttl_item_amt , 0 )) Adjustment ,
trunc(s . START_DT_GMT) start_date_gmt
from nm_sttl_item_dtl_type st ,
nm_sttl_item_dtl sd ,
nm_settlement s
where st . sttl_item_num = sd . sttl_item_num
and sd . sttl_id = s . sttl_id
and trunc(s . START_DT_GMT) between trunc(to_date('04/01/2005', 'mm/dd/yyyy')) and trunc(to_date('04/02/2005', 'mm/dd/yyyy'))
and s . ptcpt_cd = 'DEMO'
and s . sttl_pub_cd = ( select sttl_pub_cd
from nm_settlement c
where trunc(c.master_rpt_version_dt_sys) = (select trunc(max(ss.master_rpt_version_dt_sys))
from nm_settlement ss
where ss.ptcpt_cd = 'DEMO'
and ss.source_cd = 'ISO'
and trunc(ss.start_dt_gmt) = trunc(s.start_dt_gmt)
and sttl_id = s.sttl_id)
group by st . sttl_item_nme, trunc(s . START_DT_GMT)
order by trunc(s . START_DT_GMT), sttl_item_nme
Thanks & Regards,
Ramana.Search this site for "pivot" or "cross tab."
-
Need Help Regarding Enabling The Matrix
Hi All,
We have got one user form and we have got one choose from list and one matrix, on click of choose from list the value will be displayed in the text box and at the same time matrix should get enabled. But it;s not happening in our case. The value is coming in the text box through choose from list but matrix is not getting enabled. We are able to change the back ground color of the matrix, make first column invisible and all but not able to enable the matrix. We need help regarding this one.
Regards,
JayanthHey first bind the columns of matrix to any user datasource
and then you can enter any thing into your matrix
following code may help
suppose you have one column
oForm = SBO_Application.Forms.Item("URFRM")
oUserDataSource = oForm.DataSources.UserDataSources.Add("URDSName",
SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
oMatrix=oForm.Item("URMATRX")
oMatrix = oItem.Specific
oColumns = oMatrix.Columns
oColumn = oColumns.Item("URCOLName")
oColumn.DataBind.SetBound(True, "", "URDSName")
oMatrix.Addrow()
hope this will help
additionally you can look at this sample
.....SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources -
Need help with Drill down Matrix Report
Hi,
I need to create a matrix report with a tree functionality with two line heading.
Can some body tell me how can I generate this report?
REGION1 REGION2 REGION3
COL1 COL2 TOTAL COL1 COL2 TOTAL COL1 COL2 TOTAL
===========================================================
CAT1+
Sub_CAT1
Sub_CAT2
CAT2+
Sub_SCAT3
Sub_SCAT4
Where CAT1 , CAT2 needs to be collapsible rows. SCAT1..SCAT4 are sub categories under main categories.
REGION1.... REGION3 are top level headings. And COL1,COL2 are sub headings under top level headings.
Thanks,
ShrikantAs I said when I believe you posted up a similar question under a different user name...., (yes, it's that easy to tell )
Asking questions here about a version of Logic that was apparently, not legally purchased using the Mac App Store.. is not wise.... no matter what your reasoning for not being able to afford it...
Buy LPX, install it properly and then see if you have the same issues..... -
guys, i need help.... is anyone there have an idea about opengl...? ill attach 4 files that needs to be enhanced or debug for possible errors. to see the canvas... you should have atleast all the needed lib and jar of opengl in your pc.
its urgent, its for our thesis actually....ill be dividing the codes with the use of (" **** ")sign...
* Main.java
* Created on 29 January 2007, 08:12
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package longgong;
* @author welcome
public class Main {
/** Creates a new instance of Main */
public Main() {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
frmMain f = new frmMain();
* frmMain.java
* Created on November 10, 2006, 10:52 AM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package longgong; // create a floder named longgong and add the class inside
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
* @author all user
public class frmMain extends JFrame implements ActionListener, ChangeListener, ItemListener{
JPanel pnlWest, pnlEast, pnlCenter, pnlSouth, pnlTitle, pnlSlider, pnlPlayers;
JSlider slrSpeed;
JList lstResults;
String varResults [] = new String[31];
JLabel lblPlayers, lblTitle;
JCheckBox lblPlayer1, lblPlayer2, lblPlayer3, lblPlayer4, lblPlayer5, lblPlayer6;
ImageIcon imgDice1;
MyCanvas canvas;
JButton btnStart, btnStop;
JMenuBar menuBar;
JMenu menuFile, menuView, menuHelp;
JMenuItem menuNew, menuExit, menuIn, menuOut, menuHigh, menuPlay, menuAbout;
boolean isNew = false;
/** Creates a new instance of frmMain */
public frmMain() {
setLayout(new BorderLayout());
setTitle("Longgong");
setSize(780,600);
canvas = new MyCanvas(getSize().width, getSize().height);
imgDice1 = new ImageIcon("c:\\java\\images\\one.png");
menuBar = new JMenuBar();
menuFile = new JMenu("File");
menuView = new JMenu("View");
menuHelp = new JMenu("Help");
menuNew = new JMenuItem ("New Game");
menuNew.addActionListener(this);
menuExit = new JMenuItem ("Exit");
menuExit.addActionListener(this);
menuIn = new JMenuItem ("Zoom In");
menuIn.addActionListener(this);
menuOut = new JMenuItem ("Zoom Out");
menuOut.addActionListener(this);
menuHigh = new JMenuItem ("High Score");
menuPlay = new JMenuItem ("How To Play");
menuPlay.addActionListener(this);
menuAbout = new JMenuItem ("About");
menuAbout.addActionListener(this);
menuFile.add(menuNew);
menuFile.add(menuExit);
menuView.add(menuIn);
menuView.add(menuOut);
menuView.add(menuHigh);
menuHelp.add(menuPlay);
menuHelp.add(menuAbout);
menuBar.add(menuFile);
menuBar.add(menuView);
menuBar.add(menuHelp);
setJMenuBar(menuBar);
varResults[0] = "Dice Results";
varResults[1] = "1. 3-4-2";
varResults[2] = "2. 3-1-4";
varResults[3] = "3. 3-6-5";
slrSpeed = new JSlider(0, 100, 0);
slrSpeed.setPaintTicks(true);
slrSpeed.setMinorTickSpacing(1);
slrSpeed.setPaintLabels(true);
slrSpeed.setSnapToTicks(true);
slrSpeed.addChangeListener(this);
slrSpeed.setEnabled(false);
btnStart = new JButton("Start");
btnStart.addActionListener(this);
btnStop = new JButton("Stop");
btnStop.addActionListener(this);
pnlWest = new JPanel();
pnlEast = new JPanel();
pnlCenter = new JPanel();
pnlSouth = new JPanel();
pnlTitle = new JPanel();
pnlSlider = new JPanel();
pnlPlayers = new JPanel();
pnlWest.setLayout(new BorderLayout());
pnlEast.setLayout(new BorderLayout());
pnlEast.setPreferredSize(new Dimension(100,400));
pnlCenter.setLayout(new BorderLayout());
pnlSouth.setLayout(new FlowLayout());
pnlTitle.setLayout(new FlowLayout());
pnlSlider.setLayout(new FlowLayout());
pnlPlayers.setLayout(new BoxLayout(pnlPlayers,BoxLayout.Y_AXIS));
pnlPlayers.setPreferredSize(new Dimension(150,400));
lblPlayers = new JLabel(" Players: Choice (s)");
lblPlayer1 = new JCheckBox("None");
lblPlayer1.addItemListener(this);
lblPlayer2 = new JCheckBox("None");
lblPlayer2.addItemListener(this);
lblPlayer3 = new JCheckBox("None");
lblPlayer3.addItemListener(this);
lblPlayer4 = new JCheckBox("None");
lblPlayer4.addItemListener(this);
lblPlayer5 = new JCheckBox("None");
lblPlayer5.addItemListener(this);
lblPlayer6 = new JCheckBox("None");
lblPlayer6.addItemListener(this);
lstResults = new JList(varResults);
pnlPlayers.add(lblPlayers);
pnlPlayers.add(lblPlayer1);
pnlPlayers.add(lblPlayer2);
pnlPlayers.add(lblPlayer3);
pnlPlayers.add(lblPlayer4);
pnlPlayers.add(lblPlayer5);
pnlPlayers.add(lblPlayer6);
pnlSlider.add(slrSpeed);
pnlSlider.add(btnStart);
pnlSlider.add(btnStop);
pnlEast.add(BorderLayout.CENTER, lstResults);
pnlCenter.add(BorderLayout.SOUTH, pnlSlider);
pnlCenter.add(BorderLayout.CENTER, canvas);
lblTitle = new JLabel("LONGGONG DICE GAME SIMULATION");
pnlTitle.add(lblTitle);
getContentPane().add(BorderLayout.NORTH,pnlTitle);
getContentPane().add(BorderLayout.WEST,pnlPlayers);
getContentPane().add(BorderLayout.EAST,pnlEast);
getContentPane().add(BorderLayout.CENTER, pnlCenter);
getContentPane().add(BorderLayout.SOUTH,pnlSouth);
setResizable(false);
canvas.start();
show();
//name change when player is selected
public void itemStateChanged(ItemEvent e) {
Object source = e.getItemSelectable();
int choice;
if (source == lblPlayer1) {
if (lblPlayer1.isSelected()) {
frmChoices fchoices = new frmChoices(lblPlayer1);
if (source == lblPlayer2) {
if (lblPlayer2.isSelected()) {
frmChoices fchoices = new frmChoices(lblPlayer2);
if (source == lblPlayer3) {
if (lblPlayer3.isSelected()) {
frmChoices fchoices = new frmChoices(lblPlayer3);
if (source == lblPlayer4) {
if (lblPlayer4.isSelected()) {
frmChoices fchoices = new frmChoices(lblPlayer4);
if (source == lblPlayer5) {
if (lblPlayer5.isSelected()) {
frmChoices fchoices = new frmChoices(lblPlayer5);
if (source == lblPlayer6) {
if (lblPlayer6.isSelected()) {
frmChoices fchoices = new frmChoices(lblPlayer6);
// if (e.getStateChange() == ItemEvent.DESELECTED)
//...make a note of it...
//slider speed change
public void stateChanged(ChangeEvent e){
canvas.speed(slrSpeed.getValue());
public void actionPerformed (ActionEvent e){
if (e.getActionCommand().equals ("Exit")){
System.exit (0);
//connects to frmNew
if (e.getActionCommand().equals ("New Game")){
frmNew n = new frmNew(this);
lblPlayer1.setText("None");
lblPlayer2.setText("None");
lblPlayer3.setText("None");
lblPlayer4.setText("None");
lblPlayer5.setText("None");
lblPlayer6.setText("None");
isNew = true;
lblPlayer1.setSelected(false);
lblPlayer2.setSelected(false);
lblPlayer3.setSelected(false);
lblPlayer4.setSelected(false);
lblPlayer5.setSelected(false);
lblPlayer6.setSelected(false);
if (e.getActionCommand().equals ("Start")){
slrSpeed.setEnabled(true);
canvas.setRandomDicePosition();
if (e.getActionCommand().equals ("Stop")){
slrSpeed.setValue(0);
slrSpeed.setEnabled(false);
//ADDED
if (e.getActionCommand().equals ("New Game")){
frmNew n = new frmNew(this);
if (e.getActionCommand().equals ("Zoom In")){
canvas.zoomIn();
if (e.getActionCommand().equals ("Zoom Out")){
canvas.zoomOut();
if (e.getActionCommand().equals ("How To Play")){
frmPlay p = new frmPlay();
if (e.getActionCommand().equals ("About")){
frmAbout a = new frmAbout();
package longgong;
// Java classes
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
// GL4Java classes
import gl4java.GLContext;
import gl4java.awt.GLAnimCanvas;
import gl4java.utils.textures.*;
class MyCanvas extends GLAnimCanvas implements KeyListener, MouseListener
// holds information on which keys are held down.
boolean[] keys=new boolean[256];
float xrot; // X Rotation ( NEW )
float yrot; // Y Rotation ( NEW )
float zrot; // Z Rotation ( NEW )
float[] diceRotX = new float[3];
float[] diceRotY = new float[3];
float[] diceRotZ = new float[3];
float[] diceTranX = new float[3];
float[] diceTranY = new float[3];
float[] diceTranZ = new float[3];
float speedValue;
Dice[] D;
float zoom = -15.0f;
public MyCanvas(int w, int h)
super(w, h);
//Registers this canvas to process keyboard events, and Mouse events
addKeyListener(this);
addMouseListener(this);
setAnimateFps(60); // seemed to be essential in getting any performance
speedValue=0.0f;
diceTranX[0] = -2.0f;
diceTranY[0] = 2.0f;
diceTranZ[0] = zoom;
diceTranX[1] = 2.0f;
diceTranY[1] = 1.0f;
diceTranZ[1] = zoom;
diceTranX[2] = 0.0f;
diceTranY[2] = -2.0f;
diceTranZ[2] = zoom;
public void zoomIn(){
zoom=zoom+1.0f;
public void zoomOut(){
zoom=zoom-1.0f;
public void speed(float s){
speedValue=s/100;
/** void reshape(int width, int height) Called after the first paint command. */
public void reshape(int width, int height)
if(height==0)height=1;
gl.glViewport(0, 0, width, height); // Reset The Current Viewport And Perspective Transformation
gl.glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
gl.glLoadIdentity(); // Reset The Projection Matrix
glu.gluPerspective(45.0f, width / height, 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window
gl.glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
gl.glLoadIdentity(); // Reset The ModalView Matrix
/** void preInit() Called just BEFORE the GL-Context is created. */
public void preInit()
{ doubleBuffer = true; stereoView = false; // buffering but not stereoview
public void setRandomDicePosition(){
for (int i=0; i<3; i++){
D.setCoordinates(diceRotX[i],diceRotY[i],diceRotZ[i],diceTranX[i],diceTranY[i],diceTranZ[i]);
D[i].getRandomDice();
/** void init() Called just AFTER the GL-Context is created. */
public void init()
//float width = (float)getSize().width;
//float height = (float)getSize().height;
D = new Dice[5];
D[0] = new Dice(this);
D[1] = new Dice(this);
D[2] = new Dice(this);
//initialize dice location
for (int i=0; i<3; i++){
D[i].setCoordinates(diceRotX[i],diceRotY[i],diceRotZ[i],diceTranX[i],diceTranY[i],diceTranZ[i]);
D[i].getRandomDice();
gl.glEnable(GL_TEXTURE_2D); //Enable Texture Mapping ( NEW )
gl.glShadeModel(GL_SMOOTH); //Enables Smooth Color Shading
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //This Will Clear The Background Color To Black
gl.glClearDepth(1.0); //Enables Clearing Of The Depth Buffer
gl.glEnable(GL_DEPTH_TEST); //Enables Depth Testing
gl.glDepthFunc(GL_LEQUAL); //The Type Of Depth Test To Do
gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Really Nice Perspective Calculations
public void DrawBoundaries(){
double x,y;
double radius = 5.0f;
gl.glLoadIdentity(); // Reset The View
gl.glTranslatef(0.0f,0.0f,zoom-1.0f);
gl.glRotatef(90.0f,0.0f,0.0f,1.0f);
gl.glColor3f(0.6f,0.3f,0.3f);
gl.glBegin(gl.GL_POLYGON);
// angle is
// x = radius * (cosine of angle)
// y = radius * (sine of angle)
for (double a=0; a<360; a++) {
x = radius * (Math.cos(a));
y = radius * (Math.sin(a));
gl.glVertex3d(x, y, 0.0f);
gl.glEnd();
gl.glColor3f(1.0f,1.0f,1.0f);
public void DrawGLScene()
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
DrawBoundaries();
for (int i=0; i<3; i++){
D[i].startDiceMovement();
D[i].setTz(zoom);
D[i].setSpeed(speedValue);
D[i].drawDice();
for (int i=0; i<3; i++){
//start of loop
if(i!=0){
if (D[0].getMoveLeft()==true){
if ( (D[0].getTx()>=D[i].getTx()-1.0f) && (D[0].getTx()<=D[i].getTx()) ){
if (D[0].getMoveLeft()== true) D[0].setMoveLeft(false);
else D[0].setMoveLeft(true);
}else{
if ( (D[0].getTx()-1<=D[i].getTx()) && (D[0].getTx()-1>=D[i].getTx()-1) ){
if (D[0].getMoveLeft()== true) D[0].setMoveLeft(false);
else D[0].setMoveLeft(true);
if (D[0].getMoveUp()==true){
if ( (D[0].getTy()>=D[i].getTy()-1.0f) && (D[0].getTy()<=D[i].getTy()) ){
if (D[0].getMoveUp()== true) D[0].setMoveUp(false);
else D[0].setMoveUp(true);
}else{
if ( (D[0].getTy()-1<=D[i].getTy()) && (D[0].getTy()-1>=D[i].getTy()-1) ){
if (D[0].getMoveUp()== true) D[0].setMoveUp(false);
else D[0].setMoveUp(true);
}//end of if i!=0
if(i!=1){
if (D[1].getMoveLeft()==true){
if ( (D[1].getTx()>=D[i].getTx()-1.0f) && (D[1].getTx()<=D[i].getTx()) ){
if (D[1].getMoveLeft()== true) D[1].setMoveLeft(false);
else D[1].setMoveLeft(true);
}else{
if ( (D[1].getTx()-1<=D[i].getTx()) && (D[1].getTx()-1>=D[i].getTx()-1) ){
if (D[1].getMoveLeft()== true) D[1].setMoveLeft(false);
else D[1].setMoveLeft(true);
if (D[1].getMoveUp()==true){
if ( (D[1].getTy()>=D[i].getTy()-1.0f) && (D[1].getTy()<=D[i].getTy()) ){
if (D[1].getMoveUp()== true) D[1].setMoveUp(false);
else D[1].setMoveUp(true);
}else{
if ( (D[1].getTy()-1<=D[i].getTy()) && (D[1].getTy()-1>=D[i].getTy()-1) ){
if (D[1].getMoveUp()== true) D[1].setMoveUp(false);
else D[1].setMoveUp(true);
}//end of if i!=1
if(i!=2){
if (D[2].getMoveLeft()==true){
if ( (D[2].getTx()>=D[i].getTx()-1.0f) && (D[2].getTx()<=D[i].getTx()) ){
if (D[2].getMoveLeft()== true) D[2].setMoveLeft(false);
else D[2].setMoveLeft(true);
}else{
if ( (D[2].getTx()-1<=D[i].getTx()) && (D[2].getTx()-1>=D[i].getTx()-1) ){
if (D[2].getMoveLeft()== true) D[2].setMoveLeft(false);
else D[2].setMoveLeft(true);
if (D[2].getMoveUp()==true){
if ( (D[2].getTy()>=D[i].getTy()-1.0f) && (D[2].getTy()<=D[i].getTy()) ){
if (D[2].getMoveUp()== true) D[2].setMoveUp(false);
else D[2].setMoveUp(true);
}else{
if ( (D[2].getTy()-1<=D[i].getTy()) && (D[2].getTy()-1>=D[i].getTy()-1) ){
if (D[2].getMoveUp()== true) D[2].setMoveUp(false);
else D[2].setMoveUp(true);
}//end of if i!=2
//end of loop for i
/** void display() Draw to the canvas. */
// Purely a Java thing. Simple calls DrawGLScene once GL is Initialized
public void display()
for(int i=0;i<3;i++){
glj.gljMakeCurrent(); //Ensure GL is initialised correctly
DrawGLScene();
glj.gljSwap(); //Swap buffers
glj.gljFree(); // release GL
// Key Listener events
public void keyTyped(KeyEvent e){
public void keyPressed(KeyEvent e){
switch(e.getKeyCode())
//Kill app
case KeyEvent.VK_ESCAPE:
System.exit(0);
break;
default :
if(e.getKeyCode()<250) // only interested in first 250 key codes, are there more?
keys[e.getKeyCode()]=true;
break;
public void keyReleased(KeyEvent e){
if(e.getKeyCode()<250) // only interested in first 250 key codes, are there more?
keys[e.getKeyCode()]=false;
// mouse listener events
public void mouseEntered( MouseEvent evt )
Component comp = evt.getComponent();
if( comp.equals(this ) )
//requestFocus();
public void mouseExited( MouseEvent evt ){
public void mousePressed( MouseEvent evt ){
public void mouseReleased( MouseEvent evt ){
public void mouseClicked( MouseEvent evt )
Component comp = evt.getComponent();
if( comp.equals(this ) )
requestFocus();
* Dice.java
* Created on 08 February 2007, 22:26
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package longgong;
import java.net.URL;
import gl4java.GLContext;
import gl4java.awt.GLAnimCanvas;
import gl4java.utils.textures.*;
* @author welcome
public class Dice {
GLAnimCanvas glCanvas ;
URL codeBase;
int[]texture1 = new int[1]; //Storage for one texture ( NEW )
int[]texture2 = new int[1]; //Storage for one texture ( NEW )
int[]texture3 = new int[1]; //Storage for one texture ( NEW )
int[]texture4 = new int[1]; //Storage for one texture ( NEW )
int[]texture5 = new int[1]; //Storage for one texture ( NEW )
int[]texture6 = new int[1]; //Storage for one texture ( NEW )
float rx;
float ry;
float rz;
float tx;
float ty;
float tz;
float speed;
boolean txMoveLeft;
boolean tyMoveUp;
boolean tzMoveFront;
/** Creates a new instance of Dice */
public Dice(GLAnimCanvas g) {
glCanvas = g;
if(!LoadGLTexture("c:\\java\\images\\one.png",texture1)){
System.out.println("Failed to load Textures,Bailing!");
System.exit(0);
if(!LoadGLTexture("c:\\java\\images\\two.png",texture2)){
System.out.println("Failed to load Textures,Bailing!");
System.exit(0);
if(!LoadGLTexture("c:\\java\\images\\three.png",texture3)){
System.out.println("Failed to load Textures,Bailing!");
System.exit(0);
if(!LoadGLTexture("c:\\java\\images\\four.png",texture4)){
System.out.println("Failed to load Textures,Bailing!");
System.exit(0);
if(!LoadGLTexture("c:\\java\\images\\five.png",texture5)){
System.out.println("Failed to load Textures,Bailing!");
System.exit(0);
if(!LoadGLTexture("c:\\java\\images\\six.png",texture6)){
System.out.println("Failed to load Textures,Bailing!");
System.exit(0);
txMoveLeft = true;
tyMoveUp = true;
public boolean inCircleBoundaries(float x, float y, float radius)
float r;
r = (float)Math.sqrt((x*x) + (y*y));
if (r <= radius)
return true;
else
return false;
public void setCoordinates(float corRx,float corRy,float corRz,float corTx,float corTy,float corTz){
rx = corRx;
ry = corRy;
rz = corRz;
tx = corTx;
ty = corTy;
tz = corTz;
public void getRandomDice(){
int num = (int)(Math.random() * 6);
if (num==1){
rx=0.0f;
ry=0.0f;
rz=0.0f;
else if (num==2){
rx=90.0f;
ry=0.0f;
rz=0.0f;
else if (num==3){
rx=0.0f;
ry=-90.0f;
rz=0.0f;
else if (num==4){
rx=0.0f;
ry=90.0f;
rz=0.0f;
else if (num==5){
rx=-90.0f;
ry=0.0f;
rz=0.0f;
else{
rx=180.0f;
ry=0.0f;
rz=0.0f;
public float getTx(){
return tx+0.5f;
public float getTy(){
return ty+0.5f;
public float getTz(){
return tz+0.5f;
public void setTz(float z){
tz=z;
public boolean getMoveLeft(){
return txMoveLeft;
public boolean getMoveUp(){
return tyMoveUp;
public void setMoveLeft(boolean m){
txMoveLeft = m;
public void setMoveUp(boolean m){
tyMoveUp = m;
public void startDiceMovement(){
if (txMoveLeft==true) {
tx+=speed;
else {
tx-=speed;
if (tyMoveUp==true) {
ty+=speed;
else {
ty-=speed;
ry+=(speed*4);
rx+=(speed*4);
//rz+=(speed*2);
//tx+=speed;
//ty+=speed;
//tz+=speed;
if (inCircleBoundaries(tx,ty,3.5f)==false) {
if (tx>=3.0f) txMoveLeft = false;
if (tx<=-3.0f) txMoveLeft = true;
if (ty>=3.0f) tyMoveUp = false;
if (ty<=-3.0f) tyMoveUp = true;
public void setSpeed(float s){
speed = s;
public void drawDice(){
glCanvas.gl.glLoadIdentity(); // Reset The View
glCanvas.gl.glTranslatef(tx,ty,tz);
glCanvas.gl.glRotatef(rx,1.0f,0.0f,0.0f);
glCanvas.gl.glRotatef(ry,0.0f,1.0f,0.0f);
glCanvas.gl.glRotatef(rz,0.0f,0.0f,1.0f);
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture1[0]);
glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);
// Front Face
glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, 1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, 1.0f, 1.0f);
glCanvas.gl.glEnd();
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture6[0]);
glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);
// Back Face
glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, 1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, 1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
glCanvas.gl.glEnd();
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture2[0]);
glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);
// Top Face
glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, 1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, 1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, 1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, 1.0f, -1.0f);
glCanvas.gl.glEnd();
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture5[0]);
glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);
// Bottom Face
glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, 1.0f);
glCanvas.gl.glEnd();
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture3[0]);
glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);
// Right face
glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, 1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, 1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, 1.0f);
glCanvas.gl.glEnd();
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture4[0]);
glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);
// Left Face
glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, 1.0f, 1.0f);
glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, 1.0f, -1.0f);
glCanvas.gl.glEnd();
public boolean LoadGLTexture(String fileName, int textureNumber[])
PngTextureLoader texLoader = new PngTextureLoader(glCanvas.gl, glCanvas.glu);
if(codeBase!=null)
texLoader.readTexture(codeBase, fileName);
else
texLoader.readTexture(fileName);
if(texLoader.isOk())
//Create Texture
glCanvas.gl.glGenTextures(1, textureNumber);
glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, textureNumber[0]);
glCanvas.gl.glTexParameteri(glCanvas.gl.ill attach 4 files that needs to be
enhanced or debug for possible errors. i hate to break it to you, but even if you post this for the seventh time, finding and fixing errors in your code remains your task. -
Need Help in trying to understand class objects
I need help on understanding following problem.I have two files for that, which are as follows:
first file
public class Matrix extends Object {
private int matrixData[][]; // integer array to store integer data
private int rowMatrix; // number of rows
private int colMatrix; // number of columns
public Matrix( int m, int n )
{ /*Constructor: initializes rowMatrix and colMatrix,
and creates a double subscripted integer array matrix
of rowMatrix rows and colMatrixm columns. */
rowMatrix = m;
colMatrix = n;
matrixData = new int[rowMatrix][colMatrix];
public Matrix( int data[][] )
{ /* Constructor: creates a double subscripted integer array
and initilizes the array using values of data[][] array. */
rowMatrix = data.length;
colMatrix = data[0].length;
matrixData = new int [rowMatrix][colMatrix];
for(int i=0; i<rowMatrix; i++)
for(int j=0; j<colMatrix; j++)
matrixData[i][j] = data[i][j];
public int getElement( int i, int j)
{ /* returns the element at the ith row and jth column of
this matrix. */
return matrixData[i][j];
public boolean setElement( int x, int i, int j)
{ /* sets to x the element at the ith row and jth column
of this matrix; this method should also check the
consistency of i and j (i.e., if i and j are in the range
required for subscripts; only in this situation the operation
can succeed); the method should return true if the operation
succeeds, and should return false otherwise.
for(i=0;i<rowMatrix;i++){
for(j=0;j<colMatrix;j++){
x = matrixData[i][j];
if(i<rowMatrix && j<colMatrix){
return true;
else{
return false;
public Matrix transposeMatrix( )
{ /*returns a reference to an object of the class Matrix,
that contains the transpose of this matrix. */
Verify tata;
Matrix trans;
//Matrix var = matrixData[rowMatrix][colMatrix];
for(int row=0;row<rowMatrix;row++){
for(int col=0;col<colMatrix;col++){
matrixData[rowMatrix][colMatrix] = matrixData[colMatrix][rowMatrix];
trans = new Matrix(matrixData);
return trans;
public Matrix multipleMatrix( Matrix m )
/*returns a reference to an object of the class Matrix,
that contains the product of this matrix and matrix m. */
m = new Matrix(matrixData);
//Matrix var = matrixData[rowMatrix][colMatrix];
for(int row=0;row<rowMatrix;row++){
for(int col=0;col<colMatrix;col++){
//trans[row][col] = getElement(row,col);
return m;
public int diffMatrix( Matrix m )
/*returns the sum of the squared element-wise differences
of this matrix and m ( reference to the formula in the description
of assignment 5) */
return 0;
public String toString( )
/* overloads the toString in Object */
String output = " row = " + rowMatrix + " col="+colMatrix + "\n";
for( int i=0; i<rowMatrix; i++)
for( int j=0; j<colMatrix; j++)
output += " " + getElement(i,j) + " ";
output += "\n";
return output;
Second file
public class Verify extends Object {
public static void main( String args[] )
int[][] dataA = {{1,1,1},{2,0,1},{1,2,0},{4,0,0}}; // data of A
int[][] dataB = {{1,2,2,0},{1,0,3,0},{1,0,3,4}}; // data of B
Matrix matrixA = new Matrix(dataA); // matrix A
System.out.println("Matrix A:"+matrixA);
Matrix matrixB = new Matrix(dataB); // matrix B
System.out.println("Matrix B:"+matrixB);
// Calculate the left-hand matrix
Matrix leftFormula = (matrixA.multipleMatrix(matrixB)).transposeMatrix();
System.out.println("Left Side:"+leftFormula);
// Calculate the right-hand matrix
Matrix rightFormula = (matrixB.transposeMatrix()).multipleMatrix(matrixA.transposeMatrix());
System.out.println("Right Side:"+rightFormula);
// Calculate the difference between left-hand matrix and right-hand matrix
// according to the formula in assignment description
double diff = leftFormula.diffMatrix(rightFormula);
if( diff < 1E-6 ) // 1E-6 is a threshold
System.out.println("Formula is TRUE");
else
System.out.println("Formula is FALSE");
}My basic aim is to verify the formula
(A . B)' =B' . A' or {(A*B)tranpose = Btranspose * A transpose}Now My problem is that I have to run the verify class file and verify class file will call the matrix class and its methods when to do certain calculations (for example to find left formula it calls tranposematrix() and multipleMatrix();)
How will I be able to get the matrix which is to be transposed in transposeMatrix method (in Matrix class)becoz in the method call there is no input for transposematrix() and only one input for multipleMatrix(matrix m).
please peeople help me put in this.
thanking in advancePlease don't crosspost.
http://forum.java.sun.com/thread.jspa?threadID=691969
The other one is the crosspost.Okay, whatever. I'm not really concerned with which one is the original. I just view the set of threads overall as being a crosspost, and arbitrarily pick one to point others toward.
But either way
knightofdurham... pick one thread and post only in
the one.Indeed. And indicate such in the other one. -
Need help identifying controller information in hyperdraw
Hello,
Sorry if this is a dumb questions, but I'm in the middle of a project and need help ASAP. In one of my tracks (Real Guitar) there is some form of controller information present at the start of the track and I have no clue what it is! Is there a preference/key command that shows all data in hyperdraw, and then lets you select it (similar to the way the matrix editor works if you double click in the background, and then click on a specific note?)
Thanks in advance for any help you can provide!Jonathan,
I use the method that Jim suggested. I have the "H" key programmed for autodefine. (I've also got another two keys programmed to simply turn hyperdraw on and off for the selected region(s)). Autodefine is very cool. If there are, say, 4 different controllers in the track, hitting H the first time will show you the lowest-numbered controller; hit it again and it shows you the next higher number controller, and so on. The controller number is displayed in the lower LH area of the hyperdraw display for each region.
If a track contains controller information for multiple channels, you'll see two numeric values in the lower LH corner -- the controller number and MIDI channel for that controller, separated by a comma. -
Need help on how a user can control a video clip using their mouse
I need help. I've got a video clip of a rotating 3D
object(left to right) and i would like the user to be able to
control the rotation of the object using their mouse. I've looked
everywhere and i'm at a lost. Can anyone help me
Here is a link to what i'm trying to achieve:
http://www.sun.com/servers/blades/6000/gallery/index.xml?p=1&s=2
I know they use Java but i'm sure this can be done in Flash.
Thanks
RayJust use the plain linear fit!
(If you are discussing something you found in the forum, you should always include a link so we can see what you area talking about. What you probably found was a workaround that forces an intercept of zero for a special scenario. If you want to use general linear fit anyway, your matrix simply also needs a constant term)
If you still have problems, show us your code and some data.
LabVIEW Champion . Do more with less code and in less time . -
I need to create a sparse matrix implementation. Only allocate space for non-zero matrix elements. Implement methods for addition, subtraction, multiplication and determinant. Here is how I want to implement it:
Matrix is an array of linked lists.
Each linked list represents a row.
Each entry in the linked list has a value and a column associated with it.
I need help with the setEntry method and creating the array of linked lists.
Here is what I have so far:
import java.io.*;
import java.util.*;
public class Matrix
private int numberOfRows;
int numberOfColumns;
private IntegerNode[][] entries;
private IntegerNode head = null;
private static BufferedReader stdin = new BufferedReader(
new InputStreamReader( System.in ) );
// Constructor
public Matrix(int numberOfRows, int numberOfColumns)
if (numberOfRows <= 0)
throw new IllegalArgumentException("Cannot construct Matrix with " +
numberOfRows + " rows. Number of rows must be positive.");
if (numberOfColumns <= 0)
throw new IllegalArgumentException("Cannot construct Matrix with " +
numberOfColumns + " columns. Number of columns must be positive.");
entries = new IntegerNode[numberOfRows][numberOfColumns];
this.numberOfRows = numberOfRows;
this.numberOfColumns = numberOfColumns;
public static void main (String [] args) throws IOException {
File myFile1 = getFileName();
Matrix myMatrix1 = Matrix.readMatrixFromFile(myFile1, "Matrix 1");
File myFile2 = getFileName();
Matrix myMatrix2 = Matrix.readMatrixFromFile(myFile2, "Matrix 2");
System.out.println();
System.out.println("Printing out Matrix 1");
System.out.println("---------------------");
myMatrix1.print();
System.out.println("Printing out Matrix 2");
System.out.println("---------------------");
myMatrix2.print();
String myOperation = getAction();
Matrix.performActionOnMatrices(myMatrix1, myMatrix2, myOperation);
public static Matrix readMatrixFromFile(File file, String fname)
throws IOException
BufferedReader reader =
new BufferedReader(new FileReader(file));
// first line should be number of rows followed by number of columns
String line = reader.readLine();
if (line == null)
throw new IOException("File \"" + file + "\" is empty.");
int[] dimensions = readInts(line, 2);
System.out.println("The dimensions of " + fname + " are " + dimensions[0] + " by " +
dimensions[1] + ".");
Matrix matrix = new Matrix(dimensions[0], dimensions[1]);
for (int row = 0; row < dimensions[0]; ++row) {
line = reader.readLine();
if (line == null)
throw new IOException("Matrix in file should have " + dimensions[0] + " rows.");
int[] rowValues = readInts(line, dimensions[1]);
for (int column = 0; column < dimensions[1]; ++column)
matrix.setEntry(row, column, rowValues[column]);
return matrix;
public static String getAction() throws IOException {
System.out.println("What operation would you like to perform on these matrices? (add, subtract, multiply, or determinant) ... ");
String actionToTake = stdin.readLine();
return actionToTake;
public static File getFileName() throws IOException {
System.out.println( "Please enter the full path and name of a file that contains a valid matrix ... " );
String fname = stdin.readLine();
File someFile = new File(fname);
return someFile;
public static void performActionOnMatrices(Matrix matrix1, Matrix matrix2, String action) {
if ((!action.equals("add")) && (!action.equals("subtract")) && (!action.equals("multiply")) && (!action.equals("determinant"))) {
throw new IllegalArgumentException("The only valid actions are add, subtract, multiply or determinant.");
if (action.equals("add")) {
if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform addition on them.");
System.out.println("Performing addition on the two matrices...");
Matrix addMatrix = Matrix.add(matrix1, matrix2);
System.out.println("Here is the sum of the two matrices:");
System.out.println("------------------------------------------");
addMatrix.print();
} else if (action.equals("subtract")) {
if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform subtraction on them.");
System.out.println("Performing subtraction on the two matrices...");
Matrix subtractMatrix = Matrix.subtract(matrix1, matrix2);
System.out.println("Here is the result of the subtraction:");
System.out.println("---------------------------------------------");
subtractMatrix.print();
} else if (action.equals("multiply")) {
if ((matrix1.numberOfRows != matrix2.numberOfRows) || (matrix1.numberOfColumns != matrix2.numberOfColumns)) {
throw new IllegalArgumentException("The matrices must contain the same number of rows and columns in order to perform multiplication on them.");
if (matrix1.numberOfRows != matrix2.numberOfColumns) {
throw new IllegalArgumentException("The number of rows in the first Matrix must equal the number of columns in the second for multiplying.");
System.out.println("Performing multiplication on the two matrices...");
Matrix multMatrix = Matrix.multiply(matrix1, matrix2);
System.out.println("Here is the product of the two matrices:");
System.out.println("------------------------------------------");
multMatrix.print();
} else if (action.equals("determinant")) {
int det1 = matrix1.determinant();
System.out.println("Determinant of Matrix 1");
System.out.println("-----------------------");
System.out.println(det1);
System.out.println();
int det2 = matrix2.determinant();
System.out.println("Determinant of Matrix 2");
System.out.println("-----------------------");
System.out.println(det2);
System.out.println();
// Sets the entry in the matrix at the given row & column to
// the given value.
public void setEntry(int row, int column, int value)
if ((row < 0) || (row >= numberOfRows))
throw new IllegalArgumentException("Illegal row index " + row +
". Index should be between 0 and " + (numberOfRows-1));
if ((column < 0) || (column >= numberOfColumns))
throw new IllegalArgumentException("Illegal column index " + column +
". Index should be between 0 and " + (numberOfColumns-1));
//if (value != 0) {
IntegerNode newNode = new IntegerNode();
newNode.setItem(value);
entries[row][column] = newNode;
// Returns the matrix entry at the given row & column
public IntegerNode getEntry(int row, int column)
if ((row < 0) || (row >= numberOfRows))
throw new IllegalArgumentException("Illegal row index " + row +
". Index should be between 0 and " + (numberOfRows-1));
if ((column < 0) || (column >= numberOfColumns))
throw new IllegalArgumentException("Illegal column index " + column +
". Index should be between 0 and " + (numberOfColumns-1));
return entries[row][column];
// A primitive routine to print the matrix. It doesn't do
// anything smart or nice about spacing.
public void print()
for (int row = 0; row < numberOfRows; ++row)
for (int column = 0; column < numberOfColumns; ++column)
if (getEntry(row,column) != null) {
System.out.print(getEntry(row, column).getItem() + " ");
System.out.println();
System.out.println();
public void linkNodesInEachRow()
int counter;
for (int row = 0; row < numberOfRows; ++row)
counter = 0;
for (int column = 0; column < numberOfColumns; ++column)
if (getEntry(row,column) != null) {
counter++;
if (counter == 1) {
head = new IntegerNode();
head.setItem(getEntry(row, column).getItem());
} else {
//System.out.print("ITEM NUMBER " + counter + " = ");
//System.out.println(getEntry(row, column).getItem() + " ");
System.out.println();
System.out.println();
/*for (IntegerNode curr = head; curr != null; curr = curr.getNext()) {
System.out.println(curr.getItem());
// Returns the determinant of the matrix.
// This method checks that the matrix is square and throws
// an exception if not.
public int determinant()
int determinantValue = 0;
int counter;
int plusminus = 1; // start with positive value
// Make sure the matrix is square before proceeding with
// determinant calculation
if (numberOfRows != numberOfColumns)
// should really create a MatrixException type
throw new IllegalArgumentException(
"Cannot compute determinant of non-square (" + numberOfRows +
" by " + numberOfColumns + ") matrix.");
} else {
// the matrix has the same number of rows and columns
if (numberOfColumns == 1)
// the matrix is 1x1 - the determinant is just it's value
return entries[0][0].getItem();
else if (numberOfColumns == 2)
// the matrix is 2x2 - return ad - bc
return entries[0][0].getItem() * entries[1][1].getItem() - entries[0][1].getItem() * entries[1][0].getItem();
else
// the matrix is larger than 2x2
// loop through the columns in the matrix
for (counter = 0; counter < numberOfColumns; counter++)
determinantValue += plusminus * entries[0][counter].getItem() * minor(0, counter).determinant(); // The determinant is the sum of all the n possible signed products formed from the matrix using each row and each column only once for each product. Notice the recursive call using the submatrix.
plusminus *= -1; // switch the plus/minus sign of the multiplier on each iteration through the loop
return determinantValue;
// returns a matrix representing the minor of the matrix
// for the specified row and column
public Matrix minor(int row, int column)
int rowsA;
int rowsB;
int colsA;
int colsB;
// decrease the size of the resultant matrix by 1 row and 1 column
Matrix smallerMatrix = new Matrix (numberOfRows - 1, numberOfColumns - 1);
// scroll through the rows and columns in the original Matrix
// copy all of the values from the original Matrix except the one row and column that were passed in
for (rowsA=0, rowsB=0; rowsA < numberOfRows; rowsA++)
if (rowsA != row)
for (colsA=0, colsB=0; colsA < numberOfColumns; colsA++)
if (colsA != column)
// the current row and column do not match the row and column we wish to remove
// set the values in the appropriate positions of the sub matrix
smallerMatrix.setEntry(rowsB, colsB, entries[rowsA][colsA].getItem());
colsB++;
rowsB++;
return smallerMatrix;
// Used to parse the row of ints provided in the file input to
// this program. Given a string containing at least numberToRead
// ints, it creates and returns an int array contaning those
// ints.
private static int[] readInts(String someInts, int numberToRead)
StringTokenizer tokenizer = new StringTokenizer(someInts);
if (numberToRead < 0)
throw new IllegalArgumentException("Cannot read " + numberToRead
+ " ints. numberToRead must be nonnegative.");
int[] toReturn = new int[numberToRead];
for (int i = 0; i < numberToRead; ++i)
if (!tokenizer.hasMoreTokens())
throw new IllegalArgumentException("Cannot read " + numberToRead +
" ints from string \"" + someInts + "\".");
String token = tokenizer.nextToken();
toReturn[i] = Integer.parseInt(token);
return toReturn;
public static Matrix add (Matrix a, Matrix b)
Matrix result = new Matrix(a.numberOfRows, a.numberOfColumns);
for(int i = 0; i < a.numberOfRows; i++)
for(int j = 0; j < a.numberOfColumns; j++)
int value = a.getEntry(i, j).getItem() + b.getEntry(i, j).getItem();
result.setEntry(i, j, value);
System.out.println("Addition complete.");
return result;
public static Matrix subtract (Matrix a, Matrix b)
Matrix result = new Matrix(a.numberOfRows, a.numberOfColumns);
for(int i = 0; i < a.numberOfRows; i++)
for(int j = 0; j < a.numberOfColumns; j++)
int value = a.getEntry(i, j).getItem() - b.getEntry(i, j).getItem();
result.setEntry(i, j, value);
System.out.println("Subtraction complete.");
return result;
public static Matrix multiply (Matrix a, Matrix b)
Matrix result = new Matrix(a.numberOfRows, b.numberOfColumns);
int colSum = 0;
for(int i = 0; i < a.numberOfRows; i++)
for(int j = 0; j < b.numberOfColumns; j++)
colSum = 0;
for(int k = 0; k < a.numberOfColumns; k++)
colSum += a.getEntry(i,k).getItem() * b.getEntry(k,j).getItem();
result.setEntry(i, j, colSum);
System.out.println("Multiplication complete.");
return result;
public class IntegerNode {
private int item;
private IntegerNode next;
public void setItem(int newItem) {
item = newItem;
public int getItem() {
return item;
public void setNext(IntegerNode nextNode) {
next = nextNode;
public IntegerNode getNext() {
return next;
}Please help. The code runs just fine. The only thing is I need to link the nodes together (for each row) into a linked list and then put each linked list into an array. I need help with setEntry. The details of creating a node, attaching it to the list representing a row, etc. need to be in setEntry. Please help.
For the following matrix:
1 4 5
4 2 5
2 1 2
There is an array of three linked lists.
LinkedListsArray[0] = Entry(value=1, column=0)->Entry(value=4, column=1)->Entry(value=5, column=2)
LinkedListsArray[1] = Entry(value=4, column=0)->Entry(value=2, column=1)->Entry(value=5, column=2)
LinkedListsArray[2] = .....
Each entry is a node in the linked list.
The last twist is that if any values are zero, they shouldn't have nodes associated with them. Don't allocate nodes for zero valued entries. -
Needs help to know the different versions of forms with their compatibility
Needs help to know the different versions of forms with their compatibility with different databases and operating systems.
Kindly give the details or any suitable link for the same.
please consider it as on urgent basis.
regards,
rajeshRajesh,
the certification matrix is available on metalink.oracle.com. You need a support contract to access this information.
Frank -
ok guys ... I need help!
the proyect I'm working on right now requires me to get the coordinates of the camera (or view ... well you know the stuff that is being displayed). basically I need to know which way the camera is pointing. I am currently using a the standard mouse mover. The thing is this mouse mover doesn't rotate the mmodel itself, but rather the camera around the model. For now I don't need another movement, just this rotational movement around the object. And from this movement I need the coordinates of the camera (view ... whatever)
Thanx in advanced for any help
sincerely Marco Till Brenneruse Viewplatform . getLocalToVworld Transform. This return the tranformation of the Viewplatform. The rotational part is the matrix you are looking for. The translational part tells you the location of the Viewplatform. In Viewplatform coordinates you are looking along the negative z-axis, up is the positive y axis and the positive x axis is to the right. If you move the Viewplatform then the local coordinates are different from the virtual worls coordinates. The above mentioned transformation tells you how to convert the local coordinates into virtual worls coordinates.
-
Help!! matrix problems
Hi, i've got a problem. i need to read in a matrix from a file which consists of a series numbers.
THe program i am trying to write is to do with renting apartments.
an example file looks like this:
0 400 450 510
1 500 560 630
2 625 676 740
3 1000 1250 1600
the first column is the floor number and the following columns represent the cost of an appartment on that floor with certain numbers of bedrooms, always beginning with zero so the four colums in this example are
Floor Zero One Two
e.g an appartment on the ground floor (0) with one bedroom is 450
I need to writ a program which prompts a user for the floor number and the number of rooms. It then needs to return the correct price.
I know how to promt the user so thats not a problem, i just need help with the part with finding the correct price in the matrix.
I think it requires storing the number of colums and rows but i dont know how to do it
Please help
Thank you
Sarah xShe's rich.
Rich ?
How rich?
More than you can imagine.
I can imagine quite a bit.
You'll get it.
I better.
This is one version of many.
import java.io.*;
import java.util.Vector;
public class Napoleon
public static void main(String[] args) throws IOException
FileInputStream stream = new FileInputStream("prices.dat");
InputStreamReader reader = new InputStreamReader(stream);
StreamTokenizer tokens = new StreamTokenizer(reader);
Vector v = new Vector();
while(tokens.nextToken() != tokens.TT_EOF)
v.add(new Integer((int) tokens.nval));
System.out.println(new Integer((int) tokens.nval));
System.out.println("Enter floor number: ");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line1 = in.readLine();
System.out.println("Enter no. rooms: ");
String line2 = in.readLine();
int x = Integer.parseInt(line1);
int y = Integer.parseInt(line2);
int numFloors = v.size()/4;
if(x > 4) System.out.println("Max Floors: 4");
if(y > 3) System.out.println("Max no. rooms: 3");
int dest = (((x-1)*4)+y);
System.out.println("PRICE: " + v.get(dest));
}Now then, send me some duke bling bling. -
K330 Motherboard replaced but need help.
I got the motherboard replaced from the recall. But the problem is the tech did not put in the Model # and serial on the motherboard. Is there any motherboard manuals that might tell me if the specs have been upgraded etc??
From CPU-Z:
DMI BIOS
vendor LENOVO
version DKKT20AUS
date 03/16/2011
DMI System Information
manufacturer LENOVO
product INVALID
version Lenovo Product
serial INVALID
UUID {FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}
DMI Baseboard
vendor LENOVO
model To be filled by O.E.M.
revision To be filled by O.E.M.
serial INVALID
DMI System Enclosure
manufacturer To Be Filled By O.E.M.
chassis type Desktop
chassis serial INVALID
DMI Processor
manufacturer Intel
model Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
clock speed 3400.0 MHz
FSB speed 100.0 MHz
multiplier 34.0x
DMI Port Connector
designation J1A1 (internal)
designation PS2Mouse (external)
port type Mouse Port
connector PS/2
DMI Port Connector
designation J1A1 (internal)
designation Keyboard (external)
port type Keyboard Port
connector PS/2
DMI Port Connector
designation J2A1 (internal)
designation TV Out (external)
connector Mini Centronics Type-14
DMI Port Connector
designation J2A2A (internal)
designation COM A (external)
port type Serial Port 16550A
connector DB-9 male
DMI Port Connector
designation J2A2B (internal)
designation Video (external)
port type Video Port
connector DB-15 female
DMI Port Connector
designation J3A1 (internal)
designation USB1 (external)
port type USB
connector Access Bus (USB)
DMI Port Connector
designation J3A1 (internal)
designation USB2 (external)
port type USB
connector Access Bus (USB)
DMI Port Connector
designation J3A1 (internal)
designation USB3 (external)
port type USB
connector Access Bus (USB)
DMI Port Connector
designation J9A1 - TPM HDR (internal)
DMI Port Connector
designation J9C1 - PCIE DOCKING CONN (internal)
DMI Port Connector
designation J2B3 - CPU FAN (internal)
DMI Port Connector
designation J6C2 - EXT HDMI (internal)
DMI Port Connector
designation J3C1 - GMCH FAN (internal)
DMI Port Connector
designation J1D1 - ITP (internal)
DMI Port Connector
designation J9E2 - MDC INTPSR (internal)
DMI Port Connector
designation J9E4 - MDC INTPSR (internal)
DMI Port Connector
designation J9E3 - LPC HOT DOCKING (internal)
DMI Port Connector
designation J9E1 - SCAN MATRIX (internal)
DMI Port Connector
designation J9G1 - LPC SIDE BAND (internal)
DMI Port Connector
designation J8F1 - UNIFIED (internal)
DMI Port Connector
designation J6F1 - LVDS (internal)
DMI Port Connector
designation J2F1 - LAI FAN (internal)
DMI Port Connector
designation J2G1 - GFX VID (internal)
DMI Port Connector
designation J1G6 - AC JACK (internal)
DMI Extension Slot
designation J6B2
type A5
populated yes
DMI Extension Slot
designation J6B1
type A5
populated no
DMI Extension Slot
designation J6D1
type A5
populated no
DMI Extension Slot
designation J7B1
type A5
populated no
DMI Extension Slot
designation J8B4
type A5
populated no
DMI OEM Strings
string[0] DK20A
DMI Physical Memory Array
location Motherboard
usage System Memory
correction None
max capacity 32768 MBytes
max# of devices 4
DMI Memory Device
designation A1_DIMM0
format DIMM
type unknown
total width 64 bits
data width 64 bits
size 4096 MBytes
DMI Memory Device
designation A1_DIMM1
format DIMM
type unknown
total width 64 bits
data width 64 bits
size 4096 MBytes
DMI Memory Device
designation A1_DIMM2
format DIMM
type unknown
total width 64 bits
data width 64 bits
DMI Memory Device
designation A1_DIMM3
format DIMM
type unknown
total width 64 bits
data width 64 bits
size 4096 MByteshey skimore,
i would suggest to cross reference with your current setup with this >>
http://www.lenovo.com/psref/pdf/icbook.pdf
WW Social Media
Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
Follow @LenovoForums on Twitter!
Have you checked out the Community Knowledgebase yet?!
How to send a private message? --> Check out this article. -
Need help to develop Pythagoras theorem-
Hi i need help to develop proofs 2,3,4
of pythagoras theorems in java as demonstrations
These are applets can anyone help me with it or give me an idea of how to go about developing it -
the site is the following
http://www.uni-koeln.de/ew-fak/Mathe/Projekte/VisuPro/pythagoras/pythagoras.html
then double click on the screen to make it startPardon my ASCII art, but I've always liked the following, simple, geometric proof:
a b
---------------------------------------+
| | |
a| I | II |
| | |
---------------------------------------+
| | |
| | |
| | |
| | |
| | |
b| IV | III |
| | |
| | |
| | |
| | |
| | |
| | |
---------------------------------------+It almost goes without saying that I+II+III+IV == (a+b)^2, and II == IV == a*b,
I == a*a and III == b*b, showing that (a+b)^2 == a^2+a*b+a*b+b^2.
I hope the following sketch makes sense, stand back, ASCII art alert again: a b
---------------------------------------+
| . VI |
| . . |a
| V . |
| +
| |
| . |
b| . |
| |
| IX |
| . |
| . |b
| |
+ |
| . |
a| . . VII |
| VIII . |
---------------------------------------+
a bThe total area equals (a+b)^2 again and equals the sum of the smaller areas:
(a+b)^2 == V+VI+VII+VIII+IX. Let area IX be c^2 for whatever c may be.
V+VII == VI+VIII == a*b, so a^2+b^2+2*ab= c^2+2*a*b; IOW a^2+b^2 == c^2
Given this fundamental result, the others can easily be derived from this one,
or did I answer a question you didn't ask?
kind regards,
Jos
Maybe you are looking for
-
Possible Imminent Hard Drive Failure?
First off I have an Early 2011 MacBook Pro running OSX Mountain Lion. Avast version 7.0 is running as my anti-virus software with current definitions. I'm a network administration student so I run 2 or 3 virtual machines simultaneously to replicate
-
Hello everyone. I downoaded PES 2012 for my iPhone (3GS) the I unlocked it by paying EUR 4.99. Yesterday I upgraded my iPhone with OS5 and restored all apps purchased from iTunes. It works everything except for PES 2012 because was restored the appli
-
Error when running. / runInstaller to install clusterware
I'm trying to install Oracle Clusterware 10.2 as a prerequisite for a new RAC environment, my installation is on oracle linux 5 U 7, but when I try to run ". / RunInstaller" an error occurs, i can not pinpoint the error, and I should correct, please
-
Hi, In textarea component contains 5 lines text. And now, I click at starting of any line except first line (for example let say third line) and press spacebar then I can't see the space at the starting of the line in textarea. Can any one explain an
-
End of flile communication error in IBOT delivered excel file
Hi All, We have scheduled an IBOT which will run 6 days a week. Report( Pivot view ) is pulling 4 weeks of data. I ran the report on Saturday IBOT got delivered and in excel sheet it displays report fine with 4 weeks of data. On Monday IBOT got deliv