Suppose I have a weak reference to a car which has an ordinary reference to an engine. No other references to the car or the engine exist. Can the engine be garbage collected?
I have to set this up so that users can make labels, and track shipments, can someone outline the steps of how this works, including any interaction I need to do in regards to testing and contacting Fedex support, any special keys, gotchas?
Please consider following use case,
I have one bigger image, lets called is master image.
Now from some where else, I am getting one small image. I want to check whether this small image is subset of master image or not.
important points are,
smaller image might have different file format,
smaller image might captured from comparatively different view.
smaller image may have different light intensity.
At this stage of algorithm/computation advancement, which level of accuracy I could expect?
Any algorithm/open source implementation that would have such implementation?
Thanks,
Rajnikant
i receive a timestamp from a soap service in miliseconds.. so i do
Date date = new Date(mar.getEventDate());
how can i extract the day of the month from date, since getDay() and so are deprecated?
im using a small hack, but i dont think this is the proper way..
SimpleDateFormat sdf = new SimpleDateFormat("dd");
int day = Integer.parseInt(sdf.format(date));
Hi,
I have an android application that shows a grid view that shows:
1
2
3
4
GridView gridview=(GridView)findViewById(R.id.GridView_test);
DataBaseHelper dbhelper=new DataBaseHelper(this);
ArrayList<String> test=new ArrayList<String>(5);
backlinksadapter.add("1");
backlinksadapter.add("2");
backlinksadapter.add("3");
backlinksadapter.add("4");
ArrayAdapter mAdapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, test);
gridview.setAdapter(mAdapter);
By the moment is working, but i would like to show foreach line of the grid, 2 columns with the values of a 2 dimensional array (something like the GridView in ASP.Net - as datasource -).
I would like to show:
1 | Person 1
2 | Person 2
3 | Person 3
4 | Person 4
Any idea?
Somebody tell me:
class MyClass {
private static MyClass myClass = new MyClass();
private static final Object obj = new Object();
public MyClass() {
System.out.println(obj); // will print null once
}
}
I wonder, isn't this a bug? Why static objects are not initialized before the constructor runs?
I'm trying to print some HTML directly, without displaying anything to the user. It works currently (somewhat) using a custom JEditorPane that implements Printable. The problem I'm having is that it always wants to use a preferred size of 582px x 560px. If I manually change the size using something like setSize(x,y) it will change the size of the pane, put the content renders at preferred size, not actual size (so it's still 582x560).
I can scale it up to fit the page, but it's basically just an enlarged version where the images are all pixelated and the layout is wrong (based on the smaller window size).
Inside the print method of my Printable JEditorPane I used this to try and get the size:
javax.swing.JWindow wnd = new javax.swing.JWindow();
wnd.setContentPane(this);
wnd.setSize(1024,1584);
wnd.pack();
Dimension d = wnd.getPreferredSize();
With or without that setSize and/or pack methods on the JWindow the preferred size always comes back as 582x560.
I do have control over the html that I'm trying to print but I'd rather not have to rewrite all of that to scale it down so it will print correctly at full size (when scaled up).
I have two level access to database: the first with Hibernate, the second with JDBC. The JDBC level work with nontransactional tables (I use MyISAM for speed). I want make both levels works within transaction. I read about JTA which can manage distributed transactions. But there is lack information in the internet about how to implement and use custom resource.
Does any one have experience with using custom XAResources?
I see that Hibernate home page has a symbol informing that it implements JSR 317, but I couldn't find if it implements the full spec. Does anybody knows if Hibernate 3.5.0-CR-2 fully implements the JSR 317?
I can see from their JIRA that everything is closed related to JPA 2.0:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4190?subTaskView=all
Anyone has experienced using JPA2.0 with Hibernate? Does it implement the full spec?
Hi,
I'm writing some integrations tests in JUnit. What happens here is that when i run all the tests together in a row (and not separately), the data persisted in the database always changes and the tests find unexpected data (inserted by the previous test) during their execution.
I was thinking to use DbUnit, but i wonder if it resets the auto-increment index between each execution or not (because the tests also check the IDs of the persisted entities).
Thanks
M.
I'm am using JEditorPane to render basic HTML. But it renders self-closing tags incorrectly, specifically br tags, e.g. <br /> is bad but <br> is good. I would like to use String.replaceAll(regex, "<br>") to fix the HTML, where regex is a regular expression matching any self-closing br tag with case-insensitivity and zero to infinity number of spaces between the "r" and the "/" (e.g., <br/>, <BR/>, <br />, <Br />, etc.).
Thanks to any regular expression experts who can solve this!
I need to not validate against a doctype, so I'd like to set a custom EntityResolver that accepts everything. I'm getting data back from tagsoup, so I know my data is well-formed and correct.
Furthermore, I need to rapidly hit a number of documents, so when I do this with the default EntityResolver, I get 503 from w3.org.
How, then, can I use a XOM builder with a custom entity resolver?
Graph < Integer, Integer> g = new SparseMultigraph<Integer, Integer>();
g.addVertex(1);g.addVertex(2);g.addVertex(3);
g.addEdge(0,1,2 ,EdgeType.DIRECTED);g.addEdge(1,2,3 ,EdgeType.DIRECTED);g.addEdge(2,3,1 ,EdgeType.DIRECTED);g.addEdge(3,1,3 ,EdgeType.DIRECTED);
How can I convert this graph into an adjacency matrix taking into consideration that it is a directed graph.
I'm currently using JerseyTest w/ Grizzly embedded server to test some code. I do some very simple configuration to point it to the proper resources:
Map<String, String> initParams = new HashMap<String, String>();
initParams.put("com.sun.jersey.config.property.packages", "com.sample.service");
ApplicationDescriptor appDescriptor = new ApplicationDescriptor();
appDescriptor.setServletInitParams(initParams);
super.setupTestEnvironment(appDescriptor);
This works fine and the Jersey components are available and working as expected.
I'm now trying to add some Mule functionality to some of these Jersey calls, but Mule is not being properly initialized/configured by Grizzly. Has anyone gotten this kind of setup running? What additional configuration do I need to do with JerseyTest/GrizzlyWebServer to get it to initialize Mule properly?
Hi All,
How does jvm know what class an object is an instance of at runtime. I know we can use the getClass method to get the class name but how does the getClass method work?
Thx,
Praveen.
Hi,
I'm calling servlets which has implemented CometProcessor interface, and whenever I try to call the servlets with get request, I'm getting the above error. May I know the reason?
public class ChatServlets
extends HttpServlet implements CometProcessor {
public void event(CometEvent event)
throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
response.getWriter().println("Welcome ");
} else if (event.getEventType() == CometEvent.EventType.READ) {
response.getWriter().println("Bye");
}
}
}
I getting some json data posted to my asp.net webapi, but the post parameter is always coming up null - the data is not being serialized correctly. The method looks something like this:
public HttpResponseMessage Post(string id, RegistrationData registerData)
It seems the problem is that the client (which I have no control over) is always sending the content-type as x-www-form-urlencoded, even though the content is actually json. This causes mvc to try to deserialize as form data, which fails.
Is there anyway to get webapi to always deserialize as json, and to ignore the content-type header?
I'm getting the error in the title occasionally from a process the parses lots of XML files.
The files themselves seem OK, and running the process again on the same files that generated the error works just fine.
The exception occurs on a call to XMLReader.parse(InputStream is)
Could this be a bug in the parser (I use piccolo)? Or is it something about how I open the file stream?
No multithreading is involved.
Piccolo seemed like a good idea at the time, but I don't really have a good excuse for using it. I will to try to switch to the default SAX parser and see if that helps.
Update: It didn't help, and I found that Piccolo is considerably faster for some of the workloads, so I went back.
Are there are decent implementations of a vector graphics canvas in GWT? I would like to be draw arbitrary shapes and have them react to user input (mouse in/out/click/etc). There are wrappers for the HTML canvas, but that feature is not supported in older browsers (read: IE).
There is an SAP server that has some webservices I need to use, so I am trying to use wsimport to generate the client stubs.
I don't want to find all the wsdls and schemas that are referenced and modify them to do it locally, as that isn't sustainable, if they service should change.
So, how can I use wsimport to fetch a wsdl and generate the client stubs when the server is using Windows Integrated Authentication, where even the wsdl requires credentials.
Hello All...
I need to jump into the Spring Web Service Project, in that I required to implement the Spring Web Service's Client Only..
So, I have already gone through with Spring's Client Reference Document.
So, I got the idea of required classes for the implementation of Client.
But my problem is like I have done some googling, but didn't get any proper example of both Client and Server from that I can implement one sample for my client.
So, if anybody gives me some link or tutorial for proper example from that I can learn my client side implementation would be greatly appreciated.
Thanks in advance...
For my App I need Data from both, a local Network and the Internet. The local Network (Wifi) has no connection to the internet so I have to use the mobile connection (3G for Example).
But whenever I connect to the local Network, 3G stopps. After asking the Samsung Service, there is no way to change that in the UI. But they couldn't tell me, if there is a programmable Interface for that.
There is a mobile access point inside, so there is a way to connect a Wifi device to the Internet (which means that both, a wifi and a 3G connection is possible the same time in that way). But for my App the phone/tab has to connect to the existing Network and use the 3G for Internet.
So this is my question here.
Is there a way to connect to an existing Network and using 3G for Internet the same time?
Hi.
I wrote a simple custom view for rows in ListView. It works fine, but when I try to scroll the list, I see only white rows without content. And when scrolling is over, rows continue to show again.
This is how I draw a custom view:
@Override
protected void onDraw(Canvas canvas) {
if(poster != null) {
canvas.drawBitmap(poster, padding, padding, paint);
}
canvas.drawText(title, 55 + padding, 16 + padding, paint);
}
Maybe I missed something?
P.S. This is short screencast (400kb) http://dl.dropbox.com/u/190203/test.mpeg
Hi,
I'm having a headache figuring how to retrieve the gwt Radio Buttons values in the server side.
Here is my UiBinder form:
<g:FormPanel ui:field="form"><g:RadioButton name="fruit">apple</g:RadioButton><g:RadioButton name="fruit">banana</g:RadioButton> ...
So i though i would have to do this on the servlet:
fruit = req.getParameter("fruit")
But of course this doesn't work, parameter fruit doesn't exist :/
So how should i do?