Intellij Default SDK Unused Path Issue - java

I try to set the default sdk to C:\Program Files\Java\jdk1.8.0_144. It works fine, but when i open the project again it changes to a Python path which doesn't exist anymore. On Platform Settings SDKs there is not any Python path too.
How can i remove this path and let the Java JDK be the default sdk?
Edit: I think i found the problem, but i don't know how can i fix it. Here is a component of the project.default.xml file
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Python 3.5.2 (C:\Users\Adam\AppData\Local\Programs\Python\Python35-32\python.exe)" project-jdk-type="Python SDK" />
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="reference.projectsettings.compiler.javacompiler" />
<property name="nodejs_interpreter_path" value="C:/Program Files/nodejs/node" />
<property name="JavaScriptPreferStrict" value="false" />
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
</component>

Check project's .idea/misc.xml there are some configs of your project. Also check this and go to options\jdk.table.xml. If you won't find anything strange there, then it's better to report this on the JetBrains Issue tracker

I have fixed it with the help of #Russiancold's answer. I edited the project.default.xml file.
first removed this component
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Python 3.5.2 (C:\Users\Adam\AppData\Local\Programs\Python\Python35-32\python.exe)" project-jdk-type="Python SDK" />
then added this component
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />

Related

Difference between certificates for APNs

Is it any difference between certificates for development and production servers?
If I have my_certificate.p12 and for ApnService provide that information
<bean id="apnsServiceFactory" class="org.apache.camel.component.apns.factory.ApnsServiceFactory">
<property name="feedbackHost" value="feedback.sandbox.push.apple.com" />
<property name="feedbackPort" value="2196" />
<property name="gatewayHost" value="gateway.sandbox.push.apple.com" />
<property name="gatewayPort" value="2195" />
<property name="certificatePath" value="file:etc/my_certificate.p12" />
<property name="certificatePassword" value="111" />
</bean>
would it be equal with that?
<bean id="apnsServiceFactory" class="org.apache.camel.component.apns.factory.ApnsServiceFactory">
<property name="feedbackHost" value="feedback.push.apple.com" />
<property name="feedbackPort" value="2196" />
<property name="gatewayHost" value="gateway.push.apple.com" />
<property name="gatewayPort" value="2195" />
<property name="certificatePath" value="file:etc/my_certificate.p12" />
<property name="certificatePassword" value="111" />
</bean>
I mean, will I be able to get some pushes and feedback with only 1 certificate, or I must have both?
And for test in development, should I use gateway.sandbox.push.apple.com or I can use feedback.push.apple.com ?
While you are in development mode, i mean for the builds installed in device via Xcode or OTA, the notifications must use development certificates and need to use gateway.sandbox.push.apple.com for sending notifications.
But while in production mode, i mean once you have tested everything looks good, and uploaded build to AppStore/TestFlight. So, for those builds, you required to use production/distribution certificates and required to sent via feedback.push.apple.com.
UPDATE:
If you required common way for both development and distribution. Then stop using certificates, instead start using token based APNs keys for the same. You can refer more detail about token based APNs keys over here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token-based_connection_to_apns

Birt inserts an extra space if part of the word is highlighted using an HTML tag

I had the following problem with reports in the Birt. I want to be able to highlight text in a report using HTML tags <b>, <i>, <u>, etc.
If I highlight the whole word, then everything works fine. But if I highlight only a part of the word, then Birt splits such a word with an extra space:
DataSource:
<data>
<text><b>This</b> is a text. T<b>his</b> is another text.</text>
</data>
.rptdesign:
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.6.0.v201606072122</property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<data-sources>
<oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data Source" id="4">
<property name="FILELIST">data_sources/test_data_source.xml</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.datatools.enablement.oda.xml.dataSet" name="testDataSet" id="5">
<list-property name="columnHints">
<structure>
<property name="columnName">text</property>
<text-property name="heading">text</text-property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">text</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">text</property>
<property name="nativeName">text</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[table0#-TNAME-#table0#:#[/data/text]#:#{text;STRING;}]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>2.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:identifier>
<design:name>text</design:name>
<design:position>1</design:position>
</design:identifier>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>text</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
<list-property name="privateDriverProperties">
<ex-property>
<name>MAX_ROW</name>
<value>-1</value>
</ex-property>
<ex-property>
<name>XML_FILE</name>
</ex-property>
</list-property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2"/>
</page-setup>
<body>
<text-data id="6">
<property name="fontFamily">"Times New Roman"</property>
<property name="fontSize">14pt</property>
<property name="textAlign">justify</property>
<property name="dataSet">testDataSet</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">text</property>
<text-property name="displayName">text</text-property>
<expression name="expression" type="javascript">dataSetRow["text"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<expression name="valueExpr">row['text']</expression>
<property name="contentType">html</property>
</text-data>
</body>
</report>
Result in Word:
This is a text. T his is another text.
How to make so that the extra space didn't appear?
The my test project can be downloaded here.
I tried your file with eclipse-reporting-neon-R-win32-x86_64.zip and it worked fine. Try upgrading your editor or viewer.
This is a text. This is another text. <<- formatting removed but no spaces when run with the latest viewer.
If you are just needing this in Word try exporting as DOC instead of DOCX.
A bit late, but I fixed this bug in my fork of BIRT,
see https://github.com/hvbtup/birt/commit/fee8b76a1c2b3f2df097d9f23214d0ebc1770f61
You may fork the official BIRT repo (https://github.com/eclipse/birt) and apply this fix to the code.

How do I add JDBC drivers and configure JDBC Resources in Payara Micro?

What are my options to set up JDBC drivers and resources when using Java EE Payara Micro?
This method combines answers from Mike and Adam Bien via tainos. It involves making a new domain.xml, which is a Payara config file. No application modification is needed if it worked with full Payara. The example below is for PostgreSQL JDBC.
Open payara-micro.jar with an archive manager and extract the file /microdomain.xml.
Open microdomain.xml in a text editor.
If your application was already deployed to a full Payara, you can copy-paste the changes below from the full Payara's domain.xml.
Add right above the line containing </resources>, using your dbname, dbuser, dbpassword, hostname:port and poolname:
<jdbc-connection-pool connection-validation-method="auto-commit" driver-classname="org.postgresql.Driver" res-type="java.sql.Driver" name="poolname" is-connection-validation-required="true" connection-creation-retry-attempts="3" validate-atmost-once-period-in-seconds="60">
<property name="URL" value="jdbc:postgresql://localhost:5432/dbname"></property>
<property name="user" value="dbuser"></property>
<property name="password" value="dbpassword"></property>
</jdbc-connection-pool>
<jdbc-resource pool-name="poolname" jndi-name="jdbc/poolname"></jdbc-resource>
Add right above the line containing </server>:
<resource-ref ref="jdbc/poolname"></resource-ref>
Save and close the text editor.
Start Payara micro from command line, using your paths and filenames. Linux syntax:
java -cp "/opt/jdbc/postgresql.jar:/opt/payara/micro.jar" fish.payara.micro.PayaraMicro --deploy webapp.war --domainConfig microdomain.xml
Add the datasource definition to your web.xml and then add the jar file for the JDBC jar into your WEB-INF/lib. Then deploy the war file as usual to Payara Micro.
<data-source>
<name>java:global/ExampleDataSource</name>
<class-name>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</class-name>
<server-name>localhost</server-name>
<port-number>3306</port-number>
<database-name>mysql</database-name>
<user>root</user>
<password>root</password>
<!-- Example of how to use a Payara specific custom connection pool setting -->
<property>
<name>fish.payara.sql-trace-listeners</name>
<value>com.sun.gjc.util.SQLTraceLogger</value>
</property>
</data-source>
There is a complete example of how to do this on the Payara Examples GitHub repository. See Datasource example on Payara GitHub
You can configure JDBC in a normal domain.xml and supply that to Payara. If you're unsure, you can always take an existing domain.xml and use the JDBC configuration from that.
Payara Micro has a few command line options, one of which allows you to specify an alternative domain.xml file:
java -jar payara-micro.jar --deploy myApp.war --domainConfig mydomain.xml
If you're bootstrapping Payara Micro programmatically, you would use:
setAlternateDomainXML(File alternateDomainXML)
As the accepted answer didn't work for me a figured a different and slightly easier way. You still rely on the custom domain.xml, but the startup command can be simplified:
java -jar /opt/payara/payara-micro.jar --deploy webapp.war --domainConfig domain.xml --addJars /opt/mysql-connector-java-5.1.40-bin.jar
This call doesn't require you to know the Main class.
Adam Bien answered this question in his 19th Airhacks video.
My take, When used with custom resources is best used as an embedded server, in the main we configure the JDBC resources and with maven dependencies we include the needed drivers inside the jar or war files.
One of options is glassfish-resources.xml
<!-- db1 -->
<jdbc-connection-pool
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" name="db1"
res-type="javax.sql.DataSource"
steady-pool-size="1"
is-connection-validation-required="true"
connection-validation-method="meta-data"
max-pool-size="10">
<property name="password" value="icoder_pwd"/>
<property name="user" value="icoder_user"/>
<property name="databaseName" value="icoder_db"/>
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3310"/>
<property name="zeroDateTimeBehavior" value="convertToNull"/>
</jdbc-connection-pool>
<jdbc-resource pool-name="db1" jndi-name="jdbc/db1"/>
<!-- db2 -->
<jdbc-connection-pool
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" name="db2"
res-type="javax.sql.DataSource"
steady-pool-size="1"
is-connection-validation-required="true"
connection-validation-method="meta-data"
max-pool-size="10">
<property name="password" value="icoder_pwd"/>
<property name="user" value="icoder_user"/>
<property name="databaseName" value="icoder_db"/>
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3311"/>
<property name="zeroDateTimeBehavior" value="convertToNull"/>
</jdbc-connection-pool>
<jdbc-resource pool-name="db2" jndi-name="jdbc/db2"/>
</resources>
Complete example with entity manager implementation you can find:
https://github.com/igorzg/payara-micro-jpa-multi-tenancy

How to use a Glade UI (.glade file) in a Java Gnome/GTK program?

I've did a research on the Internet looking for tutorials/documentations to explain me how to use a UI designed in Glade in a Java Gnome project, but no luck. I already know how to create a UI from the code using the Java Gnome/GTK. Anyway, I'd like to use a Glade UI that I've created in a Java Gnome/Gtk project, but I have no idea from where to start. Please tell me:
which packages I need to install;
how to integrate the UI I've create with Glade (the .glade file) with my Java Gnome/Gtk project (specifically in Eclipse);
and give an example.
Thanks in advance.
That's how my Glade UI looks (Just click the image to see it bigger):
This is the XML code of the UI above:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="window_position">center</property>
<child>
<object class="GtkFixed" id="fixed1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkEntry" id="entry1">
<property name="width_request">162</property>
<property name="height_request">25</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="valign">end</property>
<property name="invisible_char">•</property>
</object>
<packing>
<property name="x">11</property>
<property name="y">49</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry2">
<property name="width_request">162</property>
<property name="height_request">25</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="valign">end</property>
<property name="invisible_char">•</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="x">271</property>
<property name="y">49</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label">
<property name="height_request">25</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">*</property>
</object>
<packing>
<property name="x">216</property>
<property name="y">49</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button">
<property name="label" translatable="yes">Calculate!!!</property>
<property name="use_action_appearance">False</property>
<property name="width_request">84</property>
<property name="height_request">27</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="x">181</property>
<property name="y">93</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
Ok, you need to:
Init GTK library
Create a Builder object
Retrieve the window widget
Display the window widget
I assume you have already installed the java-gnome library in your Linux system and imported the jar in your eclipse project (project properties - java build path - add external jars - /usr/share/java/gtk.jar).
A sample code:
Gtk.init(args); //Init library
Builder b = new Builder(); //Create builder
b.addFromFile("filename.glade"); //Load layout from file
Window w = (Window) b.getObject("myWindowName"); //Retrieve an object
w.showAll(); //Show window
Gtk.main();
This is the way it should work. If you want to set a listener on an object, e.g. a button, you retrieve the oject by name as seen before with the window and then:
button.connect(new Clicked() {
#Override
public void onClicked(Button arg0) {
// Do what you want
}
});
Is it working for you? Well, it's not for me.
The problem was my code was throwing an exception when calling Builder.addFromFile(filename)
java.text.ParseException: Invalid object type `GtkLabel'
The error is about the first element in the tree.
After a deep research I found that, due to a known bug never fixed, you need to pre-define every widget before using it: in this case just call
new Label();
before creating the builder.
This is, obviously, not intended to work in this way, and will be fixed in the future.
More info on this issue:
Thread on java-gnome-developer mailing list
Thread on Java-gnome-hackers mailing list
Hope this can help...
You're supposed to use the Builder class (available since java-gnome 4.0.20). Create it, call the addFromFile method to give it your glade file. Then just call getObject with the name of the object as entered in the Glade UI to get that object. The only thing I see as missing is the signal connection stuff. The original GtkBuilder class (in C) provides much more, especially signals connection features (gtk_builder_connect_signals for example). So you may need to connect signals by hand if these features are not available in the Java bindings. This means setting in glade in the "signals" tab the signal you want to connect, and setting the name of the callback this signal will call. You can have a good guess of the basics by seeing how it's done in python:
http://python-gtk-3-tutorial.readthedocs.org/en/latest/builder.html
Just browse the web for "glade tutorial" or "glade gtkbuilder" for the rest.

How do I create a shortcut to a java application using Wix

How do I create a shortcut that launches a java application with arguments in Wix? This is my current schema and it compiles but doesn't place the shortcut on the desktop.
<DirectoryRef Id="DesktopFolder">
<Component Id="Shortcut" Guid="GUID-HERE">
<Shortcut
Id="desktopFoobarApp"
Name="Foobar 1.0"
Directory='DesktopFolder'
WorkingDirectory='INSTALLDIR'
Target="java"
Arguments="-jar [INSTALLDIR]FoobarApp.jar -v -f [INSTALLDIR]conf.cfg"
Icon="icon.ico" />
<RegistryValue Root="HKCU" Key="Software\Microsoft\FoobarApp" Name="installed" Type="integer" Value="0" KeyPath="yes"/>
</Component>
</DirectoryRef>
I've found out that you need to add the entire path to the target. The following code works:
<DirectoryRef Id="DesktopFolder">
<Component Id="Shortcut" Guid="GUID-HERE">
<Shortcut
Id="desktopFoobarApp"
Name="Foobar 1.0"
Directory='DesktopFolder'
WorkingDirectory='INSTALLDIR'
Target="[System64Folder]javaw.exe"
Arguments='-jar "[INSTALLDIR]FoobarApp.jar" -v -f "[INSTALLDIR]conf.cfg"'
Icon="icon.ico" />
<RegistryValue Root="HKCU" Key="Software\Microsoft\FoobarApp" Name="installed" Type="integer" Value="0" KeyPath="yes"/>
</Component>
</DirectoryRef>
I think you need to put <Shortcut> tag between <File> tag
Try this:
</File Id="id" Name="file name" Source="file source path">
<Shortcut Id="desktopFoobarApp" Name="Foobar 1.0" Directory='DesktopFolder'
WorkingDirectory='INSTALLDIR' Target="java"
Arguments="-jar [INSTALLDIR]FoobarApp.jar -v -f [INSTALLDIR]conf.cfg"
Icon="icon.ico" />
</File>

Categories

Resources