I was hoping there are other developers have similar issue that can share how to resolve this issue. I'm in the midst of using OpenJFX in one of my pet project. The project was tested on Oracle JDK 1.8 with JFX package included. When run on the Oracle 1.8 JDK, the TreeTableView show exactly as required:
Since Java 11 is required in my other workstation, the OpenJFX binary here is downloaded and installed. But the TreeTableView has become unreadable as followed:
Is there any JFX developer that has similar experiences?
FYI, I've tested with OpenJFX release 11.0.2, 15.0.1 and 16 all giving the same output.
Edit: It seems from the source behavior is as such as compile from source yield the same result.
Update: I should add my pet project is using JRuby and JRubyFX. Although not sure I don't think it is related to JRubyFX as the Oracle FX seems fine.
Thanks!
Regards
From your repository you have:
class WorkspaceCellFactory < javafx.scene.control.TreeTableCell
include Antrapol::ToolRack::ExceptionUtils
def updateItem(itm,e)
super
cont = nil
if not itm.nil?
if itm.is_a?(TreeWorkspace)
if not_empty?(itm.workspace)
cont = itm.workspace.path
elsif not_empty?(itm.project)
cont = itm.project
else
cont = itm
end
else
cont = itm
end
end
setGraphic(Text.new(cont))
end
end
You're setting the graphic property to a javafx.scene.text.Text node. In the past, I believe I've had a similar issue when using graphics with TreeView / TreeTableView. You've confirmed that replacing:
setGraphic(Text.new(cont))
With:
setText(cont)
Solves the problem.
Bug in JavaFX
This appears to be a bug in JavaFX. Please submit a bug report, assuming one doesn't already exist, so that the developers know there's a problem and can fix it. The bug report should include a minimal reproducible example written in Java.
Related
I had my working project written in asp.net core 2.1 for a long time, but yesterday, I was forced to upgrade it to .net core 3.0 (due to 2.1 cannot call Dll' s which are written in 3.0 already).
With that, a lot of functions were obsolete or already removed. I fixed almost all of it, but one problem with CORS.
Like many people before me, I used:
app.UseCors(x => x
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
in Configure function. And services.AddCors() in ConfigureServices function.
I was able to fixed this quite easily with setting WithOrigins() or .SetIsOriginAllowed(_ => true) instead of AllowAnyOrigin() which does not work anymore with AllowCredentials().
After that, I was able to start the application and I thought everything is fine, but then I get stuck until now with problem I do not know, how to fix.
I have DB relation N:N and relation table which handle that, that means I have Admin entity with AdminProject list property, then I have AdminProject entity with Admin list and Project list properties and Project entity with AdminProject list property once again.
When I am listing my projects of certain admin, I am returning in Controller this return Ok(projects), where I just use getAll on AdminProject entity and then with Select return only project.
For that, I have to use[JsonIgnore] in project/admin for properties which I do not need to avoid cycling when creating json.
With that said: NOW IN .NET CORE 3.0 AND CORS SETTINGS IT DOES NOT WORK.
I am getting an error:
System.Text.Json.JsonException: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32.
when debugging in console and error Access to XMLHttpRequest at 'http://localhost:5000/api/project/adminlist/1' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. in WEB browser
I think I tried almost everything with Cors settings etc and I do not know why is this happening now. I also tried to JsonConvert.SerializeObject() before return it ---> return Ok(JsonConvert.SerializeObject(projects)) and this is working, but I am not able (mentally) to do this in every single controllers functions.
Please help! Thanks a lot!
The problem was occurring because in .NET Core 3 they change little bit the JSON politics. Json.Net is not longer supported and if you want to used all Json options, you have to download this Nuget: Microsoft.AspNetCore.Mvc.NewtonsoftJson.
After that in your Startup.cs file change/fix/add line where you are adding MVC (in the ConfigureServices method.
So: here is what I did and what fixed my issue:
services.AddMvc(option => option.EnableEndpointRouting = false)
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
.AddNewtonsoftJson(opt => opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);
I hope it will help somebody else.
Cheers!
A couple other things have changed in .net core 3 and now instead of using addMVC you can use addControllers. So your code might look like the follow:
services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
I have just upgraded a net451 classic dotnet project to multi-target project using net461/netstandard2.0 with reasonable success.
Did however come across this compiler error for net461 when it comes to gaining access legacy configuration files via:
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
This appears to not be a thing in netstandard2.0 :) Anyone know of any work arounds or good solutions?
Add the ConfigurationManager as a NuGet
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
</ItemGroup>
Use ConfigurationManager in C#
var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
Log4NetLogger.Configure(configFile.FilePath);
According to this article, which I found when looking for replacement for PlatformServices.Default.Application.ApplicationBasePath, it should be either of:
AppDomain.CurrentDomain.SetupInformation.ApplicationName
Assembly.GetEntryAssembly().GetName().Name
Just like you, I've just found out that the first one does not exist in recent 2.0 so I'll be using the GetEntryAssembly name..
..however keep in mind that GetEntryAssembly may be null when used i.e. from within a test runner like xUnit, or probably will be wrong if your appcode is ran from another not-yours hosting/startup module, etc - so that is not a perfect replacement.
In a project WITHOUT the Prism library I had this code working to get a collection of "Persoon" objects:
Dim ObjectCollectie As New ObservableCollection(Of Persoon)()
If MijnAPIResponse.IsSuccessStatusCode Then
Dim AntwoordVanAPI = Await MijnAPIResponse.Content.ReadAsStringAsync
ObjectCollectie = JsonConvert.DeserializeObject(Of ObservableCollection(Of Persoon))(AntwoordVanAPI)
This code refers to a WebAPI to fetch the data and everything works fine.
This same statement won't work in the Prism ViewModel. It goes perfect until the ObjectCollectie is trying to use the JsonConvert statement. The AntwoordVanAPI contains the same JSON string like before.
The error message I get is:
__The API 'System.Collections.ObjectModel.ObservableCollection1[[Dossier365.BusinessModels.Persoon, Dossier365.BusinessModels, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ff36822ea527de6]]..ctor(System.Collections.Generic.List1[Dossier365.BusinessModels.Persoon])' cannot be used on the current platform. See http://go.microsoft.com/fwlink/?LinkId=248273 for more information.__
This refers to a nonexisting page on the Internet (I have seen more than a few complaints about that!). It is not easy to find anything recent on the subject "API cannot be used". The newest posts were about 2 years old.
Because the code has not changed, I suspect the Prism library. But why? And how to overcome? I have posted this on the CodePlex Prism issuelist as well, but I get the impression that only a few readers are active there. No response for over a week on issues. I hope StackOverflow does a better job.
Please, PLEASE, anyone knows an answer to this??
Peter
After a couple of hours of comparning the code and about everything else, I finally figured out that the cause of this error lies in JSON.Net version 6.0.4. After stepping back to JSON.Net version 6.0.3 everything worked perfectly again. I have reported this in the JSON project on CodePlex.
I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.
Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:
Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.
Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.
Make sure you add this anytime you have a new thread:
#autoreleasepool {
//enter code here
}
Have you tried latest revision from launchpad?
Also try to build libmariadb with -DUNDEF_THREADS_HACK and
CMAKE_USE_PTHREADS:BOOL=OFF)
I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.
I'm using the WkHtmlToXSharp wrapper library in my project to generate PDF file from HTML.
I was using this library a lot of times in different PCs and, suddenly, I came across the following problem:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at WkHtmlToXSharp.WkHtmlToPdfConverter.wkhtmltopdf_convert(IntPtr converter)
at WkHtmlToXSharp.WkHtmlToPdfConverter.Convert(String inputHtml)
at WkHtmlToXSharp.WkHtmlToPdfConverter.Convert()
at WkHtmlToXSharp.MultiplexingConverter.b_8()
--- End of inner exception stack trace ---
at Sanford.Threading.DelegateQueue.EndInvoke(IAsyncResult result)
at Sanford.Threading.DelegateQueue.Invoke(Delegate method, Object[] args)
at WkHtmlToXSharp.MultiplexingConverter.Convert()
This seems to be a common problem with this library (I've found some feedback on the web about it - however no fix was provided). BTW, in my case it happens somewhat randomly. I was not experiencing this problem in other dev machines. I wonder if somebody has a fix for it. I also wonder if this is a problem with the wrapper library, if with the WkHtmlToPDF library itself.
Any suggestion? I'm also open to use another converter, as long as it is free and stable and, if possible, without spawning a new process. It must work properly and stable in all Windows versions and do a decent job converting (the HTML to be converted is fixed - contains a few pics and tables and basic CSS).
I would suggest an alternate route: simply use wkhtmltopdf.exe directly, building your own wrapper. They are not very complicated if you have control of the input and then you know exactly how to update it and how the options work. I've never encountered with that problem when using wkhtmltopdf directly (on Win7, Win server 2008 r2, Ubuntu and CentOS). They do spawn process for every conversion though.
For an example, check out the Derp class in another answer of mine regarding wkhtmltopdf. Or try something like the untested code below (your true code will be more complicated, this is just a demo/POC).
var pi = new ProcessStartInfo(#"c:\wkhtmltopdf\wkhtmltopdf.exe");
pi.CreateNoWindow = true;
pi.UseShellExecute = false;
pi.WorkingDirectory = #"c:\wkhtmltopdf\";
pi.Arguments = "http://www.google.com gogl.pdf";
using (var process = Process.Start(pi))
{
process.WaitForExit(99999);
Debug.WriteLine(process.ExitCode);
}