Hi everyone,
i'm a newbie in using jasperreports. In my swing application i wanna show jasper viewer inside a jpanel or jframe..! can anyone help me out..?
Thanks in advance...!
I want to change the values on one ComboFieldEditor depending on another ComboFieldEditor in an eclipse plugin. E.g. if the user changes the package, different classes need to be populated in the second ComboFieldEditor. The ComboFieldEditor class does not seem to to have a way to change the items on the fly.
I am using eclipse with the maven 2 plugin.
I want to add the dependency for sqljdbc4, how can I do that?
Can't seem to find it via the 'add dependency' option in eclipse?
How do you determine what jars are needed for such and such feature of a framework? For example, what jars would be needed out of all those available for supporting only dependency injection?
I have a data set with multiple layers of annotation over the underlying text, such as part-of-tags, chunks from a shallow parser, name entities, and others from various natural language processing (NLP) tools. For a sentence like The man went to the store, the annotations might look like:
Word POS Chunk NER
==== === ===== ========
The DT NP Person
man NN NP Person
went VBD VP -
to TO PP -
the DT NP Location
store NN NP Location
I'd like to index a bunch of documents with annotations like these using Lucene and then perform searches across the different layers. An example of a simple query would be to retrieve all documents where Washington is tagged as a person. While I'm not absolutely committed to the notation, syntactically end-users might enter the query as follows:
Query: Word=Washington,NER=Person
I'd also like to do more complex queries involving the sequential order of annotations across different layers, e.g. find all the documents where there's a word tagged person followed by the words arrived at followed by a word tagged location. Such a query might look like:
Query: "NER=Person Word=arrived Word=at NER=Location"
What's a good way to go about approaching this with Lucene? Is there anyway to index and search over document fields that contain structured tokens?
Hi,
I would like to know how to start and code a thread manager for my Android App.
My app is going to fill a list with a network I/O and I have to manage threads for that.
I never done this before and I don't know where to start. I heard about Thread Pool and other stuff, but I'm quite confused. Could someone please help me make my way through ?
Thanks
Hello guys, this is my first post and im still a beginner in the programming world so bare with me. I just created an array with 100 initialized values and i want to print out 10 elements on each line
so it would be somthing like this
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16
...26
this is the code i used and i managed to do it for the first 10 elements but i couldnt figure out how to do it for the rest
public static void main(String[] args) {
int[] numbers = { 0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
int i, count = 0;
for (i = 0; i < numbers.length; i++) {
System.out.print(numbers[i] + " ");
count++;
if (count == 9)
for (i = 9; i < numbers.length; i++)
System.out.println(numbers[i] + " ");
}
}
thanks!
Hi,
I was doing my academic project and while building and testing i have put many println() statements.
But when I had to submit all prints should not be displayed.
Can i implement something like listener which will be invoked when System.out is tried to be executed and prevents it from displaying.
I dont know how feasible this idea is but just want to know whether its possible or not.
I know i could have used a log file or write into a file but again its just a thought came into my mind if I have to disable SOP how can i do it ..
thanks
I understand that this is highly specific to the concrete application, but I'm just wondering what's the general opinion, or at least some personal experiences on the issue.
I have an aversion towards the 'open session in view' pattern, so to avoid it, I'm thinking about simply fetching everything small eagerly, and using queries in the service layer to fetch larger stuff.
Has anyone used this and regretted it? And is there maybe some elegant solution to lazy loading in the view layer that I'm not aware of?
I am using javax.validation.Validator and relevant classes for annotation based validation.
Configuration<?> configuration = Validation.byDefaultProvider().configure();
ValidatorFactory factory = configuration.buildValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<ValidatableObject>> constraintViolations = validator.validate(o);
for (ConstraintViolation<ValidatableObject> value : constraintViolations) {
List< Class< ? extends ConstraintValidator< ? extends Annotation,?>>> list =
value.getConstraintDescriptor().getConstraintValidatorClasses();
}
I get a compilation error stating:
Type mismatch: cannot convert from List< Class< ? extends ConstraintValidator< capture#4-of ?,? to List< Class< ? extends ConstraintValidator< ? extends Annotation,?
What am I missing?
Hi, I am doing some trial testing awith Amazon ec2 boxes, deploying flex apps running on top of restlet powered webservices. I have this problem - Everytime i deploy the app to the cloud, I'm having to hardcode the IP address of the server into the ActionScript/MXML files (http://72.93.48.39:8080/xxx/abc/) and for certain reasons, i am forced to choose a different IP everytime. and i think its really not the right way to deploy the application.
I would like to know what other people do in such scenarios?
On thinking about it, i thought i could make it pickup values from the HTMLVars of the HTML wrapper. but that again has to be edited everytime again and again.
will it be possible to be able to supply these values : server's ip address, server's port number(in case its not 8080 on some machine) at build time? if so can anyone give me a barbones sample build.xml just as an example?
Hi I have below pseudo code with throws an exception like this
throw new MyException("Bad thing happened","com.stuff.errorCode");
where MyException extends Exception class. So the problem is when I try to get the message from MyException class by calling myEx.getMessage() it returns
???en_US.Bad thing happened???
instead of my original message i.e. Bad thing happened
I have checked that MyException class doesn't overrides Throwable class's getMessage() behavior.
Below is the how the call passes from MyException.getMessage() to Throwable.getMessage()
public MyException(String msg, String sErrorCode){
super(msg);
this.sErrorCode = sErrorCode;
this.iSeverity = 0;
}
which then calls
public Exception(String message) {
super(message);
}
and finally
public Throwable(String message) {
fillInStackTrace();
detailMessage = message;
}
when I do a getMessage on myexception it calls Throwable's getMessage as below
public String getMessage() {
return detailMessage;
}
So ideally it should return the original message as I set when throwing the exception. What's the ???en_US thing ?
According to Tomcat docs:
The maximum size in bytes of the POST
which will be handled by the container
FORM URL parameter parsing. The limit
can be disabled by setting this
attribute to a value less than or
equal to 0. If not specified, this
attribute is set to 2097152 (2
megabytes).
But what's "the container FORM URL parameter parsing"? Any ideas what is the purpose of "maxPostSize"?
Thanks in advance.
For educational purposes I have set up a project layout like so (flat in order to suite eclipse better):
-product
|
|-parent
|-core
|-opt
|-all
Parent contains an aggregate project with core, opt and all. Core implements the mandatory part of the application. Opt is an optional part. All is supposed to combine core with opt, and has these two modules listed as dependencies.
I am now trying to make the following artifacts:
product-core.jar
product-core-src.jar
product-core-with-dependencies.jar
product-opt.jar
product-opt-src.jar
product-opt-with-dependencies.jar
product-all.jar
product-all-src.jar
product-all-with-dependencies.jar
Most of them are fairly straightforward to produce. I do have some problem with the aggregating artifacts though. I have managed to make the product-all-src.jar with a custom assembly descriptor in the 'all' module which downloads the sources for all non-transitive deps, and this works fine. This technique also allows me to make the product-all-with-dependencies.jar.
I however recently found out that you can use the source:aggregate goal in the source plugin to aggregate sources of the entire aggregate project. This is also true for the javadoc plugin, which also aggregates through the usage of the parent project.
So I am torn between my 'all' module approach and ditching the 'all' module and just use the 'parent' module for all aggregation. It feels unclean to have some aggregate artifacts produced in 'parent', and others produced in 'all'. Is there a way of making an 'product-all' jar in the parent project, or to aggregate javadoc in the 'all' project? Or should I just keep both?
Thanks
I am using BitmapFactory.decodeFile to load Bitmaps of images into my application. However, the function returns null on large images (such as those from the camera). The filepath is definitely correct, I just can't figure out why it would return null. I tried supersampling, but it didn't seem to help.
Does anyone have any idea why it would do this or how I could more easily load images taken from the camera into a Bitmap?
Thanks.
I'm working in Swing and I would like to disable the expand (plus [+]) sign on a certain type of nodes.
Not sure how to do it because my nodes aren't leaves and I also cannot use setShowsRootHandles (which is only for the root).
I'm referring to to JTree: suppose i got this structure:
Root
--[+] node1
--[+] node2
when I load this structure i would like not to see the [+] sign on node2 (because it a special type node). But I also would like to expand it by using a special command.
I've overridden isLeaf() (method from DefaultMutableTreeNode) so it would set to to TRUE when i'm in the special type node, but then when I'm trying to expand it, it wouldn't expand because isLeaf() == TRUE...
Hope this will make things more clear.
I'm trying to cache lazy loaded collections with ehcache/hibernate in a Spring project. When I execute a session.get(Parent.class, 123) and browse through the children multiple times a query is executed every time to fetch the children. The parent is only queried the first time and then resolved from the cache.
Probably I'm missing something, but I can't find the solution. Please see the relevant code below.
I'm using Spring (3.2.4.RELEASE) Hibernate(4.2.1.Final) and ehcache(2.6.6)
The parent class:
@Entity
@Table(name = "PARENT")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "all")
public class ServiceSubscriptionGroup implements Serializable {
/** The Id. */
@Id
@Column(name = "ID")
private int id;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "parent")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<Child> children;
public List<Child> getChildren() {
return children;
}
public void setChildren(List<Child> children) {
this.children = children;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Parent that = (Parent) o;
if (id != that.id) return false;
return true;
}
@Override
public int hashCode() {
return id;
}
}
The child class:
@Entity
@Table(name = "CHILD")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "all")
public class Child {
@Id
@Column(name = "ID")
private int id;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "PARENT_ID")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Parent parent;
public int getId() {
return id;
}
public void setId(final int id) {
this.id = id;
}
private Parent getParent(){
return parent;
}
private void setParent(Parent parent) {
this.parent = parent;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Child that = (Child) o;
return id == that.id;
}
@Override
public int hashCode() {
return id;
}
}
The application context:
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>Parent</value>
<value>Child</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<!-- cache settings ehcache-->
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class"> org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.transaction.factory_class"> org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory</prop>
<prop key="hibernate.transaction.jta.platform"> org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform</prop>
</props>
</property>
</bean>
The testcase I'm running:
@Test
public void testGetParentFromCache() {
for (int i = 0; i <3 ; i++ ) {
getEntity();
}
}
private void getEntity() {
Session sess = sessionFactory.openSession()
sess.setCacheMode(CacheMode.NORMAL);
Transaction t = sess.beginTransaction();
Parent p = (Parent) s.get(Parent.class, 123);
Assert.assertNotNull(p);
Assert.assertNotNull(p.getChildren().size());
t.commit();
sess.flush();
sess.clear();
sess.close();
}
In the logging I can see that the first time 2 queries are executed getting the parent and getting the children. Furthermore the logging shows that the child entities as well as the collection are stored in the 2nd level cache. However when reading the collection a query is executed to fetch the children on second and third attempt.
I am writing a tomcat app, and have a need to do authentication within the URL like this:
https://user:[email protected]
Except for the life of me i'm not sure how to set it up or able to find the docs to read up on it, clearly my google skills need work.
Can anyone tell me where i should be looking for this kind of info or where to start?
Cheers
Andy
Is it possible to: set a URI template in the mvc:view-controller element of the *-servlet.xml file or in a controller method and then use/get that path parameter in a jsp?
I understand that using @PathVariable in a controller method will give me access to the path parameter in that controller method. But how can I gain access to the path parameter in the jsp?
For example, is it possible to do something like:
*-servlet.xml file:
<beans...>
<mvc:view-controller path="/home" view-name="home"/>
<mvc:view-controller path="/home/{error}" view-name="home"/>
</beans>
jsp file:
<c:if test="${not empty param['error']}">
<span class="error">You have an error...</span>
</c:if>
I have a message driven bean that throws exception under certain conditions. When it throws an exception the message is not processed and put back on the queue. From what I understand with MQ and WAS (Websphere Application Server) the message should be marked as bad after x number of tries and removed from the queue. This is not happening and the message remains on the queue marked as bad.
What part of the configuration in MQ and/or WAS have I missed to set correct?
(The issue with the MDB throwing exceptions is NOT the point here)
Thanks.
Hi, I have a functioning app and recently have had intermittent
problems writing to the datastore. I did not make any relevant code
changes, however in the last few days my attempts to write to the
datastore sometimes work and sometimes don't.
I am trying to save an object that is in a many to one relationship
with an existing persisted parent. So, the logic works like this:
1) Parent pulled from the datastore
2) Child created / instantiated using constructor
3) Parent.addSingleChild(child); // the "addSingleChild" method
just adds the object argument to the collection of children
4) child.setParent(Parent); // sets the Parent object to the
parent field
I am using transactions as explained in the documentation ending with
"finally {if (tx.isActive()) {tx.rollback(); } }"
When the servlet is called, the parent is called from the datastore
and the child object is created and added to the many to one mapping
to the pre-existing parent.
The child should automatically be persisted, since the parent is
already persistent, and the child is added to the collection of
children that map to the parent. And it worked this way in the
past. However, to be sure, i did add a pm.makePersistent(child).
Doesn't seem to help, still have the intermittent problem.
Any suggestions would be appreciated, and if you need to see the
actual code I can post. Thanks
i'm using spring+tapestry for authenticate webuser. I wonder is there any technique i can force all users that currently login in to logout let say i'm on scenario where the site is 'under maintenance mode'
Hi all,
I am using the PropertySheetView component to visualize and edit the properties of a node. This view should always reflect the most recent properties of the object; if there is a change to the object in another process, I want to somehow refresh the view and see the updated properties.
The best way I was able to do this is something like the following (making use of EventBus library to publish and subscribe to changes in objects):
public DomainObjectWrapperNode(DomainObject obj) {
super (Children.LEAF, Lookups.singleton(obj));
EventBus.subscribe(DomainObject.class, this);
}
public void onEvent(DomainObject event) {
// Do a check to determine if the updated object is the one wrapped by this node;
// if so fire a property sets change
firePropertySetsChange(null, this.getPropertySets());
}
This works, but my place in the scrollpane is lost when the sheet refreshes; it resets the view to the top of the list and I have to scroll back down to where I was before the refresh action.
So my question is, is there a better way to refresh the property sheet view of a node, specifically so my place in the property list is not lost upon refresh?
hi,
I'm using GWT-EXT combobox. My problem is when I render the combobox, it's having as many rows as it has values but all the rows are empty means text is not shown. Here's my code.
Combobox cb = new Combobox();
cb.setForceSelection(true);
cb.setMinChars(1);
cb.setWidth(200);
cb.setStore(store); // Store is perfectly loaded in combobox
cb.setDisplayField("ReportName");
cb.setMode(ComboBox.LOCAL);
cb.setTriggerAction(ALL);
cb.setEmptyText("--Select--");
cb.setLoadingText("Searching...");
cb.setTypeAhead(true);
cb.setSelectOnFocus(true);
All other code is working fine. I'm sure for one thing that this problem is related to one of the functions of Combobox.
Thanks in advance.
I am trying to get dynamically session object in struts2 application.
<s:if test="%{#session['resToken'].bookingType == 1}">
resToken can be get by <s:property value="%{resToken}">..
But I can't write <s:property> within <s:if test="">
its giving me error of double quotes..
org.apache.jasper.JasperException: /WEB-INF/jsp/booking/banquet/guest-Info-View.jsp(150,40) Unterminated <s:if tag