Hello, Iv been working on a project for a while now in java and i read somewhere that the GCJ can compile java classes into native binaries, after a quick google search it was revealed that this was true. However after reading a number of posts across the web and including here some people stated that the binaries still: 1.Required a java virtual machine to run? why? 2.Could not generate DLL files for windows or .so object files, without needing a java vm again So i guess my question is, is this true? And if so how can something claiming …

Member Avatar
Member Avatar
+0 forum 1

Hi, I was wondering if anyone could help me or point me in the right direction. Iv been developing a source to source compiler for some time, so one language being translated to C++/C. Now the source has been translated i wish to package a windows and linux c++ compiler with my application, preferably as a standalone binary in a local directory rather than a full system install IE. -My application Directory -My application binary.exe -compiler my application will use -Mingw.exe -g++.exe However so far the only compiler i can find binary distributions that dont require me to perform a …

Member Avatar
+0 forum 0

Hi, I have been trying to create a game loop that is paused when a certain key is pressed. This seemed to work ok in Swing but in javafx the loop locks up the UI, even if i create a seperate thread. @FXML public void setPaused(KeyEvent e) { if (e.getCode().compareTo(KeyCode.P) == 0) { //isPaused = !isPaused; Ignored for now drawLoop();//begin draw loop } } //used to create an interactive loop on the canvas public void drawLoop() { while(!isPaused){ redraw(); try{ Thread.sleep(17); }catch(){ } } } public long redraw() { long t = System.currentTimeMillis(); width = getWidth(); height = getHeight(); drawTiles(); …

Member Avatar
Member Avatar
+0 forum 2

Hello, im currently working on a program to split a string based on symbols only, i need to seperate the string around the symbols whilst keeping the symbols as well eg. test_String_123_^; would result in an array containing : [test] [_] [String] [_] [123] [_] [^] However although i have achieved it with this code : exampelstring.split("(?<=\\^)|(?=\\^)|(?<=\\_)|(?=\\_)"); I was wondering if there is a way to achieve this with less code as if i add more symbols then the regex becomes huge have a forward and behind check for each symbol. Is there a way to combine multiple lookaheads and …

Member Avatar
Member Avatar
+0 forum 4

Hello, Iv been trying to compile a simple opengl / wxwidgets program in c++ on linux mint. However when i try to compile with : g++ MyGLCanvas.cpp MyGLCanvas.h openGLProjectApp.cpp openGLProjectApp.h openGLProjectFrm.cpp openGLProjectFrm.h `wx-config --cxxflags --libs --gl-libs -lGL` -o simpleprogram I get an error message : cannot find -lwx_gtk2u_-lGL-2.8 collect2: error: ld returned 1 exit status I have installed mesa and all the standard opengl library's such as libglumesa etc. However still seem to be unable to compile with g++, any advice would be very useful. The library lwx_gtk2U_-lgl is unfindable on any repository site i have been on as well.

Member Avatar
Member Avatar
+0 forum 2

Hello, I was hoping someone can help me, im looking for a way to extend a basic shape class in particular the roundedrectangle2d class and be able to draw it in the same way we could handle an object with a simple call to g.draw(object instance); However im having problems with it not being drawn to the canvas, i only see a gray rectangle for the code below : import java.awt.BasicStroke; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; public class objectView extends JComponent { private static final long serialVersionUID = 1L; public objectView() { } …

Member Avatar
Member Avatar
+0 forum 2

Hello, Iv recently been having trouble with a java project im working on as i need a button to add a sentence to a Swing list box. The problem im having is it uses an observable class and an observer. Fundamentally the list adds the elements to an array in an observable class and the observer is class uses this array and adds them to the list box. The problem im having is it adds twice as many as the number of times you click the button : public void update(Observable o, Object arg) { updatelist(); } public void updatelist() …

Member Avatar
Member Avatar
+0 forum 4

Iv been developing a parser using java, however due to testing on multiple machines i have errors now on one machine i corrected as the machine was using jdk/jre v1.6, and on my newer machine jdk/jre 1.7 The question i have is, what are the implications of using the String in a case statement in v1.7 vs the use of a series of if conditions that i implemented in java 1.6? Will a String casestatement as a finite state machine perform any better or worse than lets say an optimal series of if conditions? Is there any benefit to one …

Member Avatar
Member Avatar
+0 forum 1

hello, Iv recently been working on a compiler, so far i have a fairly decent working lexical analyzer and token scanner. So i can break down the code into a series of tokens and analyze them for correct strucutre. I also understand how to generate x86 instructions. However im lost somewhere in between linking these two. The book i have describes the first and last step but seems to omit how i get from: Have a series of tokens that are correct eg : import java.whatever; Keyword | package Name | seperator | class name | seperator It does not …

Member Avatar
Member Avatar
+0 forum 2

Hello, Iv recently just started using javafx and i am struggling finding a way to access data from a controller class, at the moment i can do it using method.invoke, however it seems like more of a hack than a legitimate clean option of accessing data from a controller class. try { URL location = getClass().getResource("newwindow.fxml"); FXMLLoader fxmlloader = new FXMLLoader(); fxmlloader.setLocation(location); fxmlloader.setBuilderFactory(new JavaFXBuilderFactory()); Parent root = (Parent) fxmlloader.load(location.openStream()); //above defines fxml class from the fxml file Stage stage = new Stage(); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); //above gets stage from fxml file Method m = fxmlloader.getController().getClass().getMethod("getrows"); System.out.println(m.invoke(fxmlloader.getController())); …

Member Avatar
+0 forum 0

hey, Im having a problem adding a javafx Canvas node to the scrollpane node. Im using the **.setcontent(canvas)** method of the scrollpane and there are no syntax errors. The Scrollpane does expand in width (hbar appears longer) but it still looks empty. I know the canvas is working correctly as if i add it directly using **root.getchildren.add(canvas)** it appears no problem. Does javafx have a problem adding the canvas to a scrollpane? If not could anyone provide a very simple example on how to do it. And if so do you know of any alternatives? Javafx 2.2 is the version …

Member Avatar
Member Avatar
+0 forum 1

hello, Iv been trying to write a java program to read an image from a list of images in a file I.E: * File * Filename * Image1 * Filename * Image2 * Filename * Image3 The problem i am having is that the filename's are string objects followed by an image. So i was wondering if anyone could point me in the right direction to read the file i have written. public class imageloader { String name; BufferedImage image; public imageloader(String url) { try { FileInputStream saveFile = new FileInputStream(url); try { ObjectInputStream restore = new ObjectInputStream(saveFile); this.name = …

Member Avatar
Member Avatar
+0 forum 3

Hello, Im looking for a way to construct a scale-able 2d list or something of the sort. What i have so far is an array int [][] mydata = new int[6][4]; The problem is in my editor i wont know how long to make the array as people are going to be able to add and remove elements. Naturally i tried to implement 2 lists but realized right away it was the same as a 2d array. List<Integer> column = new ArrayList<Integer>(); List<Integer> row = new ArrayList<Integer>(); What data type should i use to implement a structure that allows me …

Member Avatar
Member Avatar
+0 forum 1

Hey, Im looking for the cleanest way to scan through a text file and remove symbols only if they meet certain conditions. So far i have been using the Scanner, but it removes them regardless and i was looking for the best way of providing conditions like those for comments remove - //to end of the line or - /*remove until it finds another */ Should i provide these inside lots of if conditions or does scanner provide a neater way to do something like this? or maybe using a case statement? public static String Stripsymbols(String line) { String strippedline=""; …

Member Avatar
Member Avatar
+0 forum 1

Hello i am having problems creating an update query, I have two tables both have an Title column and one table has an ID column. I want to take the ID from the table that has it when the titles of both columns match one of the titles against any of the others for example : ID Title | Title 1 Book1 | Book3 ID 3 2 Book2 | Book2 ID 2 3 Book3 | Book4 ID 4 4 Book4 | Book3 ID would be 3 So when one of the titles in the right table matches any of the …

Member Avatar
Member Avatar
+0 forum 2

Hello, im a beginner at sql and i am struggling at comparing data from one table to another and then copying other data. *I have 2 tables both of which have 2 columns with the same name lets call them tableA and tableB. * tableA has a column id and tableb has a columnid * and i want to insert the item name thats in tableA into the empty column in tableB INSERT INTO tableb (itemname) SELECT tableA.itemName,itemA.ID as a_role,tableB.ID as b_role FROM tableA,tableB WHERE a_role=b_role But this throws me an error saying : #1054 - Unknown column 'a_role' in …

Member Avatar
Member Avatar
+0 forum 9

Hello, iv looked around google and have found it is possible to put an applet into a jframe. The problem i am having is that my applet is to be hosted online, what i want is to take the applet that is online and display it from a swing or awt front end. Can anyone link me or tell me if it is possible to make a jframe download/embed the applet via url into a jframe or generic window?

Member Avatar
Member Avatar
+0 forum 1

Hey, Iv been looking around for a simple way (meaning less than 10 lines) to reverse the order of my bytes in a byte array. At the moment my code is: public byte[] outputarray() { byte b[] = new byte[10]; ByteBuffer buf = ByteBuffer.wrap(b); buf.putLong(output); } The problem is that the array is on the wrong order. So when i save the byte array to the file its contents in binary are in reverse. So anyone know the easiest way or possibly an api way to easily reverse the bytes, i tried flip but it doesent seem to be what …

Member Avatar
Member Avatar
+0 forum 4

Hey, im looking for a way to get a double value to follow the IEEE 754 standard, iv seen a number of librarys for it on java but i had my doubts to whether it was a problem that wasnt solved already with a java standard library. The value i am expecting in hex is : 66 66 66 66 C6 4B 40 or 55.55 in decimal. However using a standard floating point number in java produces the following : double f = 55.55; System.out.print(Double.toHexString(f)); --output-------------------------------- 0x1.bc66666666666p5 Which im pretty sure is either the wrong standard/order for the floating point …

Member Avatar
Member Avatar
+0 forum 2

Hey, iv been looking around for help with a problem with a program i am working on, but i cant find an appropriate category on any forum really. The program is a flash swf compiler. But at the moment i am having problems understand a certain data structure (the abc block) in particular the int_count. The adobe documentation says The value of int_count is the number of entries in the integer array and int_count is a U30, which is an unsigned 30 bit long integer value The variable-length encoding for u30, u32, and s32 uses one to five bytes, depending …

Member Avatar
+0 forum 0

Hey, I was hoping someone can help me convert a piece of php code, im not really sure where to start pack( 'v', $test ); The pack php function above takes in an integer and converts it to an unsigned long. V - unsigned long (always 32 bit, little endian byte order - is the php documentation of the function. But im told java stores as big endian? So any help on how to convert the integer to an unsigned little endian long would be helpful, i assume a simple type cast would convert to a big endian based number …

Member Avatar
Member Avatar
+0 forum 6

Hello, I am hoping someone can help me understand a piece of code i found. Since php is not my primary language, and what i googled returned vague results, i am unsure exactly how a number or integer value can be used directly as a boolean in a while operation. function testfunction( $testparam ) { if( $testparam > 0x3F3F3FFF ) { $testparam &= 0x3F3F3FFF; } do { $testparam >>= 6; }while($testparam); } Basically i need to be able to understand the logic of the while loop here, does it check it testparam is > 0 and evaluate that as true …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am trying to recreate a data type in java used by adobe, it is an unsigned integer 30 bits long or U30 by the specification. Anyway i am having problems understanding the binary output, the definition states: "The variable-length encoding for u30 uses one to five bytes, depending on the magnitude of the value encoded. Each byte contributes its low seven bits to the value. If the high (eighth) bit of a byte is set, then the next byte of the abcFile is also part of the value."- learn.adobe.com/wiki/display/AVM2/4.1+Primitive+data+types In order to understand the output i took a …

Member Avatar
Member Avatar
+0 forum 8

hey, Iv been looking around for an easy way to check if a string matches exactly and not just in a few characters I.E B != "ABC" B == B Frederick != F So only if the entire string matches will my condition be met. currently im using : String[] splitstring = linetoscan.split("[ ]+"); //split entire input by spaces for(int j=0;j<splitstring.length;j++) { if(splitstring[j].contains("F")) { System.out.println("match found"); } } I read that the pattern matcher can be used, but seems a lot of conversion has to be done to compare a string to a pattern of characters? is pattern matcher the …

Member Avatar
Member Avatar
+0 forum 2

Hey, Im trying to extract numbers from a scanner, but im having problems extracting them all. Primarily i need it to * read a text file which contains some text and numbers. * go through the file and locate all numbers * differentiate between numbers contained in bracket (3), and those on their own 3. String[] anArray = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; while(scanfile.hasNext()) { /* add counter up on digits 1-9 on each line * so numbers 1-9 are check on each line */ for(int i =0;i<anArray.length;i++) { if(declarations.hasNext(anArray[i]){ System.out.println("number found"); scanfile.next(); …

Member Avatar
Member Avatar
+0 forum 2

Hey, iv been working on a fairly simple part of my program but it throws a null pointer exception. The error i recieve is : Exception in thread "main" java.lang.NullPointerException at FillStyle.<init>(FillStyle.java:12) at compiler.main(Builder.java:43 The code causing the error is : public FillStyle(int type) { if (type >= 0) { UI8 g = new UI8(type); toutput = toutput.concat(g.ToUI8()); //Line 12 //output is a string that adds a string another string from class UI8 } } The method is being called in main like this : StyleArray ff = new StyleArray(new FillStyle(0)); Reasonably simple, and there is no syntax errors, but …

Member Avatar
Member Avatar
+0 forum 2

Hello, iv been working on generating a swf tag generator for a project. However i am having trouble understanding how certain values are generated. The shape i have defined in flash is 200 pixels wide and 200 pixels in height and placed at X, 20 and Y 20. The problem is this, the output from the program gives negative values according to a decompiler i used : Xmin = -4129, Xmax = -1509 Ymin = -1656, Ymax = 150 (only non negative) The structure of the binary data according to the specification should be : Nbits = 5 bits to …

Member Avatar
Member Avatar
+0 forum 1

Hey, I have a need to define a new type such as int,short etc. I have the class with all the base methods it must perform somewhat equivelant but different from the Integer class, Short class etc. However im not sure whether this is an interface i need to define. Id like to declare something like : newtype f = 1; in the same way an int is declared, but since i only have a class it means i have to do newtype f = new newtype(1); Can anyone link me or anything to how this is done?

Member Avatar
Member Avatar
+0 forum 1

Hello, Iv been trying to work through some issues on binary output recently. But im having problems understanding the conversion process in java when using two's complement. I dont understand why System.out.println(Integer.toBinaryString(-11700)); Prints out 11111111111111111101001001001100. Shoudlnt -11700 only be 15 bits long? When i calculate it by hand and invert the bits to become twos complement it produces : 101001001001100 why does java pad out the binary with 17 bits? Is this because an integer has 32 bits and only trims off non significant 0's?

Member Avatar
Member Avatar
+0 forum 1

Hey, Iv been looking around google for the past few days to find ways to embed python 3.2 into my c++ application. I however want interpeter to be compiled into my application, so i can merely distribute one exe file without relying on the user to install python. However the few websites explaining how to do it seem to only focus setting up the c++ code with #include<python.h> and such. Can anyone **link** me or explain **what libraries/.so/.dll** files i have to link to the compiler etc in order for me to build it into my application please? Do i …

Member Avatar
Member Avatar
+0 forum 1

The End.