I created a component , and I need to use IdHttp component (Indy) in it, so first I installed Indy in my IDE,I created the component and istalled it, then I added to uses the unit IdHttp so I can use IdHttp in my component.
But, when I compile the code of my component I get this error: Can't find unit IdHttp used by "mycomponent".PS: I added indylaz to the required packages of my component , however when I recompile the component I get the same compilation error.
So how to fix this?
Add a requirement of the project on the package that contains your component. That will the recursively load your component's requirementss.
I had to write IdHTTP instead of IdHttp, it's that simple.
Related
I'm working on a UI component in VIM with TypeScript plugin that highlights the errors on the spot, so it's not something I get during the actual plugin installation into the app at this point (although I haven't tried yet).
declare module "card-view" {
import view = require("ui/core/view");
export class CardView extends view.View {
}
}
And I get this:
Cannot find module 'ui/core/view'.
I realize that ui/core/view is unavailable at this point, since it's a standalone plugin, but it will be available at runtime. Is there anything to be done to resolve the error? I must be missing some step that wasn't mentioned in the guide -- http://docs.nativescript.org/plugins/ui-plugin.
UPDATE 1:
When I got to card-view-common.js implementation I hit another issue. TypeScript expects android and ios properties to be implemented, but since the class extends View (from ui/core/view) they are supposed to be implemented there. In other words, I believe I still need to somehow point to the existing core module, not sure how though.
Found it. I added a devDependency to package.json with tns-core-modules like below, ran npm install and then it began recognizing the module. Makes sense if you think about how it is supposed to compile the module during the development phase without installing in the real app, but may be worth mentioning in the guide anyway.
"devDependencies": {
"tns-core-modules": "^1.5.1"
}
'ui/core/view' (and the modules, distributed through the tns-core-modules package are declared as ambient external modules.
It could be that the vim plugin you use does not recognize ambient modules correctly.
I'm in the process of trying to migrate a R# extension project from R# 6 to R# 8. (I've taken over a project that someone wrote, and I'm new to writing extensions.)
In the existing v6 project there is a class that derives from RenameWorkflow, and the constructor used to look like this;
public class RenameStepWorkflow : RenameWorkflow
{
public RenameStepWorkflow(ISolution Solution, string ActionId)
: base(Solution, ActionId)
{
}
This used to work in R# SDK v 6, but now in V8, RenameWorkflow no longer has a constructor that takes Solution and actionId. The new constructor signature now looks like this;
public RenameWorkflow(
IShellLocks locks,
SearchDomainFactory searchDomainFactory,
RenameRefactoringService renameRefactoringService,
ISolution solution,
string actionId);
now heres my problem that I need help with (I think)
I've copied the constructor, and now the constructor of this class has to satisfy these new dependancies. Through some digging I've managed to find a way to satisfy all the dependencies, except for 'SearchDomainFactory'. The closest I can come to instantiating via the updated constructor is as follows;
new RenameStepWorkflow(Solution.Locks, JetBrains.ReSharper.Psi.Search.SearchDomainFactory.Instance, RenameRefactoringService.Instance, this.Solution, null)
All looks good, except that JetBrains.ReSharper.Psi.Search.SearchDomainFactory.Instance is marked as Obsolete, and gives me a compile error that I cannot work around, even using #pragma does not allow me to compile the code. The exact error message I get when I compile is Error 16 'JetBrains.ReSharper.Psi.Search.SearchDomainFactory.Instance' is obsolete: 'Inject me!'
Obvious next question..ok, how? How do I 'inject you'? I cannot find any documentation over this new breaking change, in fact, I cannot find any documentation (or sample projects) that even mentions DrivenRefactoringWorkflow or RenameWorkflow, (the classes that now require the new SearchDomainFactory), or any information on SearchDomainFactory.Instance suddenly now obsolete and how to satisfy the need to 'inject' it.
Any help would be most appreciated! Thank you,
regards
Alan
ReSharper has its own IoC container, which is responsible for creating instances of classes, and "injecting" dependencies as constructor parameters. Classes marked with attributes such as [ShellComponent] or [SolutionComponent] are handled by the container, created when the application starts or a solution is loaded, respectively.
Dependencies should be injected as constructor parameters, rather than using methods like GetComponent<TDependency> or static Instance properties, as this allows the container to control dependency lifetime, and ensure you're depending on appropriate components, and not creating leaks - a shell component cannot depend on a solution component for instance, it won't exist when the shell component is being created.
ReSharper introduced the IoC container a few releases ago, and a large proportion of the codebase has been updated to use it correctly, but there are a few hold-outs, where things are still done in a less than ideal manner - static Instance properties and calls to GetComponent. This is what you've encountered. You should be able to get an instance of SearchDomainFactory by putting it as a constructor parameter in your component.
You can find out more about the Component Model (the IoC container and related functionality) in the devguide: https://www.jetbrains.com/resharper/devguide/Platform/ComponentModel.html
We have a very large app that is in OL vers 4.0.24 with many program options with in the app. It is such a large app that we load and unload libraries of code based on what option they take.
libHWT100.unload(); // unload the library, so that it can be reloaded
libHWT100.load(); // reload the library so that we can instantiate them again
Fastforward to a new app we're creating with 5.x (nightly build info: Build: trunk#19533 (19533) Date: 2012-02-21T09:54:36Z) Following similar design approch since this is kind of our test for how our code once updated to the newer format will work as HTML5 version.
The library initially loads just like it use to, but now when I do the unload, I get the following error: TypeError: Object [object Object] has no method 'unload'. Obviously something has changed.
If I look at the docs. http://labs.openlaszlo.org/trunk-nightly/docs/developers/program-structure.html#d0e30050 #5, it still shows the unload() method.
Any one know how to unload an imported library now under 5.x? Thanks in advance!
I would like to list all of the classes that are in a DLL without having to load the dependencies. I don't want to execute any functionality, I just want to find out (problematically) what classes are inside of a given DLL. Is that possible? I've tried using the assembly.GetTypes() call, but it fails because of dependencies for executing the DLL. Is there any other way to list all the public classes?
I suggest you use the mono Cecil library. This is the basic example:
//Creates an AssemblyDefinition from the "MyLibrary.dll" assembly
AssemblyDefinition myLibrary = AssemblyFactory.GetAssembly ("MyLibrary.dll");
//Gets all types which are declared in the Main Module of "MyLibrary.dll"
foreach (TypeDefinition type in myLibrary.MainModule.Types) {
//Writes the full name of a type
Console.WriteLine (type.FullName);
}
This will not load all the dependencies.
Okay, I found it. This combination works to get a list of all classes without having to deal with the dependencies:
Assembly assembly = Assembly.LoadFrom(filename);
Type[] types = assembly.GetTypes();
You can use Assembly.ReflectionOnlyLoad method to load assembly without executing it.
How to: Load Assemblies into the Reflection-Only Context
Also you need to attach AppDomain.ReflectionOnlyAssemblyResolve as In the reflection-only context, dependencies are not resolved automatically.
I have a new version of a Drupal 6 module. In the new version, I have added a new dependency in the .info file to a views utility module I've created called lib_views.
However, lib_views may not be enabled when my module is upgraded. If it's not, then upgrading my module causes an irretrievable crash, because views fires a hook that invokes a function in my un-enabled lib_views module.
Is there any safe way to add a new dependency to an existing Drupal module that can prevent this?
You can force drupal to load the module (it's common practice for CCK modules for example).
Example:
function example_install() {
drupal_load('module', 'content');
content_notify('install', 'example');
}
In the example, drupal_load loads the "content" module first, then content_notify is an example of function that can only be used when the content module is available.
So if the drupal_load call returns FALSE, you can detect that the module is missing and notify the user.
Drupal 7 handles this automatically when going to update.php (which you are suppose to visit after updating a module). I suppose another alternative would be to display a warning message via an update function.