Where will Flash look first for a Class definition: in an AS file (source path) or a linked SWC file (library path)? - classpath

I want to accelerate the compilation of a large Flash IDE project by pre-compiling some packages or parts of packages into a SWC file, which I will include in the "Source Path" section of the Advanced AS3 Settings under Flash Publish Settings.
The problem is that I don't know where the compiler will look first for a class definition, given that it should (in theory) be able to find a class definition in both the SWC and the source path, since the source of the SWC is in the source path (i.e. the main FLA and the linked SWC share the same source path or root directory).
While you can arrange the order for source paths (paths including AS files), and you can arrange the order of library paths (paths to SWC files or folders containing SWC files), you cannot specify whether source paths or library paths are searched for definitions first.
Will the class definition in the library path (AS file) or the source path (SWC file) be used? Even though they may represent the same class definition, I will not see my compilation times decrease unless it uses the SWC file.
Edit:
The only documentation I've found says "If you use the Library path, be sure none of the compiled code in the SWC files is duplicated in uncompiled AS files in the Source path. The redundant code will slow down compilation of your SWF file." I love how it mentions the performance hit without mentioning which definition will actually be used :P

The AS file is the last part the complier look for. So AS file will override the class in swc library.

Related

How to refer to generated source files?

How do I refer to files generated by a sourceGenerators sbt task? I know that the source file is deposited to target/scala-<version>/src_managed/path/to/File.Scala but I don't know how to reference it in my project. Any ideas?
/server
/app
/models
Driver.scala (can't use MyGeneratedCode here)
/project
/src/main/scala/
ModelGenerator.scala (the code used to create MyGeneratedCode.scala)
/target/scala-2.12
/classes
/src_managed
/main/generated/
MyGeneratedCode.scala
The generate file works as any normal Scala file but on a fancy folder so it is not tracked by git (or any other VCS).
As any Scala file, it should had a package whatever statement at the beginning, from which you can latter import your classes (import whatever._). Usually the package name matches the directory structure, but they do not have to (specially since it is just generated file).
If it does not have a package, all its members probably resides on the __root__ package. But that probably would cause troubles, I would suggest editing your generator to add a package statement instead.

Adding .jar files to Matlab

Bio-Formats is a pretty common toolbox used in MATLAB, and I want to use it to directly work with .nd2 files. As the website instructs (https://docs.openmicroscopy.org/bio-formats/5.8.2/users/matlab/index.html), I downloaded and unzipped the folder. I then added the .m files to my Matlab path, including the .jar file 'bioformats_package.jar'. However, I can't use any of the functions due to this error:
Error using bfopen (line 100)
Missing Bio-Formats library. Either add bioformats_package.jar to the static Java
path or add it to the Matlab path.
I tried a few things, eg adding 'bioformats_package.jar' to the static Java path. I am inexperienced when it comes to working with libraries etc, so I may be missing something simple.
For reference, all of my work/files are in '\Users\user_name\Documents\MATLAB\Image Analysis'
I pasted all of the files from the Bio-Formats website directly in this 'Image Analysis' folder, along with the rest of my .m files. Yet I can't use Bio-Formats.
I think you just need download bfmatlab.zip and extract it, then move \bfmatlab\bfmatlab to your current MATLAB path, or add the bfmatlab folder itself to MATALB path. In your case, moving all files under \bfmatlab\bfmatlab to '\Users\user_name\Documents\MATLAB\Image Analysis' will work fine.
When bfopen is called, internal bfCheckJavaPath function will add bioformats_package.jar to MATLAB's dynamic Java path, so you don't need to add this jar to Java path by yourself.

Unable to generate javadoc in Eclipse for linked source files

I am unable to generate javadoc for linked .java files using Eclipse Mars.
This shows how my project is set up:
I am able to run the program.
The source file is in a folder named foo, to match the package declaration:
I select Project > Generate Javadoc... and check the package:
I agree to all of the default options.
I get this output in the console:
Loading source files for package foo...
Constructing Javadoc information...
javadoc: warning - No source files for package foo
javadoc: warning - No source files for package foo
javadoc: error - No public or protected classes found to document.
1 error
2 warnings
Adding javadoc comments to the source code makes no difference.
I have no trouble generating javadoc when I do not have linked source files.
How do I set up links to source files so I can generate javadoc?
When you do Project > Generate Javadoc... it launches the external program javadoc part of the JDK typically. The javadoc program does not understand/know about Eclipse linked resources, so it sees the empty folder.
How do I set up links to source files so I can generate javadoc?
Short answer is you cannot with links at the file level.
Use Links to src folder
Rather than doing a link to files within a package, make the link to the containing source folder. In your screenshot you don't have a src folder, but you could create one that is linked.
For example, I have a project called demoforso, in it I create a folder called src that is linked to D:\tmp\src and add src to classpath. When the javadoc is run on this project, it passes D:\tmp\src as the sourcepath.
Use Javadoc views in Eclipse
(i.e. Don't generate Javadoc at all, granted possibly not useful in your case, but included for completeness.)
The hovers and Javadoc view in Eclipse means that you never need to generated Javadoc for your own use.

how to use .swc file in flex project

I have a flex project in which I need to as3xls library (.swc file) in my project. Now I have downloaded that swc file and included it in flex-sdk\frameworks\libs and I am able to use the .as files of that swc file.
Now If I have tried to put the swc file in my local project, for e.g. in one of my package of components and added it to the class path (using eclipse project properties -> flex build path) and tried to use it from that location but I am unable to compile the project as its not able to import the .as files.
Can anybody suggest the location where I should add the .swc file and use it in my project ?
If you're using Flash Builder, I generally create a libs folder under the project:
Then, reference the SWC by selecting the project Properties, ActionScript Build Path where you can either add an individual SWC or SWC Folder:
Check out my blog post on How to use a SWC.
Here is the important points:
There are three different ways that you can use the classes that
reside in a SWC file:
* Library Path in Project Properties: This is how
I use SWCs most commonly.
* Libs folder: The libs folder was introduced
in Flex Builder 3. If you put a SWC into a libs folder it is
automatically added to your library path, and all the classes in the
SWC are available from your project
* Library Path command line
argument: You can use the library path argument to the mxmlc command
line compiler.

Emacs CEDET EDE non-trivial project setups

Trying to understand how EDE works by using it to generate Makefiles for
a project directory that contains several targets under a specific
hierarchy. I'm not having any luck, and the info pages don't seem to
answer my question.
My directory structure looks something like:
(The asterix (*) marks files containing main() functions)
research/
flow/
flow.cpp
flow.hpp
program.cpp *
samples/
sample1.yuv
utils/
yuvreader.cpp
yuvreader.hpp
tests/
yuvreader_test.cpp *
I want to create EDE project(s) with one or more subprojects; or maybe I
just want one or more targets...?
flow's program.cpp requires flow/ and utils/ sources, but yuvreader_test
only requires utils/ sources.
I did ede-new in the root directory, and all subdirectories. I also did ede-new-target in the root directory, but when adding source files in subdirectories, it does not recognize the target I created.
I would appreciate it if someone could point me to some more complicated
Project.ede files for something like I'm trying to do. You can guess
that I have more subdirectories containing class code files, some of
which have standalone programs that use that code; also I have more test
code under tests/. Any example files/command workflows would be
appreciated.
The EDE feature that will generate Makefile or Automakefiles has a few more constraints than either Make or Automake. For example, the files belonging to a target must be in the same directory as the project containing the target. In your example, you would probably have no projects in your root directory.
To bring multiple sources together into a single program, a simple mechanism is to have each subdirectory create an archive (.a) or a shared lib (.so) that is linked together in your program.
If that is too constraining, you can also write your own automake files, and EDE will read those directly, so you can have a more complex build procedure as needed.
The CEDET distribution uses EDE as its build process, so you could look at that as a complex example. It doesn't build C++ files though, so it may not be as helpful as you would like.