Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization forum!

Yogesh Gandhi

Ranch Hand
+ Follow
since Dec 05, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
11
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Yogesh Gandhi

I have 2 classes
1) ScheduledTasks.java
2) UserNotificationServiceImpl.java

I have @Autowired a class in both the above classes.

I have set a Set<String> private member variable in ScheduledTasks into the @Autowired reference(userDao) whcih I later want to access later from UserNotificationDAO of UserNotificationServiceImpl.
But I am not able to.

Firstly I thought, may be spring boot is not creating a singleton instance.
I printed the object. I assume, that it prints the memory address by default if toString method is not overriden.

I found both the memory address to be the same.

I set a Set<String> in ScheduledTasks into userDao and which I can see that it has been properly set in ScheduedTasks itself before I proceeded.

You can have a look at the logs




*************Inside ScheduledTasks.java ***********************************
Notification: *** Inside sendNotificationForOrdersOnHold()
Notification: *** Executing Query as select oos2.orderitemnumber||','||oon2.event_id ORDER_EVENT from om_order_notifications1 oon2, om_order_stage oos2  where (oon2.orderitemnumber, oon2.user_notification_date) in (SELECT oon.orderitemnumber, MAX(oon.user_notification_date) FROM om_order_notifications1 oon, om_order_stage oos WHERE oon.orderitemnumber = oos.orderitemnumber  AND UPPER(oos.orderstagestatus) LIKE('%HOLD%') AND oos.stage_flag = 'Y' AND oon.NOTIFICATION_ID='14' GROUP BY oon.orderitemnumber HAVING MAX(oon.user_notification_date) + (select nvl(min(VALUE),30) from OM_MASTER_DATA WHERE KEY='on_hold_day_span') < sysdate AND MIN(oon.user_notification_date) + (select nvl(min(VALUE),365) from OM_MASTER_DATA WHERE KEY='when_to_cancel_order') > sysdate)  and oon2.ORDERITEMNUMBER=oos2.ORDERITEMNUMBER  and oos2.stage_flag='Y'  AND oon2.NOTIFICATION_ID='14' and oon2.event_id like '%1006'
Notification: *** Orders to be notified = [160304995,20160624.10598.1006]
Notification: *** userDAO in ScheduledTasks = net.colt.notifications.DAO.impl.UserNotificationDAOImpl@72061775

//         userDao.setOrdersOnHold(ordersOnHold);
Notification: *** Orders On Hold set in UserDAO = [160304995]


********* Inside UserNotificationServiceImpl ***************************
Here I have @Autowired UserNotificationDAO and when I invoke getOrdersOnHold, I get an empty Set.

Notification: *** ###################################### userNotificationDAO.getOrdersOnHold=[]
Notification: *** UserNotificationDAO in UserNotificationServiceImpl = net.colt.notifications.DAO.impl.UserNotificationDAOImpl@72061775


Both the objects are same.

But I do not get the set, when I try to access it using the other reference. (As you can see getOrdersOnHold gives me an empty Set.

Any help in this regard is appreciated.

Regards
Yogesh
2 years ago

Ankit Garg wrote:See this tutorial, you have to run your application using Spring not directly by instantiating the class



I wonder, what is it that it is only required to run my application using spring. Why I can't use it on a method in plain java?
2 years ago
THe output is

"Entered test"
Then waits for 10 seconds
"HELLO"
and then
I am done.
2 years ago
Hi,

I need to call a method asynchronously. This is what I did, by studying from internet.
Similar code is working in our project, with the same annotations and all, but due to some reason, I am not able to make it work in standalone.

Can anybody help me on this, as to what I have done wrong.

2 years ago
Hi Guys,

Hope you all are doing good...

I am stuck at a very basic but surprising question...

I have created a POJO class...and overrode the toString method by the default implementation that string gives me...



Now if i create a list of these objects and pass this to sysout....it gives me the following output;;;


OUTPUT:


[MileStoneDTO [mileStoneId=1, orderStageId=1, orderMileStoneName=ABC, orderMileStoneDate=Wed Dec 16 09:52:32 IST 2015, orderMileStoneSourceSystem=OHS, orderMileStoneEndDate=Wed Dec 16 09:52:32 IST 2015], MileStoneDTO [mileStoneId=2, orderStageId=2, orderMileStoneName=DEF, orderMileStoneDate=Wed Dec 16 09:52:32 IST 2015, orderMileStoneSourceSystem=OHS, orderMileStoneEndDate=Wed Dec 16 09:52:32 IST 2015]]



The thing to note here is the string marked in red above..

Now, if I make a spring controller and return the same list from it...and see it in a browser, the output misses the thing that was marked in red above. I presumed, it'll use a toString method of the object always...





OUTPUT:

[{"mileStoneId":1,"orderStageId":1,"orderMileStoneName":"ABC","orderMileStoneDate":1450239474577,"orderMileStoneSourceSystem":"OHS","orderMileStoneEndDate":1450239474577},{"mileStoneId":2,"orderStageId":2,"orderMileStoneName":"DEF","orderMileStoneDate":1450239474577,"orderMileStoneSourceSystem":"OHS","orderMileStoneEndDate":1450239474577}]




Can you notice?

Did it not use the toString method?
The name of the class is not coming while it is returned by controller....
Also you can see the values of dates are coming in milliseconds, where as in the earlier part it was in local timezone.

I hope I am able to put my query clearly and make you guys understand, what I am trying to ask...

Can you please help me understanding, what's going in here?

3 years ago

Roel De Nijs wrote:

Yogesh Gandhi wrote:SQL Error: ORA-06552: PL/SQL: Statement ignored
ORA-06553: PL S-382: expression is of wrong type


Pure SQL doesn't understand the boolean data type, although PL/SQL does. So although the function will work if invoked from another PL/SQL block, it won't work in a simple SQL SELECT statement.

So if you need to use it in SQL SELECT statements, use the integer data type as return value and return 0 or 1 instead.




Thanks Roel,
But when I try to run it in PL/SQL block as well...

as follows




It still doesn't works and says

Error starting at line 1 in command:
declare
x boolean;
begin
select isHoliday(sysdate) into x from dual;
end;
Error report:
ORA-06550: line 4, column 32:
PL S-00382: expression is of wrong type
ORA-06550: line 4, column 8:
PL S-00382: expression is of wrong type
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/ SQL compilation error.
*Action:


select isHoliday(sysdate) from dual;

eRROR i GET IS

Error starting at line 1 in command:
select isHoliday(sysdate) from dual
Error at Command Line:1 Column:7
Error report:
SQL Error: ORA-06552: PL/SQL: Statement ignored
ORA-06553: PL S-382: expression is of wrong type
06552. 00000 - "PL/SQL: %s"
*Cause:
*Action:
Hi,

I am trying to using highcharts on my website.

The problem is with the export functionality on IE

The function that I have used for exporting the chart is




The problem occurs on IE, and it says, that "Internet Explorer has modified this page to help prevent cross-site scripting"


Our Client is not ready to disable the XSS security protection available in the browser. Nor he has the rights/permissions to add highcharts to its trusted sites.

Any other solution if anyone knows...regarding the change in the settings of highcharts...

These are the options that I am using for displaying highcharts:





Somewhere on internet I read that it may be required to set XSS header, but where do I do that, that must be on the highcharts page? right?

Any suggestions?

Bear Bibeault wrote:

Yogesh Gandhi wrote:This is a filter of angular JS.


Please include this sort off necessary information in your first post.



Sorry for not including the necessary information.

Here is the filter:

Bear Bibeault wrote:Usually, when something works in debug mode, and does not in non-debug mode, it's a sign that there is a timing issue.



Yeah, it might be a timing issue, but what I was wondering was, as angular JS is a library of javascript, and it gets executed on server side, so there should not be any delay happening due to the response from the server side.

Well, I was not able to find the root cause of it yet.

E Armitage wrote:What type of filter is this and what error do you get in IE? Is it a servlet filter? If so how is it mapped?



This is a filter of angular JS.

No error in IE. It just prints the code...i.e. {{value|nameToDisplayName}}

It is not a servlet filter.
Hi Guys,

I have written a filter and it just prints the content as it is on the page (Specifically on IE).
like the following gets printed on the page

{{value|nameToDisplayName}}


However it works when
1) Opened in Chrome browser
2) When I run it on IE in debug mode.

I am trying to pin point the issue by thinking like
1) If it is working in debug mode, that means the code written for filter is correct
2) Also if it is working in other browsers, that might mean that the code doesn't specifically works for IE.

Regards
Yogesh

Jeanne Boyarsky wrote:I don't have IE on my computer right now. But does it work if you have just these two lines?




It works, but it waits for me to click "Allow blocked content" button....After I allow blocked content, the alert is displayed.


I wonder, why does IE blocks this?

Hi Guys,

I have been facing one issue, and was able to drill down to this point.




This code gets blocked by IE and I have to click on "Allow blocked content" for this code to get executed.

Can someone please help me.

I cannot ask users of my application to unblock the content? and even if it is technically not possible, I would be interested, if anyone knows the reason why is it so?
<jsp:param works on the server side as request.getParameter, that is capable only for carrying a String.

In my case it was an object, so I had to set it as an Attribute in request

using

><c:set var="x" value="${priv}/>
<jsp:include page="abc.jsp"/>

4 years ago
JSP