|
Do you have a real question?
It's time for a new signature.
|
|
|
|
|
'hello corinna' contains a secret message and he needs the codz to find out what it is. Sheesh, do I have to tell you everything?
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
baddddddddddddddddddddddddddddddddddd
|
|
|
|
|
Hello Friends
I am loadina jpeg image to bufferImage by using ImageIO.read(new File("sample.jpg"));
But as size of Image file crosses around 120KB then it doesnt read.
Is there any other way to read large image file Using ImageIO or any other way to load into BufferedImage.
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
yogeshs wrote: But as size of Image file crosses around 120KB then it doesnt read.
120Kb does not seem very large for this type of file. What do you mean exactly when you say "doesn't read"? Do you get an exception, error message, program crash etc? Try and provide some more useful information surrounding the problem, if necessary add some debug code to your program.
It's time for a new signature.
|
|
|
|
|
Hello Sir
When I load then file of size more than 120kb then program crash.
BufferedImage textureImage = ImageIO.read(new File(imageFileName));
int flags = TextureLoader.BY_REFERENCE ;
flags |= TextureLoader.GENERATE_MIPMAP;
TextureLoader textureLoader = new TextureLoader(textureImage, flags);
Texture texture = textureLoader.getTexture();
currentAppearance.setTexture(texture);
Regards
Yogesh
|
|
|
|
|
yogeshs wrote: When I load then file of size more than 120kb then program crash.
Well I tried loading a file that is 791Kb with no problem. As I said earlier you need to identify exactly where it is crashing in order to find out why. Either add some debug code or run it through the debugger until something fails.
It's time for a new signature.
|
|
|
|
|
I'm calling a Java bean from my servlet which brings a database object then this object is supposed to pass to a jsp file showing database contents . This is done by forwarding request Dispatcher. But it does not show any results. i do'nt know whether it is getting any database object or not it does not show any result. Databse is in MySql made in PhpMyAdmin.
|
|
|
|
|
First help yourself.
Put some logging into yor code at each decision point - such as before you send a request to the DB or after the response is retrieved and check what the state of your data is.
When you find some code you think should work but doesn't, post that so we can laugh help you.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Are you receiving any error messages? If so why don't you post them here. Otherwise if you can post the bit of code that is involved maybe someone can spot what the issue is.
|
|
|
|
|
how to extract the data from a .hdf file
|
|
|
|
|
indseelan wrote: how to extract the data from a .hdf file
The usual method is to read the file and then extract the data according to the structure of the file. Take a look at the documentation for .HDF files[^].
It's time for a new signature.
|
|
|
|
|
lets say...
Hashtable ht = new Hashtable <integer, integer="">();
ht.put(1, 1);
//Now i want to increase the value by 1, is there any way doing it better than:
Integer IntNumber = ht.get(1);
IntNumber++;
ht.put(1 ,IntNumber);
|
|
|
|
|
You don't need to call .put on the hashmap to update its objects. You could just get the object and change its value. Just make sure you never assign a new value in the obtained object from the .get method on the Hashmap. So the below will fail:
<br />
Integer myInt = myHashmap.get(new Integer(1));<br />
myInt = new Integer(4);<br />
While something like this will work:
<br />
class MyInt {<br />
private int m_MyInt;<br />
....more code ...<br />
<br />
public void increment( int by ) {<br />
m_MyInt += by;<br />
}<br />
}<br />
<br />
... a lot more code ...<br />
<br />
HashMap myMap = ....
<br />
((MyInt) myMap.get(new Integer(1))).increment(1);<br />
|
|
|
|
|
This isn't really a restriction of Hashtable. If your Hashtable contains a mutable object then you can update that object in situ with no problem, no need to do another put to ht. But, if the object is immutable then you cannot update it. You need to create a new value and put this to ht.
Things are a little more complicated in your case, because you also have autoboxing going on, which means that you are implicitly swapping between an Integer object and an integer primitive at various points in your code, so a new object is being created and will need to be put back into the Hashtable. But basically, it boils down to the fact that Integer is immutable.
|
|
|
|
|
Hi there !
I used bellow code to insert record to MS Access and get record from MS Access.
But i could insert or get correctly UTF8 string ?
Collapse
I have inserted người việt nam but it stored in MS Access like ng??i vi?t nam
Have you got any ideas?
Thanks in advance!
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
public class AccessUtil {
public static String url = "d:/utf-8.mdb";
private static Connection con_access ;
private static Connection getConnection() throws Exception {
Driver d = (Driver)Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
con_access = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + url +";charSet = UTF8");
return con_access;
}
public static Connection getConAccess(){
try
{
if( con_access == null ){
con_access = getConnection();
}
else if( con_access.isClosed() )
{
con_access = getConnection();
}
}catch(Exception e){
e.printStackTrace() ;
}
return con_access ;
}
public static void main(String[] args) {
try {
insertTest( "người việt nam", "người việt nam");
} catch (Exception e) {
e.printStackTrace();
}
}
public static boolean insertTest( String u1, String u2 )throws Exception {
Connection con = null ;
try{
con = AccessUtil.getConAccess() ;
Statement s = con.createStatement();
con.setAutoCommit(false);
String sql = " insert into tbl_test(u1,u2) values(?,?) " ;
PreparedStatement pstm = con.prepareStatement( sql ) ;
pstm.setString(1, u1);
pstm.setString(2, u2);
pstm.execute() ;
con.commit() ;
}
catch( Exception e ){
e.printStackTrace() ;
try{
con.rollback() ;
}
catch( Exception ex ){}
throw new Exception( "DB Excetion :"+e.toString() ) ;
}
finally{
try{
con.close() ;
}catch(Exception ex){} ;
}
return true ;
}
public static boolean getTest( )throws Exception {
Connection con = null ;
try{
con = AccessUtil.getConAccess() ;
Statement s = con.createStatement();
con.setAutoCommit(false);
String sql = " select u1,u2 from tbl_test " ;
PreparedStatement pstm = con.prepareStatement( sql ) ;
ResultSet rs = pstm.executeQuery();
while(rs.next()){
JOptionPane.showMessageDialog(null, rs.getString("u1")+"--"+ rs.getString("u2"));
}
}
catch( Exception e ){
e.printStackTrace() ;
try{
con.rollback() ;
}
catch( Exception ex ){}
throw new Exception( "DB Excetion :"+e.toString() ) ;
}
finally{
try{
con.close() ;
}catch(Exception ex){} ;
}
return true ;
}
}
|
|
|
|
|
|
sharkbc wrote: But i could insert or get correctly UTF8 string ?
The Sun jdbc-odbc bridge does not support UTF-16 which is how MS Access 2003 does unicode.
Possible solutions
- Find a commercial jdbc-odbc bridge that supports it
- Find the commercial MS Access jdbc driver. Far as I know there is only one that does direct versus ODBC implementation.
- Use a different database.
- Encode the data in the database. That of course means it would not be viewable in anything except the java application.
Following bug documents this.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6345277[^]
|
|
|
|
|
|
like this[^]
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
|
Please read the guidelines at the top of this page. Format your message so that it is readable; what you have posted here is far too difficult to read through. You also need to identify which part of your code is failing and what you expect should be happening at that point.
It's time for a new signature.
|
|
|
|
|
hi
iam making a programe for supermarket and i need jave code to use barcode
if u can help me plz send to my mail
max.passion@windowslive.com
and thanks alot
|
|
|
|
|
Oh, yeah. That's going to happen.
L u n a t i c F r i n g e
|
|
|
|
|
Lots of samples on the web if you could learn to use Google.
It's time for a new signature.
|
|
|
|