How can I get ALL the data from a table of my DB (mySQL) using hibernate, and store the output into List of Objects?
I'll use this List, to populate a JTable.
I am writing an eclipse plugin. How do I get the various images from eclipse library? So I don't have have keep a local set of images for the standard entities, e.g classes, interfaces, junits, etc.
EDIT : I used PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE) from the article : http://www.eclipse.org/articles/Article-Using%20Images%20In%20Eclipse/Using%20Images%20In%20Eclipse.html.
That did not work.
Hi, i am creating and Configuring the Struts for the first time, when I place the following Code in my jsp page
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
I am getting the error when i move the mouse over the 1st Line "Duplicate Prefix "html"
When I move the mouse over the 2nd Line, I am getting as "Duplicate Prefix "html"
Similarly for 3rd and 4th Line,
Can any one tell me why is this error all about
Thanks in advance
I would like to associate 2 entities using hibernate annotations with a custom join clause. The clause is on the usual FK/PK equality, but also where the FK is null. In SQL this would be something like:
join b on a.id = b.a_id or b.a_id is null
From what I have read I should use the @WhereJoinTable annotation on the owner entity, but I'm puzzled about how I specify this condition...especially the first part of it - referring to the joining entity's id.
Does anyone have an example?
To get any code with SoftReference<T> to be fully tested, one must come up with some way to test the 'yup, it's been nulled' case. One might more or less mock this by using a 'for-test' code path to force the reference to be null, but that won't manage the queue exactly as the GC does. I wonder if anyone out can share experience in setting up a repeatable, controlled, environment, in which the GC is, in fact, provoked into collecting and nulling?
I have a nice JAR of some custom FindBugs detectors I'd like to use with the FindBugs Maven plugin. There is a way to do this with the plugin via the <pluginList> configuration parameter, but that only accepts local files, URLs, or resources.
The only way I found for doing so is to somehow copy my JAR to a local file (maybe via the Dependency plugin) and then configure the FindBugs plugin something like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<pluginList>${project.build.directory}/my-detectors.jar</pluginList>
</configuration>
</plugin>
But this is not very flexible. Is there a way to use Maven's dependency management features together with FindBugs' plugins? I'd like to use something like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.lptr.findbugs</groupId>
<artifactId>my-detectors</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
...but this simply overrides the core FindBugs detectors.
I have a small problem about a content returning from servlet to put in table cell.
In javascript I am calling servlet method using post, it returns some content and I have to put it in two different <td> cells. here is my code,
In javascript,
$.post('<%=request.getContextPath()%>/controller/UserLockController',{'userName':userName,'status':status},
function(data)
{
document.getElementById("status_"+userName).innerHTML=data;
document.getElementById("td_"+userName).innerHTML=data;
});
in servlet it writes as,
out.println("<td id=\"status_"+inputParam+"\">Locked</td>");
out.println("<td id=\"td_"+inputParam+"\"><a href=\"#\" class=\"btn btn-sm btn-primary unlockBtn\" id=\"togBtn_"+inputParam+"\" onClick=\"LockAccount('"+inputParam+"','"+status+"')\">UnLock</td>");
Here content is returning but problem is the both <td> return from servlet will fit in single cell of html table. how to solve this please help me.
I just downloaded the android sdk from the adnroid site and followed this tutorial to set it up on netbeans. Everything to seem to have installed fine but whenever i try to run the application this window pops up:
What I am assuming it asking me to choose the emulator, but it is not showing up on the list. Is there a reason why?
What is the best way for an SWT application to clean up resources before application exit? I see two options:
1) Add a DisposeListener to main window (or better, to the Display). Will it get run if an uncaught exception happens?
2) Use a shutdown hook. Any problems to be aware of there which aren't mentioned in Design of the Shutdown Hooks API?
Anyone have a good solution for scraping the HTML source of a page with content (in this case, HTML tables) generated with Javascript?
An embarrassingly simple, though workable solution using Crowbar:
<?php
function get_html($url) // $url must be urlencode(d)
{
$context = stream_context_create(array(
'http' => array('timeout' => 120) // HTTP timeout in seconds
));
$html = substr(file_get_contents('http://127.0.0.1:10000/?url=' . $url . '&delay=3000&view=browser', 0, $context), 730, -32); // substr removes HTML from the Crowbar web service, returning only the $url HTML
return $html;
}
?>
The advantage to using Crowbar is that the tables will be rendered (and accessible) thanks to the headless mozilla-based browser. The problem, of course, is being dependent on on an external web service, especially given that SIMILE seems to undergo regular server maintenance. :(
A pure php solution would be nice, but any functional (and reliable) alternatives would be great.
Hi All,
If I want to use a specific font that I know it is not available in most of the user's computer, is it possoble to embed the font in my web site in some way? I have gone to some web site using special fonts as text, but not as image. I wonder how it works.
Thanks
Mayur
Here's the scenario. I have VO (Value Objects) or DTO objects that are just containers for data. When I take those and split them apart for saving into a DB that (for lots of reasons) doesn't map to the VO's elegantly, I want to test to see if each field is successfully being created in the database and successfully read back in to rebuild the VO.
Is there a way I can test that my tests cover every field in the VO? I had an idea about using reflection to iterate through the fields of the VO's as part of the solution, but maybe you guys have solved the problem before?
I want this test to fail when I add fields in the VO, and don't remember to add checks for it in my tests.
I am working on an app which calls a rest web service. Sometimes the xml responses contain characters which the phone can not display. When displaying these characters, an empty box is displayed instead. I would like to filter out these characters. How can I detect if a character will be able to be displayed on the screen?
Given a Web Service response object for which the Sun JAX-WS Reference Implementation has bindings to generate XML, how can I instruct the Sun JAX-WS RI construct a SOAP message that represents the object? The format of the output message should be identical to that which JAX-WS would generate if it were sending the message as a response to a SOAP request.
Consider the following output from a Tomcat server under Eclipse:
INFO: Initializing Coyote HTTP/1.1 on http-8080
INFO: Initialization processed in 634 ms
INFO: Starting service Catalina
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
SEVERE: Error listenerStart
SEVERE: Context [/MyServlet] startup failed due to previous errors
I would like to figure out what exception caused "Error listenerStart", but Spring seems to be preventing me from finding the error via Eclipse. I'd love to start Catalina manually, but that doesn't seem to do anything.
What's the best way to find the hidden exception? I'm not afraid to use torture methods.
Hi,
We've a Spring JMS message listener container for receiving messages asynchronously. Using DefaultMessageListenerContainer and in sessionTransacted mode. I understand being in sessionTransacted mode means in case of an exception the message will be put back into the queue. But how can I make sure the message won't be deleted from the queue even if the receiver (which is picked the message) crashes or just the machine running it looses power?
At first I thought CLIENT_ACKNOWLEDGE acknowledge mode should save me, but apparently it's not the case, Spring calls .acknowledge() no matter what.
So here's my question, how can I guarantee the delivery? Using a custom MessageListenerContainer? Using a transaction manager?
Hi,
I have a class that implements BeanDefinitionRegistryPostProcessor.
I am trying to add an AnnotationSessionFactoryBean to my Spring Context in either postProcessBeanFactory or postProcessBeanDefinitionRegistry. I need to do this programatically so that I can configure the object at runtime.
I am trying to do:
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry bdr) throws BeansException {
RootBeanDefinition bd = new RootBeanDefinition(
AnnotationSessionFactoryBean.class);
// fails here.. can not cast
AnnotationSessionFactoryBean asfb = (AnnotationSessionFactoryBean)bd;
bdr.registerBeanDefinition("sessionFactory", asfb);
thanks for your help
--updated with solution:
had to do a:
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(AnnotationSessionFactoryBean.class);
bd.getPropertyValues().add("dataSource", dataSource);
bdr.registerBeanDefinition("sessionFactory", bd);
I am using Spring Framework .
While writing coustum SQL queries , i am unable check a parameter of boolean value.
For example this is not working ..
do some SQl cods
The above checking is not working , it is evaluating as equal in both the cases when booleanVariable is true and false .
i tried to replace compareValue ="tree" and "false". As that is a monkey work i do sometimes .
is it possible to check the boolean property in XML like above .
I´m coding a little app that allows the user to draw multiple shapes and then remove or resize them. It´s working perfectly on rectangles and ovals, but I´m having issues with lines.
Here´s a method that I wrote to find if the clicked spot on the screen is part of a specific line:
public boolean containsLocation(int x, int y) {
int m = (getY2() - getY()) / (getX2() - getX());
int b = getY() - (m * getX());
if (y == (m * x) + b) {
return true;
}
return false;
I´m using the famous y = mx + b formula and replacing y and x to find if the clicked spot is part of the line. The problem is when I click on the screen to remove the line, it only works if I click on the very fist coordinate (x,y) where the line starts.
Nothing happens when I click anywhere else along the line.
Can anyone shed a light on what I´m doing wrong?
Thanks a lot.
We are getting frequent out of memory errors in our dev. machines We are running webshpere, eclipse, soap UI and maven in it. Our server gets down due to this "out of memory errors" when we restart our applications in websphere 2/3 times, We already increased the virtual memory setting in wesphere to 1GB.
So what i did was copied the jre we use in eclipse and maven folders so that each of these uses individual jvms. But the performance of websphere is same. 2/3 restarts and out of memory errors.
Is there any may of making eclipse and maven use different jvms other than websphere's?
I am having a sorted list which is rotated and I would like to do a binary search on that list to find the minimum element.
Lets suppose initial list is {1,2,3,4,5,6,7,8}
rotated list can be like {5,6,7,8,1,2,3,4}
Normal binary search doesn't work in this case. Any idea how to do this.
Example Booking Application, which JBoss Seam is shipped with, build into EAR file of about 7 MB. That's pretty much if you consider deploying this package to a remote Jboss server and possibly redeploying it package many times during your regular work.
Lib files like richfaces and jsf-facelet make the lion's share of that EAR size. Why can't we just extract lib files into jboss-web.deployer directory on JBoss 4.2.0 GA server?
Hi,
I am having a web application with an applet which will copy a file packed witht the applet to the client machine.
When I deploy it to webserver and use: InputStream in = getClass().getResourceAsStream("filename") ;
The in.available() always return a size of 8192 bytes for every file I tried, which means the file is corrupted when it is copied to the client computer.
The InputStream is of type HttpInputStream (sun.net.protocol.http.HttpUrlConnection$httpInputStream). But while I test applet in applet viewer, the files are copied fine, with the InputStream returned is of type BufferedInputStream, which has the file's byte sizes. I guess that when getResourceStream in file system the BufferedInputStream will be used and when at http protocol, HttpInputStream will be used.
How will I copy the file completely, is there a size limited for HttpInputStream?
Thanks a lot.
I am considering a design where all fatal exceptions will be handled using a custom UncaughtExceptionHandler in a Swing application. This will include unanticipated RuntimeExceptions but also custom exceptions which are thrown when critical resources are unavailable or otherwise fail (e.g. a settings file not found, or a server communication error). The UncaughtExceptionHandler will do different things depending on the specific custom exception (and one thing for all the unanticipated), but in all cases the application will show the user an error message and exit. The alternative would be to keep the UncaughtExceptionHandler for all unanticipated exceptions, but handle all other fatal scenarios close to their origin.
Is the design I'm considering sound, or should I use the alternative?