Unable to create Graphics2d object from BufferedImage - clojure

I have a BufferedImage object, created from ByteArrayInputStream with (ImageIO/read) function.
Now I want to paint some lines on this image, so at the beginning I create Graphics2d object like this:
(defn g2d (.createGraphics image))
And here strange thing happens, because my function freezes here in this step. It never returns, never throws an Exception nothing. I run this program on server:
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
How could I find a cause of this freeze? I also checked if this Java version is headless like this:
(java.awt.GraphicsEnvironment/isHeadless)
But that method returned false.

Actually I had to write a separate Java program in order to see what was the problem. After seeing the Java exception I managed to solve this problem by unsetting Linux variable DISPLAY: unset DISPLAY.

Related

WMVCore crashes when WMIsContentProtected methos was called

My team is developing an application that is capable of recording videos and exporting the video into .wmv format file.
The export function is done via a method that utilizes windows API method derived from WMVCore.dll library.
However, on some PCs, this export function gets into crashes and according to the dump file taken from the crash, it appears that the last method called was WMVCore.WMIsContentProtected method. The call stack from the dump file is like below:
379fe8d8 65aa0cdb 299f94f0 00025800 379fe8f4
WMVCORE!WMIsContentProtected+0x4bc3 379fe970 6102e07e 1cae3f20
299f94f0 379fece8 WMVCORE!WMCreateWriterPushSink+0x1e278
It is really frustrating getting this crash without any more information out of the dump file. I also thought that the library might be corrupted on that specific PC, but there is no way to re-install the library as it comes with Windows Media Player. Any suggestion would be appreciated.
The code simply called WMVCore.WMCreateWriterPushSink which is followed by WMVCore.WMIsContentProtected. The OS version is Windows 7 Enterprise 64 bit. The application is a web based application on IE, in which case when the crash happens, IE would also crash and stop. The version of the WMVCore.dll is 12.0.7601.17514 and the question here is whether anyone has experienced the same issue and if yes, what sort of things can be tried/done to prevent this crash from happening?

CGDB - cannot add breakponts

Sometimes I cannot add breakpoints using (c)gdb.
I can add them after first or second run of the program, but then when I try to set any more (either in library or application source code) (either through CGDB Window or gdb command line) I'm greet with following information:
Cannot access memory at address 0x7fffeb480d10
Sometimes everything works great and without any problems.
System: SLES 11 SP3 (3.0.76-0.11)
CGDB: 0.6.7
GDB: 7.5.1-0.7.29
Running as root/as regular user makes no difference in behavior. Should I provide more details - just say. I have been using this configuration for quite long time now and didn't encounter this (any) problem earlier.

Why i'm i not able start noir server in intelli idea ID..?

I'm totally new to clojure... here is what I do
(use 'Yuhuru.server) // works fine, i mean gives nil
(def mysrv (noir.server/start 8080)) //now it gives
failed Server#9bfee2: java.net.SocketException: Unrecognized Windows
Sockets error: 10106: create java.net.SocketException: Unrecognized
Windows Sockets error: 10106: create (NO_SOURCE_FILE:2)
but using commandline i'm able start server.. is there any setting i'm missing in ID.. Please throw some light..
Thanks in advance
Problems with IntelliJ REPL not being able to create sockets under Windows used to come from the system environment variables not being propagated to the child JVM REPL process. Without these Windows won't be able to create a socket.
To test if your IntelliJ suffers from this problem, do a (System/getenv) from the REPL in IntelliJ and you'll see you get an empty map, instead of a map filled with your system variables like you get with a REPL from the commandline.
This is a recurring issue in various versions of IntelliJ/LaClojure. It was fixed in an earlier IntelliJ 10 / LaClojure version (0.3.92), but the last LaClojure update for IntelliJ 10 (0.3.102) broke it again.
I verified it should be fixed in the current IntelliJ idea 11.0.2 #IC-111.277 with LaClojure 0.4.30 combination. Downgrading LaClojure to 0.3.92 should work as well if you have to keep IntelliJ 10.
Sounds something like this: https://forums.oracle.com/forums/thread.jspa?messageID=9457989
Go here: http://plugins.intellij.net/plugin/?idea&id=4050 ; scroll down to the comments at 2010-06-08 20:39:35, it sounds like an issue with LaClojure (I'm assuming that you're using that...)

Generating PDF with Quick Reports behind a Delphi Web Server

I have a Delphi web server providing some web services*. One of them is supposed to generate and return a PDF report.
The PDF creation is done with a QReport that is then exported into a PDF file with the ExportToFilter procedure.
The routine works fine when called from within an application, but when called behind a TIdTCPServer, it hangs and never finishes. Debugging it, I got tho the hanging point:
(note: I'm home right now and I don't have the source code. I'll try to reproduce quickrpt.pas' source as accurrate as I can remember).
procedure TCustomReport.ExportToFilter(TQRDocumentFilter filter);
...
AProgress := TQRFormProgress.Create(Application); // Hangs on this line
AProgress.Owner := QReport;
if ShowProgress then AProgress.Show;
QReport.Client := AProgress;
...
Searching the web, I found in this page (1) the suggestion to set ShowProgress to False, and edit the code so that it does not create the progress form when ShowProgress is set to false (apparently, this is due to QReport not being threadsafe).
So, I edited the code, and now I have this:
procedure TCustomReport.ExportToFilter(TQRDocumentFilter filter);
...
if ShowProgress then
begin
AProgress := TQRFormProgress.Create(Application);
AProgress.Owner := QReport;
AProgress.Show;
QReport.Client := AProgress
end;
...
Now, the report comes out. But then the service gets to an Invalid Pointer Exception (which I can't trace). Following calls to the service complete successfully, but when I shut down the service** it starts whining again with Invalid Pointer Exceptions, then the "MyServer has commited an invalid action and must be closed" windows message, then again a couple of times more, then just the pointer exception, then comes to error 216 (which as far as I could find out, is related to Windows access permissions).
Thanks!
Update (jan 5): Thanks Scott W. for your answer. Indeed, after some research, I found another suggestion that only the main thread can access some components. So I set the QR code back to normal and called the main method from a Synchronize call inside a TThread (so that way the main thread would handle it). But I still get the same error.
You mention you were able to generate PDF as a service with QR 4. Maybe that's why it's not working for me, since I'm using QR 3. On the other hand, you don't mention if you're doing that behind a TIdTCPServer (which is my case, providing web services) or if you run it by itself (for instance, during a batch process).
Anybody knows whether my QR version might be the problem? Thanks!
* Running Delphi 7 and QuickReport 3 on a Windows XP SP2. The server is based on Indy.
** I have two versions of the server: a Windows application and a Windows Service. Both call the same inner logic, and the problem occurs with both versions.
Update (mar 8): After all, my problem was that my printing routine was in another dll, and the default memory management module is somewhat crappy. Setting the first uses of my .dpr to be ShareMem overrides the memory management module with Borland's implementation, and solved my problem.
uses
ShareMem, ...
(1): http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.thirdpartytools.general/2006-09/msg00013.html
I'm guessing that QReport.Client is used somewhere later in the code, and with your modified code no longer assigning it to AProgress, you end up with an error.
Are you sure that you have to modify the QuickReport source? I have used QuickReport in a Windows Service to generate a PDF file and then attach to email message and all worked fine without having to modify the QR source. I don't recall exactly which settings had to be made, but it was done with Delphi 6 and QR 4.06.

Invalid lock sequence error in an OpenSceneGraph application

I have an application that is built against OpenSceneGraph (2.6.1) and therefore indirectly OpenGL. The application initializes and begins to run, but then I get the following exception "attempt was made to execute an invalid lock sequence" in OpenGL32.dll. When I re-run it, I sometimes get this exception, and sometimes an exception about a "privileged instruction". The call stack looks like it is corrupted, so I can't really tell exactly where the exception is being thrown from. I ran the app quite a bit a couple of days ago and never saw this behavior. Since then I have added an else clause to a couple of ifs, and that is all. My app is a console application, is built with Visual Studio 2008, and it sets OpenScenGraph to SingleThreaded mode. Anybody seen this before? Any debugging tips?
Can you reproduce it with one of the standard examples?
Can you create a minimal app that causes this?
Do you have a machine with a different brand video card you can test it on (eg Nvidia vs. ATI) there are some issues with openscenegraph and bad OpenGL drivers.
Have you tried posting to osg-users#lists.openscenegraph.org
The problem turned out to be our app was picking up an incorrect version of the OpenGL DLL , instead of the one installed in System32.