Adding MIDlet-attributes to JAD file - java-me

I am using J2ME Polish to build an application for nokia s40 phones. When i finished packaging the app, i find out that the manifest attributes: "MicroEdition-Configuration" and "MicroEdition-Profile" which is available in the manifest file is not present in the JAD file i.e
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
I am using Netbeans to build my project, don't know where the problem will be coming from, any help?

Just open your build-impl.xml in your nbproject folder and in the jad section add this:
attribute name="MicroEdition-Configuration" value="CLDC-1.1"/>
attribute name="MicroEdition-Profile" value="MIDP-2.0"/>
Of course change them accordingly.

Related

Flutter - How do I play ambient sounds?

I am developing a flutter app. I want to let the user select some sounds.
When selected, I want the app to play its mp3 file in the assets folder. I tried with AudioPlayer plugin but I haven't achieved to play local files...
I have been searching for awhile and I haven't found any good answer to my questions, furthermore, the posts were created 2 or 1 year ago, so maybe we need an updated answer.
I have found this post: How to play local mp3 file with audioplayer plugin in Flutter
but my project doesn't find this package import 'package:path_provider/path_provider.dart'; [THIS PART IS SOLVED]
And when flutter will have a built-in audio manager? Are they/you working on it?
Thanks in advance!
EDIT: Also, I would like to play different mp3 at the same time, with different volume. Is it possible?
That import directive you see tells Dart that a particular source file uses classes from a different source file. The package: prefix tells Dart that the imported file is part of an external dependency. So you need to tell your project that you have a dependency. This is done in the pubspec.yaml file.
Dart's pub dependency manager takes care of finding the right version of the dependency for you, and downloading it. Add the path_provider package to your pubspec.yaml file. Each package's installing tab shows how to do this.
You can find a whole library of useful flutter (and Dart) packages here.
path_provider is a special type of package called a plugin which contains some Dart code together with iOS and Android specific code. This is necessary because playing audio or creating local files is platform specific.

p:photocam disable warnings

I am using photocam from Primefaces to capture a simple photo.
When a computer that has no webcam access the web page, an error
"Webcam.js Error: Could not access webcam."
shows up. Is it possible to supress this warning when the computer does not have a webcam? How can I do it?
I am using Java, a Web Maven Project with JSF and primefaces 6.0.
The solution was to edit the js file related to photocam (photocam.js).
To do that, I used 7-zip to access the file (inside Primefaces jar, Maven Repository) and extracted it.
After the extraction and the modifications, I replaced the older file.
The modification was to return null instead of the error message.

run codenameone j2me application on samsung devices

I create j2me application with codenameone and it works well in Nokia phones, however I wanna install or run it on Samsung devices (for instance S8300) I'll get error.
How can I fix this error?
I searched for this device's details and I found it doesn't have operting system but it can run java with MIDP2.0. What can I do for these device types? How can I run it on these devices?
Thanks in advance.
Check that you didn't use Java 5 language features and limited yourself to the CLDC 1.1 API specification in terms of classes such as java.util.
Codename One includes support for these features which work well on Nokia where the VM is more compliant but fails on some devices when these features are used.
Several things things may be the problem:
1) the jar file is to big. Java device have often constraints for max size of jar file, some of them unbelievable small. try to install a smaller jar file, like a hello world.
If this is problem, make sure you use "obfuscate", as it also removes unused code from the jar file.
2) Depending on operator branding, Samsung devices often do not allow to install the jar file directly from PC (with bluetooth or usb cable) :-(
What is possible only is called OTA-Download. There you need to create a jad file and a jar file, put them on a webserver, and call the url from jad in the mobile browser of the device.
You need to change the MIDlet-Jar-URL inside to have the absolute url of the jar file on your web server.
This is all quite complex. to check that your webserver is correctly set up and that that jad file has no syntax errors, you can use my jad checker:
jadcheck.appspot.com
We must create UI by hard coding not using lwuit or codenameone designer.
cause of some devices that don't have an OS and just support MIDP can't run these type of applcations which are create by lwuit or codenameone desiner.
Maybe it cause of resource file path in devices!

Liferay - Share Utils class between 2 different portlets

I'm developing a Liferay application, consisting on 2 different portlets, an both have to make certain operations in common, so I decided to put that operations in static methods in an external Utils class.
I have to externalize that class to avoid duplicating the same code in both portlets, and I want to have the portlets in different WAR files.
I know I can package the Utils class in a JAR file, but we are still developing and we don't want to regenerate the JAR and restart the Tomcat for every change.
Which is the best option and how can I perform it?
If you're using the Liferay SDK, you can use the clients (recently changed to shared) directory to put your common code.
A good example is how deploy-listener-shared is used in conjunction with deploy-listener-hook.
From what it looks like, all the configuration you need to do is to modify your build.xml files that will use the client\shared classes. If you look at build file of deploy-listener-hook you can see all you need to add is the.
For the new SDK:
<property name="import.shared" value="my-utils-shared" />
For the older SDK:
<property name="dependent.clients" value="my-utils-client" />
Hope this helps!
There is another method that involves building a JAR file but it doesn't require a server restart (on Tomcat at least).
Write a build script for your JAR file so it compiles, builds the JAR and finally copies it to the following location:
{tomcat}/webapps/ROOT/WEB-INF/lib
Then in your portlet open the "liferay-plugin-package.properties" (in Liferay Developer Studio / Liferay IDE this should open with a nice GUI).
Then add the name of your JAR to the "portal-dependency-jars" list in this file so in the source it would like (Or just hit the "Add" button in the GUI and select the JARs you want):
portal-dependency-jars=my-custom-lib.jar,my-other-custom-lib.jar
Save the file, and redeploy the portlet, and the JAR will be copied across when the portlet is deployed.
I've used this method for custom JARs, and 3rd party JARs that I've needed to use in my portlets.
For the development phase just package the jar file with both applications.
Unless one application depends on the other somehow it is completely ok.
Another solution is to use JRebel tool. It will allow you to redeploy jar in tomcat without restarting.
Also you may have several portlets in one .war. You may just define them both in portlet.xml.

Liferay 4.2 to 5.2 upgrade question: How to predeploy portlets in Liferay 5.2

We are upgrading from Liferay 4.2 to Liferay 5.2.2. We are using the EXT environment. Previously, in 4.2 there was a directory called /ext/portlets. According for 4.2 doc,
"Portlets placed in this directory will be automatically deployed to the application server when running the ant deploy target from the /ext directory"
Is there an equivalent for 5.2?
At first I though that /ext/modules would do the trick, but it looks like the build file inside of /modules just unwars my portlet war file. This is not sufficient to deploy the portlets, since Liferay needs to augment the web.xml in my portlets' WEB-INF to insert servlet mapping tags.
Just for comparison, 4.2's build file in /ext/portlets directory, would call com.liferay.portal.tools.PortletDeployer and pass my war file as an argument.
I looked around, the PortletDeployer still exists in the 5. 2 code base. It is now located in com.liferay.portal.tools.deploy, but it is not called anywhere from the build files. . I wonder if this means that there is no longer a way to predeploy portlets in 5.2 Liferay. Does Liferay have to be up and running to deploy in 5.2?
If your portlets are bundled as war, and are not required to run in the same webapp as Liferay, just put your wars in the liferay deploy dir. This directory is defined in your portal-ext.properties file, and overrides the bundled portal.properties file definition of
auto.deploy.deploy.dir=${liferay.home}/deploy
At startup, Liferay scans this directory and installs any found "plugin" (portlet, theme, layout, hook...).
You may be interested in the plugins SDK for the portlet and theme creation as it could help you separate portlet developpement and core portal extension.
You should also be careful regarding your theme, it may require migration to comply to the 4.3 onward themes.

Resources