Aptana Code Assist with custom Class Loader - intellisense

Is it possible to setup Aptanta to provide code assist for classes loaded with a framework's autoloading class?
For example:
$myInstance = Project_Loader::load('MyClass');
Here, my class would be loaded from a hierarchy as soon as it was found, so if I had these libraries setup:
/library/Library1
/library/Library2
/library/Library3
If MyClass was in Library2, it wound find Library2_MyClass. Aptana works great if I initiate the object using:
$myInstance = new Library2_MyClass();
But is there any way to let Aptana know to load it and use Code Assist/Intellisense based on Project_Loader::load('MyClass')?

Not possible at the moment, as it's very dynamic, and specific to a framework.
What you can do is to add a comment that will hint for the type.
For example:
/* #var $myInstance MyClass*/
$myInstance-> // and you'll get the MyClass code-assist.

Related

Intellisense - deduce right Class by its methods

I'm used to work with NetBeans and now I'm trying IntelliJ. So my question is: Does IntelliJ has a way to get right class by its methods?
For example, in NetBeans if I write:
glGenBu // Intellisense will kick in and will suggest me
to use GL15.glGenBuffers() method from GL15 class
This will automatically import the right library.
This is very handy because I'm working with LWJGL and it has a bad way to manage OpenGL methods ('GLXX' where XX is the version of OpenGL and all methods that appeared in that version are stored in that class) and I never remember the right class where my desired method is.
Thank you.
Pressing Ctrl+Space when you already see completion list will show more suggestions, with static methods from the entire project among them. See https://www.jetbrains.com/help/idea/auto-completing-code.html for more details.

Changing the implementation of Objective C method in Swift subclass

I am using an external library in my project. It is integrated via CocoaPods. I have access to the source code. The library is working well, but I need some modifications at some places in order for it to serve my purposes. It is written in Objective C. My project is in Swift.
I need to change the implementation of one method in the library. The problem is it is in the .m file and uses a lot of stuff declared only in the .m file. For example:
-(NSString*)methodToChange
{
NSArray<NSNumber*>* data = [self someInternalMethod:1];
uint value = data[0].unsignedIntValue;
return [self anotherInternalMethod:value];
}
I tried subclassing it like this:
class MySubclass : MySuperclassWithMethodToChange {
override var methodToChange: String {
//trying to use someInternalMethod and anotherInternalMethod
//unsuccessfully because they are not visible
}
}
The internal methods are using and modifying properties from the .m file that are also not accessible. Is there any way to solve this?
I would suggest forking the original library repository and making the necessary changes in your fork. You can then have your Podfile point to that. If your changes could be useful to others, make them in a way that doesn't break existing functionality and contribute them back to the library by opening a pull request.
If the original library gets updated later, you will have to merge those changes from the so-called "upstream" repository into yours. This does not happen automatically, so you'll have full control (and responsibility) over that process. See https://help.github.com/en/articles/syncing-a-fork for how this would look like.

Why can't i reference to a method/property? VB.NET

Please take a look at the 2 photos i attached, i wish to call the methods from one project to another. Both projects are in the same solution. I have already made the reference to the project containing the method in the project i want to call the method.
http://postimg.org/image/m42dlc28r/
http://postimg.org/image/w03gkz80r/
In your main project, go to
Project -> Add Reference
In that window, click browse and find the compiled version of your other project (Probably in the Release or Debug folder)
In your main projects window add this to the very top of your code (even above your class declaration)
Imports SecondProjectRootNamespace
That should give you enough information on how to do what your trying to do, but if anything was unclear, I am going to need all the details to provide a more precise answer.
Also, make sure your methods/functions are NOT declared as private.
Private = Method is only visible from within the same class
Friend = Method is only visible from any class within the same assembly (same .exe or .dll or etc)
Public = Method has no access restrictions
There are a few others but those are the basics
Try to find the dll file of the method that you want, then add it as reference in the properties of your application

SilverStripe 3: Can a module extend mysite/code/Page.php?

Good afternoon,
I don't know if what I want to do is possible, so here goes.
I have a module that extends Page_Controller, but I want certain functions to be accessible via the site root.
Eg: getMyDataObjectList();
Currently, they only work if I go through the normal MVC routing structure.
I've found that when I place the function 'getMyDataObjectList' within '/mysite/code/Page.php' it works.The problem is, I don't want to place the code in there. I want it bundled with my Custom Module, but to work the same as though it was in 'mysite/code/Page.php'
[Example Scenario]
site root: http://[somesite].com
By default, the 'Page.ss' template loads.
I would like the theme developer to be able to call my module functions (API) within any template/Layout page, and have the result returned from the site root
Currently, this only works if I move the "API" functions to '/mysite/code/Page.php'
If the code is in my module, then data is only returned when you go to:
http://[somesite].com/[module_controller]
Can this be achieved? If so, how?
Thanks for your assistance.
[Update - Code Solution]
///>MyExtension.php
class MyExtension extends Extension{
public function getMyDataObjectList(){
return 'object list goes here!';
}
}//class
///>[Module] => _config.php
Object::add_extension('Page_Controller', 'MyExtension');
And as always, I do a (/dev/build?flush=1) just in case.
Thanks to: 'simon_w'
Yes, this is relatively straightforward. Simply, create an Extension subclass with your methods in them and then add that to Page_Controller. An Extension subclass is almost exactly the same as a DataExtension, they're just for classes other than DataObjects.

Actionscript3 Clarification on Usage of Classes?

Hi I am quite new to actionscript 3 and I would like some clarification on the use of classes. I am trying to use a AS3Commons UI project from http://sibirjak.com. But I am unsure on how to use some of their classes. The way I have it formatted in one of my keyframes is:
import com.AlertBox; // The location of the alertbox class
import com.AlertTutorialStep1; // The location of the example AlertTutorialStep1 class
var alertbox:AlertTutorialStep1 = new com.AlertTutorialStep1; // Creating an instance of the example class in the AlertTutorialStep1 doc
alertbox.AlertTutorialStep1(); // Trying to access the AlertTutorialStep1() function which is in the AlertTutorialStep1 class
But I am unable to access the function AlertTutorialStep1() and unsure why I am getting the error, can someone provide me with some insight? http://sibirjak.com/osflash/blog/tutorial-creating-an-alert-box-with-the-as3commons-popupmanager/
Try and avoid using the timeline if possible. I think that OOP and the Flash timeline can work if you know what you're doing, but stackoverflow is full of questions from beginners struggling with the timeline and classes, and these tend to be difficult to debug. Try to set your project up with a single Main document class which instantiates all the other classes you need for your project.
That said, assuming you have the AlertBox and AlertTutorialStep1 classes, and their dependencies, in the right directories relative to it, I think your code will work if you set the document class of your .fla to the AlertBoxTutorial1 class.
Again assuming the packages are all set up correctly, you could try replacing your existing code with the following:
//import com.AlertBox; // Don't need to import this, AlertTutorialStep1 imports and uses it
import com.AlertTutorialStep1; // The location of the example AlertTutorialStep1 class
var alertbox:AlertTutorialStep1 = new AlertTutorialStep1(); // Don't need to fully qualify the class as it is already imported in the line above
this.addChild(alertbox); // Need to add the instance to the stage
//alertbox.AlertTutorialStep1(); // AlertTutorialStep1() is the constructor of the class and can't be invoked via an instance of it