Handling dependencies in blackberry development - build

How can I handle 3rd party dependencies in a .jad file? Is it possible to bundle a .jar? Do you need to unpack it and include the .class files?

See approach of working with kXML2 open source library:
for release you have to preverify it & build proj with ant:
Ahmad Ferdous Bin Alam - How to Import kxml jar File to Your Project
Slashdev - BlackBerry Development with Ant & Eclipse
UPDATE:Tutorial: How To Use 3rd Party Libraries in your Applications
for debug you have to add kXML sources and org.xmlpull.v1 sources to your BB project

JAR files can NOT be combined with COD files. You first need to convert these JAR files to COD files (and you should sign them as well). If additional JAR files are supposed to be used as library COD files you need to use the -library switch instead of -midlet for the rapc.exe compiler.
Once you got your COD files you need to refer in your JAD file to all of the COD files including file sizes. The COD file might look like:
Manifest-Version: 1.0
MIDlet-Data-Size: 2048
MIDlet-Version: 1.4.1
MIDlet-Jar-Size: 136999
MIDlet-Icon: /icons/myprogram.png
MicroEdition-Configuration: CLDC-1.1
MIDlet-Jar-URL: myprogram.jar
MIDlet-Name: myprogram
MIDlet-1: myprogram,/icons/myprogram.png,com.stackoverflow.myprogram
MicroEdition-Profile: MIDP-2.0
MIDlet-Vendor: My Company
Ant-Version: Apache Ant 1.6.5
Skylab-Build-Number: 2968:2970
Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
RIM-COD-Module-Dependencies: net_rim_cldc,lib_1,lib_2,lib_3,lib_4,net_rim_locationapi
RIM-COD-URL: myprogram.cod
RIM-COD-Size: 77576
RIM-COD-URL-1: myprogram-1.cod
RIM-COD-Size-1: 29960
RIM-COD-URL-2: lib_1.cod
RIM-COD-Size-2: 28668
RIM-COD-URL-3: lib_2.cod
RIM-COD-Size-3: 8712
RIM-COD-URL-4: lib_3.cod
RIM-COD-Size-4: 18232
RIM-COD-URL-5: lib_4.cod
RIM-COD-Size-5: 12752
RIM-MIDlet-Flags-1: 0
RIM-MIDlet-Position-1: 0
RIM-COD-Module-Name: myprogram
RIM-MIDlet-NameResourceId-1: 0
RIM-COD-Creation-Time: 1143020761
RIM-COD-SHA1: 0b 9f b1 da 47 bc 6f 97 62 eb 32 66 77 ca a9 6f 24 4d 10 8a

Can't speak too much for J2ME generically but for BlackBerry you can turn compiled .jar files into .cod files (the BlackBerry binary file format - basically an optimized .jar) and include those along with your application .cod files. You will have to list the additional .cod files in the .jad.
This link from the BlackBerry knowledgebase should help.

If library is not a BlackBerry COD file but a plain MIDP 2.0 JAR file then what you have to do to bundle that with your application is to do the following using the Eclipse JDE plugin:
Right-click your project file and select: "Build Path" > "Configure Build Path...". This will open the Properties screen with "Java Build Path" option showing.
Click on the "Libraries" tab and click "Add JARs..." (or "Add External JARs...") and pick the JAR you want in the next dialog and "OK" it. You should see the JAR that you picked in the list.
Now, click on the "Order and Export" tab and check the checkbox next to the JAR that you added. This makes sure that the build step actually merges this JAR file into your applications output and creates a COD file that includes both.
The above method works for me but has two problems:
Everytime I change anything related to the "BlackBerry Project Properties" of the project (such as changing the Title or Version of the application), this setting reverts so I have to go through it again. This is a major inconvenience but the steps to follow are not that complicated.
You have to preverify the JAR files that you include as explained in the kXML2 link given in this answer. Failing to do so will result in random verification errors (random in the sense that I don't get them all the time).

Related

wix4 wixproj document element name 'Project' is invalid

When trying to build a wix4 project using a the new wix toolset provided like this:
wix build -d Configuration=Debug MySetup.wixproj
I get this error:
error WIX0048: The document element name 'Project' is invalid. A WiX source file must use 'Wix' as the document element name.
The project consists of 5 files. The wixproj file which I suspect will orchestrate the build. 3 wxs one that defines the basics from the setup and 2 which are filled up automatically by the HeatDirectory (defined in the wixproj). And last file is a xslt.
Those files have been migrated from wix3 using the VS 2022 HeatWave extension.
Did the migration miss some step or should I call the build in a different way?
To me looks like the wixproj file is missing some basic info to let the wix build command to work properly.
wix build is for building WiX source files without MSBuild. To build a .wixproj, use msbuild or dotnet build.

WinJS Sample Code js file missing?

"WinJS ToDo Sample for Multi-Device Hybrid Apps" Sample Code Project (http://code.msdn.microsoft.com/WinJS-TODO-Sample-for-17295485/sourcecode?fileId=114491&pathId=1137423199), I tried download and run it , but the index.html file include
three file for winjs reference : ./css/ui-light.css , ./scripts/frameworks/base.min.js , ./scripts/frameworks/ui.min.js , can't be found in the project .
what's i missing some thing ?
The sample projects have been authored in a way that the requisite dependency frameworks will be automatically downloaded when you run the project for the first time.
However, the libraries may fail to download in case the script does not have the right permissions to execute. To fix this:
Open the folder where you’ve downloaded the sample app
Identify the FetchRequirements.ps1 file and right click it
Choose “Properties”
Click the Unblock button if it shows up
Try to run the project again through Visual Studio

How to add FastMM to a C++ Builder project?

I'm trying to configure FASTMM4 for Builder C++ 6 and the steps I followed are;
Downloaded zip from sourceforge.
Under the Project -> Options -> Linker menu I unchecked "Use Dynamic RTL".
Unzipped the contents at C:/tools/FASTMM and added FASTMM4.pas file to my test C++ VCL project.
Simply compiled the unit from Project menu and got a new FastMM4.hpp file in FastMM folder.
Included FastMM4BCB.cpp file in my project and also wrote #include <FASTMM4.hpp> on the top.
Added path to FastMM_FullDebugMode.dll and FastMM_FullDebugMode.lib and moved FastMM_FullDebugMode.dll to the Bin folder in Builder C++ install directory.
Enabled the line {$define FullDebugMode} from FastMM4Options.inc.
Did I miss anything? why do I have the following errors?
I found the instructions in FastMM4BCB file itself and I got it working.
Usage:
Copy FastMM4BCB.cpp, FastMM4.pas, FastMM4Message.pas, FastMM4Options.inc,
and FastMM_FullDebugMode.lib to your source folder.
Copy FastMM_FullDebugMode.dll to your application's .exe directory (if you
intend to use FullDebugMode).
To your project, add FastMM4Messages.pas first, then FastMM4.pas, then
FastMM4BCB.cpp. On compiling the .pas files, .hpp files are created and
imported by the subsequent files.
Add USEOBJ("FastMM4BCB.cpp") to your project file, BEFORE any other
USEFORM directives.
Under the Project -> Options -> Linker menu uncheck "Use Dynamic RTL"
(sorry, won't work with the RTL DLL).
FastMM will now install itself on startup and replace the RTL memory manager.

The Xcode4.2 with ASIHTTPRequest configuration

I installed ASIHTTPRequest follow the document on their official site . But still have errors here. Please help. The related info is as follows :
Xcode 4.2 build 4D58
Lion 10.7.2
I can not upload the images because I am rookie here.(now I upload to site and linked here)
http://roundmov.com/project.png
build settings and build phrase png is here :
http://www.roundmov.com/buildphases.png
I have added all the files including external dir. and added libraries ,all of them in docs mentioned.
Even added the header search paths as $[SDKROOT]/usr/include/libxml2
But still have 107 or 67 errors . This problem has boring me one more day.
Thanks a lot in advance!
How can I disable ARC for a single file in a project?
If you follow the instructions here for all of the ASIHTTPRequest files it will compile as you need to disable arc on those files.
ah right, yep, so ASIHTTPRequest isn't ARC compatible and it doesn't look like that will change. i've never actually "downgraded" a project from ARC to non-ARC, but if it's something you've just started on you could create a new project and uncheck the ARC checkbox when you do and re-add all your existing files. this will mean you need to handle the memory management of objects (retain/release/autorelease).
this thread has more info:
https://groups.google.com/group/asihttprequest/browse_thread/thread/3f26e442dc6868e8
as an alternative, you could look into AFNetworking:
https://github.com/AFNetworking/AFNetworking
you still need to take some extra steps to get it working with ARC, but it doesn't look too bad.

How to include net_rim_api_wlan_hotspot in my BB project?

I have a project that is going to create hotspot client, so it imports net.rim.device.api.wlan.hotspot.*
When the code runs it complains that it cannot find net_rim_api_wlan_hotspot. If I display the table-of-contents for the jar file, *\BlackBerry JDE 5.0.0\lib\net_rim_api.jar, the file class files are listed.
What steps am I missing to build the project correctly?