Denis Wen

Ranch Hand
+ Follow
since Nov 11, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Denis Wen

Thanks for the reply. I will read up on the link you've sent me.
His,

just starting my small personal project, which is another SAT words learning app. I have a data structure containing Word that has one or more possible Meaning(s). What would be a proper way of annotating the classes? So far i have



But Hibernate doc says "To map a bidirectional one to many, with the one-to-many side as the owning side, you have to remove the mappedBy element and set the many to one @JoinColumn as insertable and updatable to false. This solution is not optimized and will produce some additional UPDATE statements."

I don't really understand what "owning side of the relationship" implies, but suppose that my Word should be the owning side in the case. Could maybe someone clarify this point and suggest a better mapping that does not "produce additional UPDATE statements".
Also what effect do the the directives "insertable = false, updatable = false" have?
OMG, thanks so much. It works, you saved my day (and career, LOL:)
12 years ago
Hello,

This is basically a repost of my question since i have not been able to find a solution so far http://stackoverflow.com/questions/9588384/placing-jtogglebutton-with-jpanel-within-into-a-jtable-cell

The issue is, that i have a custom button in a table and the click event gets triggered only on the second click in the table cell. If i remove the panel within the custom button it works as intended (i need this panel though). I tried using JLayeredPane instead but faced the same issue that only on second click does the button get clicked. Any suggestions how to have the click event propagated immediately to the button?


Below is a sample code.

Many thanks.
12 years ago
Hello,

I must admit posting the same question on stackoverflow.com ;) I guess these are the best places to ask for assistance in it.

I am looking for a better architecture and design choice for the new task I got assigned to. It is basically a type of display board (similar to what you see in airports or stock exchanges but for another purpose) that needs to be programmed. It should have many text items, price tags, and buttons for selection. The whole thing should run in a browser and reflect real-time changes (such as frequent updates of prices, and rearrangement of items).

Technology

First choice of technology that comes to mind is GWT that helps to keep traffic low and allows for targeted updates of display areas (since rendering happens on the client side). Based on my experience, there are some cons with this choice however: porting HTML and CSS from static layouts is much more time-consuming in GWT since you only see generated HTML at runtime (UiBinder makes is somewhat more convenient, but the problem at large remains), DevMode is excruciatingly slow under Linux and compiling a permutations for a single deploy can take minutes. Which all contributes to much slower development times than with say JSP or JSF.

Is there some other technology or approach that is very low-key in terms of traffic and is able to display data changing in a real time? We obviously don't want to save the whole new page if some price tag changes its value or position on the display. And faster development times would be a treat

Architecture

What would be an appropriate pattern to adopt for this case. I've tried having an index object that would contain references to other price and item objects. So that if arrangement of price tags changes on the screen, new ones arrive, old ones get updated a new index object is created and sent to the client. The client knows than that the display should be updated and renders it anew. The positive thing is that it gives you many reusable components (price and item object), on the negative side though is that this rerendering of the whole screen, if a new item is added, is becomes CPU intensive as more updates come. There is also no one-to-one correspondence between index object and layout of the page: so if you designer has chosen a table-based layout and there is one empty row between item 1 and item 2 then you cannot map index position of the item object to its position on the owning table without some additional processing.

I am sure there are many similar projects in the wild that cope with the mentioned challenges. Hearing what technologies developers have chosen to deal with it and how it played out will definitely help me with this assignment. Thanks
His again,

There are these new cell-based components introduced in 2.1. I wonder if replacing HTMLPanel with say CellList is a sensible option to improve application performance. As far as I know HTMLPanel is a very good choice as a wrapping component in UiBinder templates since it uses setInnerHTML for static content, but what would be performing better if content is dynamically added to a panel? HTMLPanel or CellList or something else maybe.

Thanks
13 years ago
GWT
His,

I wonder if there a pattern to reduce number of widgets in the mobile app i am developing since they turn out really CPU hungry. I have watched video from Google I/O where it goes that zou should only use widget if it needs to event handler and that task cannot be accomplished by a parent widget.

In my case there is a HTMLPanel which is filled with clickable panels (widgets) as the information comes from the server. I thought to present every clickable component a DivElement and have the parent HTMLPanel take sort out the events, but the add(Widget widget, String id) method of HTMLPanel accepts only widgets and DivElement is not one. So you are forced to create a widget for every clickable panel that comes from the server and add it as a widget to HTMLPanel, unless there is another, better way, to do that?

Thanks
13 years ago
GWT
His,

I realize that my explanation is pretty vague, but along the code snippet it should clear up the question.

There is this method that we use to synchronize access to a map by its key. The key comes from deserializing argument from a remote call of a gwt client. In code:


The thinking behind this is that first you create an object to synchronize a block with intensive processing on. This object is a value of a map to guarantee proper synchronization to guarantee that if two requests with equal but not identical objectToSynchronizeOn come then one of them has wait before the second synchronized block is finished. I am not sure how synchronized keyword operates - does it only stop concurrent thread flow if it wants to obtain lock on the same object (which in case of deserialized requests is not true) or is the fact that two object are equal suffices.

The question is, if i can synchronized on a deserialized object directly without using intermediary map.

Thanks.
His,

I just, wrongly, commitet a file with new formatting (that basically changed every single line indent) in subversion. As a result all line-by-line chageset information that you get in eclipse by selecting team->show annotation is lost.

Does anybody know if there is a way to delete the changeset or somehow else restore the lost annotation history. I believe that reverting to the previous file revision and recommiting it will not do the trick since every line will be annotated with my new changeset again.

many thanks
His,

i am in one pdf gerenaration task, where I would like to programmatically specify names of the pre-defined attribute-sets to be applied to a table-cell.

<xsl:for-each select="current()/choices">
<fo:table-cell xsl:use-attribute-sets="VARIABLE_NAME_TAKEN_FROM_A_REFERENCED_XML">
<fo:block><xsl:value-of select="i18n"/></fo:block>
</fo:table-cell>
</xsl:for-each>

So far have been unable to get it working? Maybe someone could have a suggestion?

Thanks
Or http://www.abbyy.com/finereader_engine/ , which is commercial
I am testing it at the moment, because tesseract did not quite work out for my colored and poor resolution images. yours look better though

Ulf Dittmer wrote:Possibly here: http://code.google.com/p/tesseract-ocr/

14 years ago
I assume you have mistyped closing tag in line
<url-pattern>/Serv1</servlet-class>
?

What does your tomcat error log say?



[quote=Carlos Obregon]I'm not sure I'm following.

Everytime I tried something I shutdown Tomcat first, the I restarted. Is there anything else to do to restart the context/Tomcat?

I did not understand what you said about the web.xml file

As I come to understand the thing is:

Everything that Tomcat will use must be in the directory "webapps"

Inside that directory there must be a directory per app.

Inside each app root directory there must be a WEB-INF directory. Inside it there must be a "classes" directory and under it there must be directories that matches the packages you are using.

Static context that you intent your client to use must be in the root or a directory structure not under WEB-INF.

The web.xml must be in the app root directory.

Right? Is that so for every Tomcat version or it may have changed?

Thanks a lot.[/quote]
14 years ago
but what's about child class overwriting the implementation of the getter? Should the caveat be that only private mutators should be called in the constructor, wait... mutators are public by design... how than to go around this?

Bear Bibeault wrote:Still not buying it. You'll have to put some significant numbers behind your argument. Violating precepts of encapsulation because of a phantom performance concern is the epitome of premature optimization. I find it difficult to believe you can prove that the use of setters will create a demonstrable and perceivable difference in performance.

There may be no arguing that a method call will be more "expensive" than an assignment, but to argue that design decisions should be made based upon such negligible differences is where I differ.

Moreover, setters are mandatory in many environments where the JavaBean pattern must be adhered to for things to work properly.

14 years ago
Ok, I should try that. What's the best way to grayscale an image you would suggest? with ImageIO somehow?

Ulf Dittmer wrote:Having a bit of experience with image processing (though not much with OCR), I would imagine that it's easier to perform OCR on a black-and-white image than on a colored image. If the images you need to work with are essentially bi-colored like the one shown above, converting it to B/W should not be hard to do, and may yield better results.

14 years ago