Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!

Jignesh Gohel

Ranch Hand
+ Follow
since Dec 28, 2004
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jignesh Gohel

Environment : Ruby 1.9.3 / Rails 3.2.1 / Ubuntu 11.10

I am using CarrierWave gem in my application to upload video files. Below is my custom Uploader.

video_file_uploader.rb (uploader)



video.rb (model)


As can be seen above the store_dir points to a path



The directory structure for I have is as follows:



Now I am generating a thumb for the uploaded video at



I need to render this thumb image in my view.For this I used



but it is not getting rendered. In Firebug I can see that the image gets loaded, when I specify the file system's absolute path to the file, while on UI only the thumb image name (alt attribute value) is displayed.

How can I render the images available in a custom directory, like uploads, as shown in the scenario above?

Thanks,
Jignesh
8 years ago
Hi,

I have got this resolved.And posting my solution here for reference:



As per what I understood this is the explanation behind what was causing the problem

Before the AJAX call it's value was was set to true by the following block in source code of jquery.ui.datepicker.js (this block can be found near the end of the file)

Code:



Since the $.datepicker.initialized value was always found "true" after the HTML was updated on the page by DWR, the presentation div referred to by $.datepicker.dpDiv in jquery.ui.datepicker.js source code was not getting appended to the tag when datepicker() was invoked on an element which was causing the datepicker for not getting displayed though the marker class 'hasDatepicker' was getting applied.


Hi,

I have a search form on which I have the following INPUT field



When this search form is accessed I can see the date picker attached to the input#pickUpDate element when I click on it.

I submit this search form using DWR by invoking the search(...) function (shown below).

I reset the HTML body element's data with the response I receive. In the response received, I have a similar search form which contains the same input element (input#pickUpDate).However after I reset the body element's data using



in the DWR callback function and try to attach datepicker it does not work.I inspected that the element is appended the datepicker's "hasDatepicker" marker class name but still on focusing/clicking on the input field I cannot see the datepicker.

Following is my jQuery code :



I have gone through all the relevant posts I could find regarding this but the solutions mentioned in them didn't worked for me.

I am in need to know what is the causing the mentioned problem and how to get this resolved?

My apologies in case this topic does not belong to this forum.I am need of suggestions regarding what all Java technologies or API are available/can be used to handle the below mentioned scenarios.

Following are the applications involved in a proposed system:

MainWebApplication - a web application
ExternalApplication_A - an external application
ExternalApplication_B - an external application
ExternalApplication_C - an external application

MainWebApplication will send request to each of the ExternalApplication(s) (and the request needs to be in the ExternalApplication's desired format) and gather the responses obtained from each of the ExternalApplication(s) and render to the user.

For e.g. ExternalApplication_A exposes an XML API to communicate with it and requires a XML request from MainApplication and will send back a XML response to the MainApplication.Also a constraint is there that ExternalApplication can or cannot be a web-service.

Thanks.
I have com.springsource.javax.validation-1.0.0.GA.jar (JSR 303 framework) and hibernate-validator-4.2.0.Final.jar (Reference Implementation for JSR 303 framework)
available at <LIFERAY_PORTAL_ROOT>/tomcat-6.0.29/webapps/ROOT/WEB-INF/lib.

All the portlet plugins are able to find the implementation class org.hibernate.validator.HibernateValidator
[META-INF/services/javax.validation.spi.ValidationProvider implementation in hibernate-validator-4.2.0.Final.jar]
and the classloader in context is found to be following by JSR 303 validation framework:

WebappClassLoader
context:
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@6c585a


But when kaleo-web plugin deployment is started the classloader changes to com.liferay.portal.spring.util.FilterClassLoader due to
a org.springframework.beans.factory.config.BeanFactoryPostProcessor registered in the spring's application context for kaleo
(<LIFERAY_PORTAL_ROOT>/tomcat-6.0.29/webapps/kaleo-web/WEB-INF/classes/META-INF/base-spring.xml)

The Liferay's implementation of org.springframework.beans.factory.config.BeanFactoryPostProcessor is as below:



And the com.liferay.portal.spring.util.FilterClassLoader is unable to find the implementation for resource META-INF/services/javax.validation.spi.ValidationProvider
which fails the kaleo-web plugin initialization by Spring framework saying "Unable to find a default provider".

Can anybody provide some guidance on how to resolve this or rather how to make the custom classloader com.liferay.portal.spring.util.FilterClassLoader find the required resource
in the server?
9 years ago
Hi Ivano,

With all the explorings done till date with Liferay what I think is it is a limitation in Liferay' Service Builder framework to define relationships between
user-defined custom entities and Liferay Portal's entities.

Of course, the relationships can be defined between user-defined custom entities in a given service.xml and it would generate the proper code.

http://www.liferay.com/community/forums/-/message_boards/message/1061266

However, what I have found is that though Liferay uses ORM framework (Hibernate) underneath its Persistent mechanism, the relationships and constraints
are not managed in the way it gets managed when using Hibernate itself at the Persistent layer.For instance on deleting a related entity
Liferay doesn't complain that there is an associated record in the related table, please delete that first.Above all looking at the Liferay's
Portal's implemented source code though they define a relationship between tables but sets the foreign key manually in the entity i.e. for instance,

a) EntityA and EntityB are related.
b) EntityB holds the primary key of EntityA as its foriegn key
c) What Liferay implementation does is it sets the foreign key manually which is contrary to the way relationships are managed when using Hibernate directly.


I may be wrong on my above findings but above is what I have observed while implementing portlets using Liferay and thought it would be good to share and
get comments from experts and others who are working on application involving Liferay.If I am wrong that somebody shall correct me and if I am correct then it might help somebody.

Thanks.
9 years ago
<LIFERAY_PORTAL_SOURCE_HOME>/portal-web/docroot/WEB-INF/portlet-custom.xml

Following portlets has its class specified as "com.liferay.util.bridges.mvc.MVCPortlet"

Unit Converter, Loan Calculator, Password Generator, etc

In their view.jsp I can find the following:



etc.

In the <liferay-portlet:renderURL> tag Portlet Params are passed like


I cannot find these actions in <LIFERAY_PORTAL_SOURCE_HOME>/portal-web/docroot/WEB-INF/struts-config.xml

And on debugging I see when the request reaches to com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(RenderRequest, RenderResponse)
it uses the view configured in the parameter "view-jsp" i.e. again redirects to portlet's view.jsp

Ques. 1: Then what is the significance of passing the "struts_action" parameter in the render_url??

Ques. 2: Also in the same context each portlet has its resourceBundle configured as "com.liferay.portlet.StrutsResourceBundle".How does it work and where is the resource-bundle located as specified for the portlet?

Ques. 3: What is the decision criteria on when to use <liferay-portlet:renderURL> and <liferay-portlet:actionURL> tags? Do we have any documentation on th usage for
Liferay's tag libraries.If yes, then where can I find it.If no, then how to get familiar with the tag libraries usage fundamentals?
9 years ago
Liferay Portal EE 6.0.5 + MySQL

How to map one-to-many or many-to-one relationship between entities in service.xml ?

I am building a Portlet using the Liferay Plugins SDK.

I am need to map a foreign key relationship between database table LAYOUT(default created by Liferay) and a new table I want to create (P_VERSION)

P_VERSION table would be holding a column "plid" which would refer to "plid" column of LAYOUT table.



Following is my service.xml



Now when I run ant "build-service" target the build is successful and the appropriate classes gets generated without any error.

But having a look at docroot/WEB-INF/sql/tables.sql

following can be seen



And in docroot/WEB-INF/service/com/sample/page/service/persistence/PVersionUtil.java I can see the generated method

com.sample.page.service.persistence.PVersionUtil.getLayouts(long)

Questions:

a) I cannot find a setterXXX for associating an existing com.liferay.portal.Layout with my custom entity com.sample.page.PVersion.
I suppose there should be some configuration that should be added to the com.liferay.portal.Layout for making my mapping work.
But com.liferay.portal.Layout is an existing entity configured in <LIFERAY_PORTAL_ROOT>/portal-impl/src/com/liferay/portal/service.xml.
And it is available in my classpath so I cannot modify it.
So how to achieve the above mentioned configuration, in case my assumption is correct? If my assumption is wrong, then please
guide me with the correct approach for achieving my desired requirement as mentioned above.


b) I cannot see any column named "plid" in CREATE STATEMENT in tables.sql shown above.Any specific reason in not including a foreign key constraint in the create clause? If it is not appended in the CREATE clause then how this constraint gets applied?
9 years ago
I have the following XHTML which gets included in another XHTML.




This is the validator code I am using for validating a desired entity on click of a button contained in the XHTML in which the above shown XHTML is included.




This is the abstract class whose subclass's instance is being obtained using WebUtils.getElValue("#{cartBean}");
in method validateDeliveryTypeCoupon(GenericAS400Coupon genericAS400Coupon) above.



What is happening is after the code gets executed in method above
in which I am doing so as to disable the checkboxes being rendered in the XHTML shown above.



After the validator's validate(..) method is executed I am re-rendering the panel "deliveryInfoDetails".

The problem I am facing is even though I am setting the cartBean's deliveryInfo's deliveryOptionBean's deliveryMode property as null so that the
checkboxes gets disabled but the "deliveryMode" instance state remains intact after applying the validator, as it was before applying the validator.

I inspected the "cartBean" instance by printing its default toString() implementation method.The instance which I am getting in the validator
is the same I am getting in the XHTML when I print it using .
Now since the TruDeliveryInfoBean.getDeliveryOptionsSorted() is a collection of DeliveryOptionBean instances so I have just updated the reference
so it should get reflected in the XHTML too.But that is not happening.

Following is the configuration of TruCartBean in faces-config.xml



Don't know where it is going wrong.Any inputs/guidance would be a great help.

10 years ago
JSF
Hi Dew,

No. The problem still persists.Since I am not able to find any solutions I have kept this aside for the time being and moved ahead.

It would be great if anyone from the community could look into this.

Thanks Eric for the reply.

Yes I use firebug.But there was no error reported in it when refreshing the changes.
Hi,

I am novice in using Ext JS and facing a problem in the first example I am trying to execute from Manning's Ext JS In Action book.

Following is the codebase directory structure on my machine



and following is the code in my files mentioned about above.

firstExample.html


firstExample.js


sayHi.html



I can see a window with the given title 'My First Ext JS Window' but instead of the message there in sayHi.html 'Hello from the world of AJAX!' getting displayed a progress bar with text Loading...''is displayed.

Can anybody please point out where I am wrong and help me get out of this?
Hi,

Is there no one who can help me resolve this issue?
10 years ago
Hello,

I have a web application using Spring(version 2.5),Spring Security (version 2.0.5) and DWR.I am facing some issue when the session timeout.
On session timeout the application should redirect the user to login page.But that is not happening.When the timeout had occured and then the user clicks on any of the links in the application, the user is taken to the target page for the clicked link but with no data since the data is user specific and user id is not found in the session.In Spring Security 3.0 this feature is available readily.

But I have no option of upgrading either Spring/Spring Security presently.In such a case how can I redirect the user to a desired page when timeout occurs.I tried implementing a session timeout filter but I end up finding that it was actually a wrong approach.That filter was getting called up in the chain even when invalid session was found.



Below is a portion from Spring Security logs.



Kindly guide me in achieving the desired result.
10 years ago