I'm developing an October CMS plugin, say author.pluginname, on a windows platform.
The file storage/framework/classes.php is meant to be auto-generated with the links of my classes, correct?
I'm not sure if that is always the case and I don't know if I need to or how to force it happen. The two cases were : 1) I just created a new class, 2) I rsynced my plugin to another test (linux server).
For example, I just copied my plugin to a new October CMS installation but and after installing the plugin with plugin:refresh, it doesn't appear in the classes.php file.
I visit a page where a component is being used and I get a class not found error:
"Class 'author\plugin\Models\modelx' not found" on line 653 of /pathtowww/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
when I grep my author, it finds some classes but not all:
grep -i author storage/framework/classes.php
I had to add it manually to make it work but I assume this is not what we should be doing. So is there something I ought to be writing in the Class file or 'registering' in the Plugin.php folder?
Note this plugin is not in the Marketplace (obviously as it's not developed).
Also, when I create a new class with the Builder plugin, it does appear in the classes.php. When I create it with my text editor, it often does not. Apologies if that is obvious but I'm quite confused....!
I have found the issues' solution(s), in case anyone runs into these problems.
1) If using Windows + another operating system, make sure the folder/file names are in the correct case. Windows is case insensitive so a typo will not result in an error until you migrate to Linux / OSX
2) Classes.php is generated automatically ONLY if the namespace matches the directory structure of your file. So if you move the file (or have the wrong namespace), classes.php will not be generated and you will get a class not found.
Related
I'm trying to work on a Ruby project in Intellij. I tried creating a new file using the Ruby Class Template file type. However, for some reason when I open the file it opens the file with the application that is associated with the .rb extension in my OS config, instead of opening it in Intellij.
EDIT:
Although I still have the issue described below I figured it was worth mentioning that I was able to get Ruby Class Template types working by creating a new empty Ruby project first then importing
my Ruby project as a new module in the Project Settings. See Importing a
module and configuring a separate SDK for it ~
source
END OF EDIT
I figured out that if I just create a file using the basic File type in Intellij and name it with the .rb extension then I can open it in Intellij.
So after I figured this out I tried deleting the original file I created with the Ruby Class Template type. This time I created it as a plain File type and gave it the .rb extension. But, Intellij still doesn't associate this as a Ruby file (it still has a ? mark symbol next to the file). I tried creating multiple variations of *.rb file names and they all work, which confirms the issue is only with this one particular file name.
So I can only think that Intellij has some cached reference of the file name and it's template file type.
I tried searching by %project_name% and deleting any results under
source SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>
But that didn't work. I also renamed the cache folder and restarted Intellij, to no avail.
Aside from a complete reinstall does anyone have any advice on if I'm going in the right direction, and if so, where I might find this hidden cache reference?
For those not able to access the link to the solution posted as a comment by #y.bedrov
The provided solution was to check the following
In Settings(Preferences) | Editor | File Types check all the
registered patterns for Files Opened in Associated Applications:
As I accessed this screen and scrolled to the bottom I found my file. I removed the file from the list and now my issue is solved. I can now create this file and have it open in Intellij!
I am using MvvmCross for my Xamarin application, so I have 3 projects: MyProject.Core, MyProject.Droid and MyProject.Touch
I have file.txt in the MyProject.Core project. I want to be able to open and read file.txt from my code in MyProject.Core so that it can be used on both platforms. It sounds simple but I can't figure out how. I found 2 approaches but I don't think they can work for me:
1) I make file.txt an embedded resource and read it at runtime via reflection. But I don't think I can do this in a PCL.
2) I set file.txt to "Copy to output directory", but this won't work either because the resulting package (.ipa or .apk) won't have access to it once it's on the phone (right?)
EDIT
I just thought of a solution that will suffice to my situation:
Add file.txt to MyProject.Core
In the iOS project, add the same file as a LINK in the Resources folder.
In the Android project, add the same file as a LINK in the values folder.
Although I still can not access file.txt from MyProject.Core, I can access the same file from each platform, which is a sufficient solution to my situation. I'll leave the question here in case anyone has an answer to this specific scenario for someone else that needs it.
If the type of your Core project is a NET Standard project you can just use the standard System.IO classes to get hold of the file system.
If it is a PCL (you probably want to upgrade it) you can use the MvvmCross File plugin to access the file system or the PCLStorage nuget. Whichever you prefer.
Using the former you would add the MvvmCross.Plugins.File nuget to core, and both app projects. Then you can add IMvxFileStore in the ctor of the ViewModel or Service you want to inject it. Then start using any of the methods on that interface to operate on the file system.
However, for embedded resources in your PCL you could do something like:
var assembly = typeof(SomeTypeInYourPCL).Assembly;
// some older PCL profiles you need to call .GetTypeInfo() before .Assembly
var stream = assembly.GetManifestResourceStream("whatever.txt");
I did a bit of searching and found this thread on the topic but it's specific to XML files, and so the answer makes sense (/etc/) for XML files.
In my case, I'm actually storing a txt file, which happens to be an SVN version number that I dumped out within my modman script.
The place that I'm using this is within a frontend model (Blocks/System/Html.php) which outputs the version number within the module config. So I went with the Blocks/System/ directory for now - the filename is Version.txt - but it feels like there should be a better place to put this.
Since this SVN version number is being written by an external tool I would prefer it not mess with the contents of code directories (which in a live environment may have write restrictions) and instead have it write to the "var" directory. In which case to get the correct path within "var" you would use:
$fullpath = Mage::getBaseDir('var') . DS . $path;
The contents of "var" are disposable, they may be deleted at any time so be prepared for a missing file.
version numbers can be added to app/code/local/Your/Extension/etc/config.xml
<config>
<modules>
<Your_Extension>
<version>0.0.0.0</version>
</Your_Extension>
</modules>
</config>
magento knows how to handle your extension version changes and can call update scripts based on version number change. This is the preferred method for this kind of stuff.
if you need to add random non php classes files to your extension then add them to your extension folder and ask them from there:
Mage::getModuleDir('etc', 'Your_Extension');
Mage::getModuleDir('whateverfolder', 'Your_Extension');
This is not a good practice though as this might just break magento compilation feature or introduce other issues so it is better to handle external data also through php classes or xml files inside your extension structure
I ran into the same kind of problem when developing a shipping module. I had a bunch of CSV files that contained maximum weight / delivery cost mappings. For what it's worth, I created a data/ directory at the module level and threw everything in there.
I don't think this kind of situation doesn't happens often enough in the Magento codebase for there to be an established convention. As long as you use sensible naming, and provide a level of abstraction to cope with any change of file location in the future, I'd say put it in any folder at your module's root.
So I have this rooted (on a specific file type) namespace extension that supports drag-and-dropping files into it. I use IFileOperation to handle file operations.
Moving/Copying a file that comes from outside the NSE into a sub-folder works. Copying a file into the namespace root works. However, I can't get to move a file into the root. It just does. Not. Work. My extension is never inquired for a ITransferDestination, although it is for other use cases.
Have you ever been in this situation ?
Notes:
I'm building the extension on top of Bjarke Viksoe's great TarFolder codebase.
The error I'm getting (through the standard Explorer dialog) is "The file is already in use"
the copy engine seems to end up deciding I'm trying to move a file from the regular file system to the regular file system. The above error is the one returned by a call to MoveFileEx, from what I could gather by tracing in there.
the PIDLs look correct, and IFileOperation::CopyItems works for the same inputs anyway.
I'd like to stick with IFileOperation, as it provides the most natural integration
Try contacting Bjarke directly, he may have some insight as to what may be going on.
His email:
bjarke#viksoe.dk
I personally haven't worked with his frameworks before, sorry I can't be of any more help than this.
I have two instances of Plone running on a server - their locations are /usr/local/Plone/Inst1 and /usr/local/Plone/Inst2. I'm trying to setup external methods, but am having a difficult time figuring out where my "Extensions" folder should be placed. It seems that where ever I place it, the ZMI never sees it. I have tried:
/usr/local/Plone/Extensions
/usr/local/Plone/Inst1/Extensions
...and various other sub-folders within the "Inst1" directory. When I add an external method, I've tried adding it at both the root of the ZMI ("/") and in the Instance folder ("/Inst1/"). When I add it to the root, I get a message that says "The specified module, demo, could not be found." When I try to add it in the instance folder, I get an error page that says "This page does not seem to exist..."
It appears that the ZMI is failing to find that file ("demo.py"). Is there a particular place it should be stored?
After looking over documentation from Zope's site (and numerous tutorials), it should be in the "Zope" folder - but I don't have any such folder (nor does any folder named "Extensions" exist on the file system, other than the one I created in the "Plone" and "Plone/Inst1" directories).
Depending on what version of Plone you have installed will change this, but it is likely something like:
/path/to/plone/install/parts/instance/Extensions
Or
/path/to/plone/install/parts/client1/Extensions
You're probably better off putting the external method in a product though since placing an external method in it's "parts" instance folder will mean it will be wiped out every time you run buildout. Then if you're going to make a product out of it, you might as will do a traversable view utility like "##plone_context_state" and "##plone_portal_state" which is usually a better way to do it.