I'm trying to compile in ASP .NET MVC 3 project my Views to dll,- that's ok, but when i register dlls, i have problem here:
var assembly = Assembly.LoadFrom(dll.FullName);
// register compiled razor views
// e.g. 'settings.cshtml' is registered as '~/extensions/plugins/rating/settings.cshtml'
BoC.Web.Mvc.PrecompiledViews.ApplicationPartRegistry.Register(assembly, pluginDir);
I can't understand, what's that- BoC?
Source: http://mikakolari.fi/2011/02/aspnetmvc-3-plugin-architecture-with-embedded-razor-views/
Solution:
When u compile your Views, u have 2 files in bin/Debug:
Commons.Web.Mvc.PrecompiledViews.dll
Crash.PageRating.dll
So, BoC.Web.Mvc.PrecompiledViews.ApplicationPartRegistry is in Commons.Web.Mvc.PrecompiledViews.dll which u have to Add to your project.
I can't get that MSDN link to work. The BoC stuff is by Chris van de Steeg and the source code is here and Commons.Web.Mvc.PrecompiledViews.dll specifically is here.
Having said all of that, in this blog post Chris seems to recommend using David Ebbo's razorgenerator instead.
By now, this is all integrated in the RazorGenerator.Mvc NuGet package. See my answer here: https://stackoverflow.com/a/33263732/331281.
Related
I am new to ZF2.
Today I was trying to implement a simple database operation. I was referring to https://framework.zend.com/manual/2.4/en/user-guide/database-and-models.html.
But I am getting following error
A plugin by the name "getServiceLocator" was not found in the plugin manager Zend\Mvc\Controller\PluginManager
What am I missing ?
Just a note: ZF2 is warning since a long time now about the depreciation of the use of $this->getServiceLocator() in the code and so we should respect it.
But still some of us have projects already developed with old code and we can't change all that now so had to find this solution.
Try adding "zendframework/zend-mvc": "2.6.3" to the composer.json file under require list like the following:
"require": {
....
"zendframework/zendframework": "~2.5",
"zendframework/zend-mvc": "2.6.3",
....
}
This will allow you to make use of the $this->getServiceLocator() in the controller.
What this does is - even if the framework version gets on updating, the zend-mvc will always remain old in you code and support the use of $this->getServiceLocator().
I know that most of them won't like this usage but it will definitly helps those who have got no way to upgrade/modify their code.
I hope it helps someone.
Hiho,
I use the ckeditor on my website for special textareas like forum
or signatures.
But I have a problem with the output. I use ZF2 and would like to
use ZendMarkup to render the output bbcode back in html.
But at every time I call
$bbcode->render(...)
I got the error
There is no Zend_Markup_Root markup.
The ZendMarkup is an extension inspired by the Zend_Markup from ZF1.
But I can't find any thing on API or other guides.
Does someone has any idea what as the problem is?
The ZendMarkup library is very old (last update is 10 months ago!) so I wouldn't use such library. If you would like, I think I traced the error down.
On this line there is a reference to Zend_Markup_Root while that should be ZendMarkup\Renderer\Markup\Html\Root. Try to change that line and see what happens.
Another way is to replace the ZendMarkup library with another library which does work and is updated regularly. An example is Decoda. If you load mjohnson/decoda in your composer.json, you can use Decoda in your Zend Framework 2 application:
<?php
use Decoda\Decoda;
$parser = new Decoda($bbcode);
$html = $parser->parse();
With tools like composer, there is no need to use solely Zend* components when there are better alternatives.
ZF1 had a gread search lucene implementation. is there something similar for ZF2? I can't find anything...
It is part of ZendSearch and you'll find it here https://github.com/zendframework/ZendSearch
If you drill down through the folders you'll find Lucene, but you'll probably need to install the whole thing following the instructions in the readme file on the first page I linked to.
Alternatively you can cd into your vendor directory and run:-
git clone https://github.com/zendframework/ZendSearch.git
That will create the ZendSearch module and you can then add it to your modules list in application.config.php
Also see the Zend Framework package repository.
This is for Zend Framework 3 / Zend Search
The following code will get you started working with Zend Search:
use ZendSearch\Lucene\Lucene;
use ZendSearch\Lucene\Document;
use ZendSearch\Lucene\Document\Field;
use ZendSearch\Lucene\MultiSearcher;
$index = Lucene::create($path_to_index); // or use open to update an index
$document = new Document;
$document->addField(Field::Text($key,$value));
$index->addDocument($document);
$search = Lucene::open($path_to_index);
$search->find($str);
It is worth noting however that at the time of writing Zend Search expects ErrorHandler:: to be available which is part of the Stdlib of Zend. I believe this has been removed from stdlib so I simply replaced these calls with a try/catch block.
Beyond the above example - the code in the ZF v1 manual provides a pretty good basis to work from in terms of functionality: https://framework.zend.com/manual/1.12/en/zend.search.lucene.overview.html.
Could someone provide a simple example using getopt.pas with short and long command line switches use case?
Getopt.pas is a delphi unit for parsing command line switches.
I've found more than one version of it.
from fpc http://www.koders.com/delphi/fid428067C2ABEF87A674F64BF48FD6E2278E322A18.aspx
The following is another SO question regarding this subject but no example is given; beside it this links to a source that alike the previous links is not self-contained
Is there an implementation of "getopt" for Delphi?
Here is a demo of the GPC code that you link to: getoptdemo.pas [koders.com]
I'm using Klimstra's VB.NET template from the "Create skeleton program" of the GOLD parser but the resulting template has methods with the overrides keyword and inherits from TemplateParser..
Am I supposed to create the TemplateParser class or is there a tool to create it? I thought that the "create skeleton" function created a template that I was supposed to inherit and provide implementation to the "MustOverride" methods but now I don't know.
I'm following a tutorial that makes it look like we have to create it using a tool but I'm not sure. I don't know if the tutorial is very outdated (it's dated 2005) and the GOLD parser changed this mechanism. This is the tutorial I'm following: http://www.codeproject.com/KB/recipes/IntrotoGoldParser.aspx
I were just looking into this topic a your link to the article really helped me.
I figured out that in the source files provided with the artictle there are two file with extension .pgt. These are templates for GOLD Code generator. Yout have to copy them into your GOLD installation folder -> Templates and to use them both when you are creating the skeleton program.
I hope this is helpful.