Mano Ag

Ranch Hand
+ Follow
since May 17, 2018
Mano likes ...
Java Netbeans IDE
20+ yrs of Development of Telecom Software, recently taken on Web Applications
Mexico
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
13
Received in last 30 days
1
Total given
14
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mano Ag

Congratulations Ahmad!

Oracle has just published the certification path for Java SE 11 if that is of your interest

https://education.oracle.com/oracle-certified-professional-java-se-11-developer/trackp_815
Hello David,

Welcome to the ranch!

From your post I gather that at the moment your application is running ok.

Regarding the first run solution I'd just point out the idea of "Occam's Razor",
which states that "simpler solutions are more likely to be correct than complex
ones".

So, I think, if your application is in the early design iterations, then if it works
it works, regardless if it looks "too simple"
1 week ago

Hello Fred,

I'll try to explain how the view and the backing bean connect in
order to access a property.

If the basics in this post are too basic please mark that as my fault.

The View

An xhtml file is your view. In it you have JSTL (JavaServer Tag
Library) components (from JSP JavaServer Pages), JSF components
(JavaServer Faces) and possibly components from some UI framework
such as PrimeFaces. You can have HTML and CSS as well.

The Backing Bean

a)

Contains the @Named annotation as well as a scope annotation
(if the scope is session, application or conversation then the
class must also implement the Serializable interface). Such a
class is capable of handling CDI (Context and Depencency Injection).
A class with these characteristics is registered as a resource
with the JSF implementation.

b)

Defines the properties and methods that are associated to the
components displayed in one or more views.

A property in this context can be:

- A variable declared in the class as private along with its
 corresponding public getter and setter. Default values can
 be defined in the class constructor

- A property inherited into this class from a parent class

- (If I am not very much mistaken) A property @Inject-ed
 into this class

The Connection

This is where the magic happens. The view and the backing bean
connect when a component attribute accesses a property or method
by means of the EL (Expression Language).

So if you have:

<h:outputText value="#{course.code}"  />

You'd be accessing the code property in the course class
(via the getter)

In the case of:

<h:inputText value="#{course.name}"  />

You'd be accessing the name property in the course class
(via the setter)

This allows you to manipulate course.code and code.name
inside any method in your backing bean.

And that's all there is, with the caveat that attribute names
are misleading as to what they do depending on which component
they appear (yikes!).

Suggested Reading

https://docs.oracle.com/javaee/7/tutorial/

Learning Suggestion

If you have your database schema defined, you can generate the
"CRUD" for your application and check the code.







2 weeks ago
JSF

Hello Deja,

If egoless programming caught your attention then you might find the following
book (not new but still relevant) interesting, in particular Part VII (Software Craftsmanship)

https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670
2 weeks ago
Welcome to the ranch!

Proof of Concept? Yes we have it.

But would you tell us how you would approach it ?
2 weeks ago
Hi,

I think it should not be that difficult.

It may be the simplest question but, do you have a property to connect your view to ?
Once you have that the rest should be easy.

Do you have an explicit or inherited "course"  property in your backing bean?

(by backing bean I mean POJO or Managed Bean or whatever people chooses to call it...
by property I mean a private variable with  its corresponding getter/setter in a class that
uses the @Named and possibly the @ManagedBean and @Serializable annotations)
2 weeks ago
JSF

Hello Peter,

I wonder if the performance to be gained by including conditions for components in your view
is very specific to each view. However, there are a number of component attributes
that work as conditionals, such as "rendered" and "disabled". I don't see any problem with the
ifs either although there is the idea that the view should include a limited amount of
programming.

There is no problem in combining components that have different tags (you will see that all
over the place), as long as the functionality you get is what you want.

These are other things that can help you with the performance thing:

- When using data tables, be sure to determine if lazy loading applies or not
- For any information resulting from a query, be sure to try to optimize the query itself

and lastly:

- Get to know the JSF Lifecycle. Being aware of some of its inner workings will save
a big deal of aggravation...


2 weeks ago
Hi Fred,

Did you try the "Primefaces Showcase" for info? https://www.primefaces.org/showcase/

It might have what you need.
2 weeks ago
JSF
Hello Andrew,

Welcome to the ranch!

Can you post at least a sketch of your code so that your question can be better understood ?

Why does your program use threads?

What does it use them for ?

Why do you need to share information between threads ?
3 weeks ago
Hi,

One thing I see is that your getTime() and getTotalTime() both return the same thing...

Including your main method for people to see can help out for figuring out the issue
3 weeks ago
Hi Glenn,

It might seem a little contrived but it's not if your concepts of
literals and variables are clear.

In your latest post, both instructions have an int literal being assigned to a long variable.

Whenever you use the variable (call it i or x), you have a long variable, even if it contains
a (previously) int value/literal.
3 weeks ago
Hello Glenn,

Welcome to the ranch!

This is quoted from the Java Language Specification (11) in section 3.10.1 :

An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (ยง4.2.1).
The suffix L is preferred, because the letter l (ell) is often hard to distinguish from the digit 1 (one).

3 weeks ago

Junilu Lacar wrote:The secret test is probably one that senses performance issues. I suspect your algorithm is taking too long to execute, given you have basically four nested loops.



#OP Junilu is right. The site says that they sometimes provide some additional info

In some cases, we provide extra information apart from the judgement itself, to help you debug your code. This information is available on the page for the respective submission (available by clicking on the corresponding submission ID in your list of submissions)



https://open.kattis.com/help/judgements#tle

This kattis site seems to be cool...
1 month ago