Friday, 30 August 2013

Synchronous Request-Reply pattern in a J2EE container

Synchronous Request-Reply pattern in a J2EE container

I am looking to implement an synchronous Request-Reply pattern using JMS
inside a J2EE container. The sequence would be something like this
Browser makes a request to web application for data. This is a blocking
request (say on thread T1).
The Web app needs to connect to a remote web service to fulfill the above
request. So it forms a request and places it on a queue (with a reply-to
queue also declared).
The remote service processes the requests and places the response on to
the reply-to queue declared in step 2
The response is read from the reply-to Q in the web-app and made available
to the blocking thread T1 of step 1.
I have followed the answer provided by T.Rob (How to match MQ Server reply
messages to the correct request)
QueueReceiver queueReceiver =
session.createReceiver(destination, "JMSCorrelationID='customMessageId'");
TextMessage receivedMessage = (TextMessage)queueReceiver.receive( 15000 );
Is the above solution valid when running in a J2EE container (web module)
where there could be multiple concurrent request coming in?

Thursday, 29 August 2013

Css boxshadow to uplift an image

Css boxshadow to uplift an image

I have a background wrapper. I want to make it with css instead of adding
an image. I am not sure how to add box shadow so as i can get the same
output as in attached image.

Wednesday, 28 August 2013

While upgrading my Ubuntu 12.04 to 12.10, it alerts "your graphics hardware may not be fully supported in Ubuntu 12.10"

While upgrading my Ubuntu 12.04 to 12.10, it alerts "your graphics
hardware may not be fully supported in Ubuntu 12.10"

While upgrading my Ubuntu 12.04 to 12.10, it alerts "your graphics
hardware may not be fully supported in Ubuntu 12.10". What should I do?
Stop or continue?

How to optimize parameters as weights?

How to optimize parameters as weights?

pi have the following Problem. I want to measure the similarity of 2
Objects, therefore i have multiple functions, which give me a value
between 0,..,1 as output, for two Objects as input. I combine the little
similarities to an overall similarity and all single similarity functions
have a parameter k, which weights them. The success of further
calculations strongly depends on the outcome of this similarity. To
calculation of the outcome, with different parameters takes long time. So
my question is, if there is a mathematical good way to figure out the
parameters, which give me a maximum in my further calculation ouputs?/p
pThanks for your time./p

Do something on window.onpopstate or window.onload but never twice

Do something on window.onpopstate or window.onload but never twice

I would like to write a javascript code able to do something on either
window.onpopstate or window.onload but never twice (note that chrome fires
a popstate event both onload and when clicking the back navigation button)
I would like it to be compatible for major modern browsers (IE10 firefox
chrome opera safari)
And i would prefer NOT to use any library - not even jquery.
Something like this (but with the right syntax of course):
window.onload || window.onpopstate = function(){
window.alert("hello world");
}
Thanks
EDIT
With ur suggestions i have tried this:
var ranAlready=false;
window.onload = function(){
if (!ranAlready){
window.alert("onload was true");
ranAlready=true;
}
};
window.onpopstate = function(){
if (!ranAlready){
window.alert("popstate was true");
ranAlready=true;
}
};
But now im not sure how to set the variable back to false.. cuz it depends
on the browser and so on..

Basic matrix math in R

Basic matrix math in R

So I want to perform basic math using two matrices.
As my input I have two 3x3 matrices. I would like to divide every integer
in matrixA by every integer in matrixB and the output to be one 3x3 matrix
of their products.
What is the R function(s) that can do that for me.
Thanks in advance!

View not rendering from controller

View not rendering from controller

here's the thing. I have this view named "Testing":
@model Project.Models.Test
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Testing</title>
</head>
<body>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
--- some html and razor using model attributes ---
}
</body>
</html>
And in TestController, the ActionResult method that should return the view.
public ActionResult Testing(int id) {
Test test = db.Test.Find(id); (I have a breakpoint in here)
if (test == null)
{
return HttpNotFound();
}
return View(test);
}
For some reason if I write on the address bar in the browser
localhost:(number of port)/Test/Testing/1 the view renders but not from
the controller, because I have a breakpoint in the controller and it
doesn't execute that instructions. Because of that, everything is null
obviusly because there's no object. I don't know why the view is rendering
without calling the controller action.
Edit: My routeconfig look like this