construction

At which phase is managed bean constructed and which constructor is used

两盒软妹~` 提交于 2019-12-23 19:14:06
问题 Consider example of JSF based web-app hello1 from official tutorial with addition constructor in managed bean. The follow index.xhtml facelet <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"> <h:head> <title>Facelets Hello Greeting</title> </h:head> <h:body> <h:form> <h:graphicImage url="#{resource['images:duke.waving.gif']}" alt="Duke waving his hand"/> <h2>Hello hui, my name is Duke. What's yours?</h2> <h:inputText id="username" title="My name is:

C++11 enum class instantiation

只愿长相守 提交于 2019-12-23 12:34:14
问题 I've encountered the following form of enum class variable instantiation and it is compiling without any warning or error under VS2012: UINT32 id; enum class X {apple, pear, orange}; X myX = X(id); Moreover, sending X(id) as an argument to a function expecting X type param compiled as well. I'm not sure if the result is always correct or it's just a strange compiler behavior. However, trying to do X myX(id); instead of the above resulted in compilation error: error C2440: 'initializing' :

Can a java subclass's private final field be initialized before the super constructor completes?

☆樱花仙子☆ 提交于 2019-12-20 03:26:46
问题 I have a pair of classes looking like this; public abstract class Class1 { //... public Class1() { //... function2(); //... } protected abstract void function2(); } public class Class2 implements Class1 { private final OnSomethingListener mOnSomethingListener = new OnSomethingListener() { @Override onSomething() { doThatOtherThing(); } } protected void function2() { //uses mOnSomethingListener //however mOnSomethingListener is null when this function is called from super() //... } public

Prolog; if and (stopping) recursion

旧巷老猫 提交于 2019-12-13 16:26:16
问题 In trying to better understand prolog, lists and recursion as a whole I'm working my way through various simple tasks I've assigned to myself. Among others is removing double entries from a list. I've defined a rule: is_on(Item, [Ah|At]) :- Ah = Item; is_on(Item, At). This checks if 'Item' is on the list X or not. So I thought I could expand this to define a filter_double predicate as well: filter_doubles([Ah|At], Result) :- (not(is_on(Ah, At)) -> Result = [Ah|Result] ; filter_doubles(At,

Programmatic HTMLDocument generation using Java

别来无恙 提交于 2019-12-12 07:47:07
问题 Does anyone know how to generate an HTMLDocument object programmatically in Java without resorting to generating a String externally and then using HTMLEditorKit#read to parse it? Two reasons I ask: Firstly my HTML generation routine needs to be very fast and I assume that parsing a string into an internal model is more costly than directly constructing this model. Secondly, an object-oriented approach would likely result in cleaner code. I should also mention that, for licensing reasons, I

url construction htaccess

扶醉桌前 提交于 2019-12-12 02:17:53
问题 Lets say I have a link to one of my page that looks like: mysite.com/48YSWD96, I need it to look like: mysite.com/?d=48YSWD96. How do I achieve this? Can I achieve this by modifying my htaccess file? which currently looks like this... RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)/$ $1.php RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI

jquery widget, _create or _init

巧了我就是萌 提交于 2019-12-08 17:06:14
问题 Some jquery plugin extend widget use _create method, while others use _init method, can someone explain the differences between the two? Also any guidance on when it is better to extend widget or directly extend jquery.fn? 回答1: The downside to extending widget (as opposed to $.fn) is that you create a dependency on jquery-ui which defines the widget "class". That dependency could be expensive for users of your plugin that don't also use jquery-ui. As far as _create vs _init goes, I'm pretty

./configure--with-boost no such file or directory

試著忘記壹切 提交于 2019-12-08 04:48:38
问题 When I used ./configure the terminal returned: checking for Boost headers version >= 1.41.0... no configure: error: cannot find Boost headers version >= 1.41.0 So i used the command "./configure-with-boost=/usr/include" also but it only returns No such file or directory I have the latest version of Boost headers extracted to /usr/include 回答1: --with-boost=... is a command line options that must be separated with at least one whitespace from the name of the executable and the rest of arguments

Programmatic HTMLDocument generation using Java

老子叫甜甜 提交于 2019-12-03 12:41:50
Does anyone know how to generate an HTMLDocument object programmatically in Java without resorting to generating a String externally and then using HTMLEditorKit#read to parse it? Two reasons I ask: Firstly my HTML generation routine needs to be very fast and I assume that parsing a string into an internal model is more costly than directly constructing this model. Secondly, an object-oriented approach would likely result in cleaner code. I should also mention that, for licensing reasons, I can't resort to using any libraries other than those shipped with the JVM. Thanks, Tom One object

Can a java subclass's private final field be initialized before the super constructor completes?

微笑、不失礼 提交于 2019-12-02 01:00:56
I have a pair of classes looking like this; public abstract class Class1 { //... public Class1() { //... function2(); //... } protected abstract void function2(); } public class Class2 implements Class1 { private final OnSomethingListener mOnSomethingListener = new OnSomethingListener() { @Override onSomething() { doThatOtherThing(); } } protected void function2() { //uses mOnSomethingListener //however mOnSomethingListener is null when this function is called from super() //... } public Class2() { super(); } } I assume the listener is null because I am effectively referencing it from super()