Skip to main content

Posts

Image is not displayed on reterival

I have a table with Images stored in it as BLOB. I'm using JPA/Hibernate. So, that Images are mapped to a bean field with type blob. Now my Spring controller is returning entire list of bean (each object of this bean has a blob object) to my jsp. I want to display all the images on that jsp. So, I tried to use some thing like this on my jsp, <c:forEach items="${itemList}" var="item" varStatus="status" > <img src="<c:out value="${item.image}" />"/><br/> /*<img src="${item.image}"/> */ </c:forEach> but that is not working. Instead of getting the list of images displayed on jsp , I 'm getting the class name, when I view the page source I saw something like this <img src="java.object.serilizableBlob@2134"/> Please help me delve with the problem. How can I display all the images on same jsp.

Why is getSize() not working for me here and why the flicker when resizing?

This is my first attempt at using BufferStrategy and I'd really appreciate some hints. 1) Why, in the below code, does getSize() return dimensions of 0 until you have resized the window? How can I detect the size of the window right away? 2) Why when getSize() is returning something is it not the full dimensions of the window? IE why is there a blackless strip to the bottom and right? 3) Is there a way to get rid of the flicker when you resize the window? import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferStrategy; import javax.swing.JFrame; import javax.swing.JPanel; public class BSTest extends JFrame { BufferStrategy bs; DrawPanel panel = new DrawPanel(); public BSTest() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800,420); setLocationRelativeTo(null); setIgnoreRepaint(true); setVisible(true); createBufferStrategy(2); bs = getBufferStrategy(); panel.set

Working with Neo4J REST API

I have several questions? How can i query the node by its property? I see only to query by node id. And how can I get, for example all friends and unconfirmed friends of the node? At the moment I can do that only by querying the all relationships of the node, and iterate over it by checking the property of each relationship. My idea as the following: a node has parameter - id (userID), relationship has properties - directions - FROM_ME or TO_ME, status - CONFIRMED, UNCONFIRMED. All the quries are performed in REST API in Java. How can I do that in the simple way like in SQL, f.e., SELECT friends WHERE friend_id = 1? References to some tutorials with the solutions and techniques of such questions qould be appreciated

inputStream data lost

I am doing simple client-server in Java. This is my client code. try { socket = new Socket(serverIP, serverport); dataStream = new DataOutputStream(new BufferedOutputStream( socket.getOutputStream())); long[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (int i = 0; i < data.length; i++) { dataStream.writeLong(data[i]); System.out.println("So far" + dataStream.size()); } } } catch (IOException e) { e.printStackTrace(); } finally { if (socket != null) try { socket.close(); dataStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } This works fine because I can see that a mount of bytes have been written to the server. Here goes the server code. try { ServerSocket newSocket = new ServerSocket(2503);

Simple Java OpenGL Textures Manager

I'm trying to make a simple textures manager for a 2D tile-based project. What I have is a class that has a hashmap of strings (texture name) and textures. If the name doesn't exist in the hashmap, it uses TextureIO.newTexture(..) to create it and store it into the hashmap. This is the error I get when I try to load a texture: Exception in thread "Timer-0" javax.media.opengl.GLException: java.lang.IllegalArgumentException: Illegally formatted version identifier: "null" at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271) at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410) at javax.media.opengl.GLCanvas.display(GLCanvas.java:244) at com.sun.opengl.util.Animator.display(Animator.java:144) at com.sun.opengl.util.FPSAnimator$1.run(FPSAnimator.java:95) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Caused by: java.lang.IllegalArgumen