I'm trying to extend the BigBlueButton client with some proprietary classes. Specifically the phone module, where I added a file with my own code. When I write my own package name (org.mydomain.module.test ...) within the file, the compiler fails because it can't find my class from the mxml file. But when I use the original package name (org.bigbluebutton.module.phone ...) it compiles fine. Obviously when I use a different package name, the file is not included in the compilation. How can I change this?
This fails:package org.mydomain.module.test
{
public class MyTestClass
{
// code here
}
}
But this works:package org.bigbluebutton.modules.phone.test
{
public class MyTestClass
{
// code here
}
}
FYI: BigBlueButton uses ant to compile the client.
You didn't say where you put the files on disk, the package name should match the file's path in your project. Is that the case in both examples?
So when the package name is: org.mydomain.module.test
The class file should be saved in the path:
my_project_path/src/org/mydomain/module/test
Related
Really want to refactor and re-architect my project, it's become basically an 11k line monobloc that desperately needs to be split into multiple classes (and class files) inside a single package.
Yes I know I should have figured all this out when I started, but this is play not work and I was brand new to AS3 when I started. And I've kept building and building and it all works, it's just become very hard to manage.
My immediate goal is to define a package and then start breaking out function groups from the current main class into subclasses that extend the base. But I'm having a problem with the first step - defining the package.
I'm getting:
C:\Users\Vossie\Documents\Fex Line of Battle Project\trunk\line_of_battle\LOB_Core.as, Line 1, Column 1 5001: The name of package 'line_of_battle' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\Vossie\Documents\Fex Line of Battle Project\trunk\line_of_battle\LOB_Core.as
So I've checked:
package line_of_battle {
public class LOB_Core extends flash.display.MovieClip {
Filename is LOB_Core.as.
Path:
I explicitly added it to the class search path:
So:
Name of package agrees with name of folder (I actually pasted it from folder to .as file)
Package file is within that folder.
Class search path includes that folder
Shouldn't matter for this but filename and public class name match
I've searched stack overflow and one similar case involved a text case mismatch that I don't see here. One other related question the guy's question turned into just how to make classes and name the files correctly.
According to the documentation I read, this should work fine. Can someone tell me what I am missing?
Edit - This is the code that's triggering the error, LOB_Core.as:1102 -
var test:LOB_Scenario_Data = new LOB_Scenario_Data();
And the class that is calling:
package line_of_battle {
import line_of_battle.LOB_Core.*;
public class LOB_Scenario_Data extends LOB_Core {
public function LOB_Scenario_Data() {
// constructor code
trace("BIG MONKEYS");
}
}
}
I'm getting an error where FlxGame can't be found.
I am importing it and it's in the src folder. I copied the org folder from AdamAtomic-flixel-8989e50 into src. I'm writing this in FlashDevelop.
This is the error message:
C:\Users\***\Documents\Pong\src\Pong.as(8): col: 28 Error: The definition of base class FlxGame was not found.
Loading configuration file C:\Users\***\AppData\Local\FlashDevelop\Apps\flexsdk\4.6.0\frameworks\flex-config.xml
And this is my AS3 class:
package
{
import org.flixel.*;
/**
* ...
* #author ***
*/
public class Pong extends FlxGame
{
public function Pong()
{
super(320, 240, MenuState, 2);
}
}
}
I think the easiest solution would be to use the same file structure used in most Flixel example projects. You should keep it in your org folder.
Otherwise, maybe try changing your import statement to:
import src.flixel.*
It looks like you are in the early stages of making your game. If this is your first time with Flixel, I highly recommend this tutorial.
Download the tutorial files and open it as a project in FlashDevelop (look for the file ending in .as3proj).
Or look for any other Flixel example projects. If you're like me, you'll find it easier to start from a demo game and edit the existing code/build on it. This way you don't have to worry about configuring folder paths, etc. and the game runs from the very beginning. Makes it a lot less frustrating :)
I'm practicing web programming by using Spring 3.1, Hibernate and SiteMesh3.
I want to move 'sitemesh3.xml' file to other directory as WEB-INF/spring/ (not in WEB-INF directly). I've tried it, but sitemesh didn't work. Is it possible to move it? If it is, what properties, if any, should I add on other files like web.xml?
(I've read http://wiki.sitemesh.org/wiki/display/sitemesh3/Configuring+SiteMesh+3, which says "The configuration file should live in /WEB-INF/sitemesh3.xml in your web-application.")
Consider using java config, you can get rid of xml configuration totally.
Follow Sitemesh Java Config
Create a filter like this and register it in your web.xml or in java configuration file.
#WebFilter(urlPatterns = "/*")
public class ConfiguredSiteMeshFilter extends ConfigurableSiteMeshFilter {
#Override
protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
builder.addDecoratorPath("/*", "/WEB-INF/decorators/defaultDecorator.jsp");
}
}
I'm trying to add a DLL to my MvvmCross.core library project. However the included namespaces cannot be resolved for some reason, when I'm trying to refer the namespaces from one of the ViewModels. In object viewer I can see the included namespaces.
When I refer the same DLL from MvvmCross.Droid project I do not see the problem.
Unfortunate I do not have the source code so I need to refer it as a DLL.
I have tried this both on VS2013 and Xamarin Studio
Is your MvvmCross.core project a portable class library? If it is you won't be able to reference it.
What you can do is create another platform specific project, MyThing.Droid, and reference the .DLL. In the MvvmCross.core project, create an interface, IMyThingService. In MyThing.Droid create, MyThingService that implements IMyThingService and does the stuff you want. Now you can get a reference to IMyThingService and call DoStuff() from the MvvmCross.core project.
You can also use the plugin model provided by MvvmCross to accomplish this.
public class MyThingService : IMyThingService
{
public void DoStuff()
{
}
}
public interface IMyThingService
{
void DoStuff();
}
How do you create a namespace for a Dart class? I come from a C# background, where one would just use namespace SampleNamespace { }.
How do you achieve the same in Dart?
Dart doesn't have the concept of namespaces, but instead it has libraries. You can consider a library to be sort of equivalent to a namespace, in that a library can be made of multiple files, and contain multiple classes and functions.
Privacy in Dart is also at the library, rather than the class level (anything prefixed with an underscore is private to that library).
An example of defining a library (using the example of a utilities library:
// utilities.dart
library utilities; // being the first statement in the library file
You can make other files part of the same library by using the part keyword. Part files are only used to help organize your code; you can put all your classes in a single library file, or split them among several part files (or part files and the library file) - it has no effect on the execution. It is stylistic to put the main library file in a parent folder, and part files in a src/ folder.
Expanding the example to show Part files.
// utilities.dart
library utilities;
part "src/string_utils.dart";
part "src/date_utils.dart";
Those part files then link back to the library they are part of by using the part of statement:
// src/string_utils.dart
part of utilities;
// functions and classes
String reverseString(s) => // implementation ....
String _stringBuilder(strings) => // a private (to the library) function,
// indicated by the leading underscore
//... snip other classes and functions
Now that you have a library containing a function, you can make use of that library elsewhere by importing the library:
// my_app.dart;
import "path/to/library/utilities.dart";
main() {
var reversed = reverseString("Foo");
// _stringBulider(["a","b"]); // won't work - this function is
// only visible inside the library
}
If you want to alias your library to avoid clashes (where you might import two libraries, both containing a reverseString() function, you use the as keyword:
// my_app.dart;
import "path/to/library/utilities.dart";
import "some/other/utilities.dart" as your_utils;
main() {
var reversed = reverseString("Foo");
var your_reversed_string = your_utils.reverseString("Bar");
}
The import statement also makes use of packages, as imported by pub, Dart's package manager, so you can also host your library on github or elsewhere, and reference your library as so:
// my_app.dart;
import "package:utilities/utilities.dart";
main() {
var reversed = reverseString("Foo");
}
The pub dependency is defined in a pubspec.yaml file, which tells pub where to find the library. You can find out more at pub.dartlang.org
It is important to note that only the library file can:
contain import statements. Part files cannot.
contain the library keyword. Part files cannot.
contain part files. Part files cannot.
One final point is that a runnable app file can (and is likely to be) a library file, and can also be made of part files
// my_app.dart;
library my_app;
import "package:utilities/utilities.dart";
part "src/edit_ui.dart";
part "src/list_ui.dart";
part "src/foo.dart";
main() {
var reversed = reverseString("Foo");
showEditUi(); // perhaps defined in edit_ui.dart....?
}
The easiest way that I've found to create a namespace in Dart is this:
Say you have the files a.dart and b.dart containing the classes Apple and Banana respectively. Create a file called my_namespace.dart. In this example, it's residing in the same folder as the other two files. Export all the files that you want under your namespace from the my_namespace.dart file:
export 'a.dart';
export 'b.dart';
Then wherever you would like to use the exported code from these two files, use this:
import 'my_namespace.dart' as my_namespace;
// you can now access the classes under the same namespace:
final myApple = my_namespace.Apple();
final myBanana = my_namespace.Banana();
Another way to do this, which removes the need of the intermediary file my_namespace.dart, is to have several import statements with the same alias:
import 'a.dart' as my_namespace;
import 'b.dart' as my_namespace;
// you can once again access the classes under the same namespace:
final myApple = my_namespace.Apple();
final myBanana = my_namespace.Banana();
I prefer the first method because I don't have to repeat the multiple import statements whenever I need to use a class under the namespace.
Of course the imported and exported files do not need to be in the same folder, but having the files under the same namespace in the same folder would probably be more convenient.