Json Simple dependency Issue - json

So I have been trying to import JSON Simple (https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple/1.1.1)
I am also using Visual Studio Code. So I have added the dependency in my pom.xml file, but it still wont find my imports. Do I have to add soemthing to my module-info? (fixed a different issue for me) I tried requires com.json.simple; or requires com.googlecode.json.simple; but I get the cannot be resolved to a module error. Also my project is a javafx Application, that implements server socket networks (JSON exchage).
Im at a complete los here on what to do...
Thanks for your help.

So after a lot of trial and error, i have finally fixed it. Instead of vs code I used IntelliJ and added the dependencies there. Its impotant to note, that after every import I had to restart intelliJ also make sure to press the icon as mentioned in this tutorial https://www.jetbrains.com/help/idea/work-with-maven-dependencies.html#maven_import_dependency.

Related

PhpStorm can't resolve package import even though it exists (react-router-dom)

I am using React (16.12.0) with PhpStorm (2019.3.1).
The package I am importing is react-router-dom (5.1.2)
I will write the following import:
import { NavLink, Switch } from "react-router-dom";
Both packages are imported properly by webpack/babel and the page renders properly when I use both Switch and NavLink.
However purely from the IDE-perspective, I get a warning about Switch: Cannot resolve symbol 'Switch'
It is weird because it is obviously there, and I checked in /node_modules/react-router-dom and Switch.js is there.
Strangely on previous versions of PhpStorm (before several updates and plugin imports and other changes), the Switch import was accurately found by PhpStorm.
I have not updated react-router-dom recently and am using its latest stable build.
Any ideas as to why it might be missing Switch?
EDIT:
I have realized it may be because PhpStorm is having difficulty importing a commonJS module.
I tried changing the Javascript compilation method from React JSX to ECMA 6. That didn't work.
I also tried importing some build libraries for react-router-dom, and that worked for recognizing the Route import strangely but not Switch.
I also tried invalidating the PhpStorm cache and restarting the app, but that didn't work either.
EDIT 2:
Per an answer, I have tried to use option+enter (alt+enter on windows) while my cursor is within react-router-dom to try to install a typescript package, but I don't get the same suggested action as shown on the JetBrains website: https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html
All it suggests is switching single quotes to double quotes.
Also I have already installed #types/react-router-dom. Perhaps there is another one that I am missing?
EDIT 3:
The correct answer was to install #types/react-router. For some reason #types/react-router-dom is deceivingly NOT what solves this.
node_modules/react-router-dom/esm/react-router-dom.js exports BrowserRouter, HashRouter, Link and NavLink, but doesn't export Switch, it's not explicitly defined there.
For better completion/type hinting, you can install Typescript stubs for the package: put cursor on "react-router-dom" in import statement, hit Alt+Enter, choose Install TypeScript definitions for better type information::
See https://www.jetbrains.com/help/webstorm/2019.3/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files

Xcode Couldn't Generate Swift Representation for my own framework

I have created a framework which I want to use in my OS X app. Since updating to Xcode 7 on El Capitan, when I try to command-click on the import statement, Xcode goes to the following view.
How can I get Xcode to display the Swift representation properly?
I've had it happen before, and my solution was to recreate every project file which I don't want to do again.
From my experience there are two possible causes for this issue.
The first one is that your framework can't be located. To fix this you need to go to target's Build Settings and add a path to Framework Search Paths either an absolute:
/Users/{user}/path-to-framework-parent-directory
or relative to project directory:
$(PROJECT_DIR)/path-to-framework-parent-directory
Another possible cause is that the path to your framework contains a space in it. I found that it doesn't matter whether you try to escape it with backslash ../Project\ Name/frameworks or take the whole path in double-quotes "../Project Name/frameworks". The result would be that SourceKit could not load the module.
Note that $(PROJECT_DIR) could expand to a path with a space in it and it would too result in the same error. So it looks like a bug in Xcode/SourceKit (I tried the latest Xcode 7.2-beta3 and the bug is still there).
My repository was on the second hard drive /Voluems/Macintosh HD/Repos. I just renamed the hard drive to HD, so the path looks like /Volumes/HD/Repos and the problem was gone.
Max S. answer pointed me in the right direction, however I was using the 'recursive' option for my framework path.
To get things to work I had to explicitly add a path to directly the framework in question's immediate parent directoy (as oposed to just having a path to one of its higher up directories with the 'recursive' option set).
HTH
I had this problem too and the other solutions didn't work. I finally figured it out in my case:
The target name cannot have a space in it either
To rename it:
Go to your project settings
Expand the target list column on the left if not already there
Click on the relevant target once (or press Enter or Tab when having it selected) and type in the new name without the space
Weirdly, just changing the name of my folder from 'Developer' to 'Development' fixed the issue from me.
Running Product->Clean, Product->Build is what worked for me.
In my case, I have created a framework for my SDK along with podspec for making it cocoa pod.
I had the same problem when i use my SDK and it fixed when I imported Foundation API to the file where I am consuming my SDK
import Foundation
Here is another potential solution - one that worked for me:
After importing the framework I never built for simulator, only for real devices. Swift Modules were not showing up, same error. Then I built for Simulator and it suddenly worked, I could see the Swift Modules.
The reason is that when I make my framework, I have a step that copies the swift modules from the iphonesimulator build to the universal build, but does nothing with the modules from the iphoneos build. So my guess is that this is why it didn't work.
Note: once I selected simulator and built it started working all the time, regardless of the build destination.

Using mysql JDBC in the OSGi framework

I have a huge problem with getting a connection to a Database within my OSGi Application. I searched for 3 days an couldn't find a good solution. Just not working and old stuff. I'm using Bndtools for creating my Bundles.
Can anyone please help I'am very desperate.
Thanks
The most probable cause of this error seems that the package of the class being used is not present in the Import-package directive of the bundle's manifest.mf.
In OSGi environment, each bundle has its own classloader. So, each class will be loaded only once during the application life span. Whenever a class is being used outside of a bundle, the package the class resides in needs to be present in the Export-package attribute of its jar's manifest.mf.
Any client bundle which requires this package/class, should add the entry in its Import-package attribute of its manifest.mf file.
If you are using maven, you can use maven-bundle-plugin. This plugin will take care of generating appropriate manifest import and export headers by scanning the dependencies present in your project's pom.xml.

SublimeRope Autocompletions not working on Windows

I'm having trouble getting autocompletions to work for SublimeRope on Windows 8.
First, I noticed that SublimeRope messes up paths when creating a new Rope project on Windows, so I fixed the python_path prefs in .ropeproject > config.py, which are:
prefs.add('python_path', 'C:/Users/brandon/python_virtualenvs/aa/Lib/site-packages')
prefs.add('python_path', 'C:/Users/brandon/django_projects/andrews-app')
I've also tried specifying the packages to auto-import in my project file:
"rope_autoimport_modules": ["django.*"]
When I attempt to run: Rope: Regenerate Global Module Cache, I get an error:
"Missing modules in configuration file"
which Google has not been able to provide an answer for. Is anyone on Windows able to get SublimeRope working? I would really appreciate some help!
I documented how I kind of fixed it here:
https://github.com/JulianEberius/SublimeRope/issues/54
Basically, I added:
sys.path.insert(0, r"C:\Python27\Lib\site-packages")
in sublime_rope.py itself.
Obviously a hack, but it works until the code gets fixed upstream.

Flare and ActionScript error

I am trying to compile this sample program but I am brand new to Flare and ActionScript. Here is the DependencyGraph example that I am trying to compile: http://flare.prefuse.org/apps/dependency_graph.
The error I am receiving right now is:
Access of unidentified property App
Are there certain packages or project files that I will need to import or add to the source code in order to fix this?
Looks like you need to grab this class as well:
http://flare.prefuse.org/src/flare.apps/src/flare/apps/App.as aside from that it looks like the imports are all coming from packages in flare and should be included in the flare swc file.
Edit
Okay so starting from scratch I was able to get Flex 3.4 SDK playing nicely with the flare demos:
Download zip http://sourceforge.net/projects/prefuse/files/flare/alpha-20090124/prefuse.flare-alpha-20090124.zip/download
extracted flare.apps to my desktop and build/flare.swc to my desktop
In FlashBuilder/Eclipse import a project (existing project) select the flare.apps folder on the desktop.
replace the existing library reference to bin/flare.swc with the one from the desktop. When I imported the project it had in the project properties->ActionScript Build Path I selected the bin/flare.swc entry it had and hit remove, then hit add swc and browsed for the one extracted to my desktop from the flare.zip.
Compile/Run
That all worked great with Flex 3.4 (Flare is out-dated if you haven't noticed). Upping my SDK to 4.6 I had to replace JSON (ambiguous due to a new one in the default package) with com.adobe.serialization.json.JSON. With Flex 3.4, did you see any errors relating to JSON? I don't have 3.4 on my system so I am using 3.6 right now and see many errors regarding the ambiguity of JSON. With regard to 3.4 I had no JSON errors, think the Class may have been introduced around when 3.6 was put out so that makes sense too... the issue is if you import JSON from some package but then it also has JSON in the default package, it doesn't know which one you want to use, if you use the fully qualified class name wherever you were using the shortened version it will remove the ambiguity so where you had JSON.decode just replace with com.adobe.serialization.json.JSON.decode, believe the one in the default package is the new one and doesn't match up to the old one's interface (method names) 100%.
After building with 4.6 it's a mixed bag... I see the loading bar and all the lines between dependencies but not seeing the labels themselves, my guess is something to do with the change in the font/text rendering engine between versions is making a difference though I'm not sure immediately how to resolve that. No errors compiling/running though.
Edit 2 good deal just had to add this to the font embed for it to work in 4.6
,embedAsCFF='false'
[Embed(source="verdana.TTF", fontName="VerdanaCust",embedAsCFF='false')]
Let me know if you try out these steps and still have issues, or if this helps you resolve your problems.
Edit 3
Also added you on my gmail alternatively can chat on SO directly to keep any relevant information connected to this QA