Enterprise Library 4: logging block flat file - enterprise-library

I am having problem creating log entry to a text file. Here is my logging configuration in my ASP.net app.
and here is my vb.net code
Try
db.ExecuteNonQuery(cmd, tr)
tr.Commit()
result = True
Catch ex As Exception
Dim entry As New LogEntry()
entry.EventId = 11
entry.Message = ex.Message
entry.Categories.Add("General")
Logger.Write(entry)
tr.Rollback()
End Try
All the tutorial and example that i found so far are based on older version of Enterprise Library. I'm using Enterprise Library 4. Does anyone know what i'm doing wrong? Is it my code or the configuration? Where can i find more tutorial on Enterprise Library version 4. I tried to follow the quick start that it come with but i can't make head or tail.

its a basic tutorial on using enterprise library 4.1
http://blog.accentient.com/EnterpriseLibraryLogging101.aspx
btw, to get mine to work, i had to change all the PublicKeyToken's to = null
otherwise the web.config didnt validate, gl

Related

There is a way to use lsp4e for calling language server methods directly?

I'm new to the lsp4e & lsp technologies and as far as I have seen the framework provides almost everything for working with eclipse. However there is a way to use this features at will? i.e I would like to use the LS to get all the functions on a file, I think this will be done with textDocument/documentSymbol but how can I get this using the lsp4e framework?
NOTE:
I checked for SymbolKind and seems it was not the one I was looking for however that input helped me finding a sample of DocumentSymbol
DocumentSymbolParams params = new DocumentSymbolParams(
new TextDocumentIdentifier(documentUri.toString()));
CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> symbols =
languageServer.getTextDocumentService().documentSymbol(params);
I checked for SymbolKind and seems it was not the one I was looking for. However that input helped me finding a sample of DocumentSymbol
DocumentSymbolParams params = new DocumentSymbolParams(
new TextDocumentIdentifier(documentUri.toString()));
CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> symbols =
languageServer.getTextDocumentService().documentSymbol(params);

Zend Framework with Handwritten Font

I am trying to use the Amatic Font from Google in my PDF File but it gives me an Error like below. Could that be because the Font Type? I have tested with Open Sans and it is working.
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception
'Zend_Pdf_Exception' with message 'Unable to read version 4 table' in
/var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/FileParser/Font/OpenType.php:555\nStack
trace:\n#0
/var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/FileParser/Font/OpenType.php(121):
Zend_Pdf_FileParser_Font_OpenType->_parseOs2Table()\n#1
/var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/FileParser/Font/OpenType/TrueType.php(83):
Zend_Pdf_FileParser_Font_OpenType->parse()\n#2
/var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/Font.php(701):
Zend_Pdf_FileParser_Font_OpenType_TrueType->parse()\n#3
/var/www/vhosts/httpdocs/main/zend/library/Zend/Pdf/Font.php(615):
Zend_Pdf_Font::_extractTrueTypeFont(Object(Zend_Pdf_FileParserDataSource_File),
0)\n#4 /var/www/vhosts/httpdocs/main/zend/invoice.php(27):
Zend_Pdf_Font::fontWithPath('/var/www/vhosts...')\n#5 {main}\n\nNext
exception 'Zend_Pdf_Exception' wi...\n'
I am using this Script for my tests https://github.com/phpmasterdotcom/GeneratingInvoicesWithZendPdf/blob/master/public/invoice.php
What's happening is this: The Zend Framework code in OpenType.php explicitly checks the OS/2 table version of the font. Is it higher than 3, an exception is thrown. Your font has an OS/2 table version of 4 (which is the fifth version, there are at least 6 versions as far as I know).
Unfortunately, recent versions of the ZendPdf module (like here on GitHub) still don't seem to support version 4 or higher. So apart from looking for another pdf generator - that does support version 4 - I fear there's no clean solution.
You could try editing the framework code, but of course that's a bit shady. As an alternative, apparently it should be able to change that version and regenerate the font. See this post on the Tex forum (the post AFTER the accepted answer). If you choose that path, probably you'll find better guidance on that forum.
Sorry I can't offer a better solution, but maybe it helps you understanding what's going on.

Birt Multi Sheet report using SpudSoft

I´m having some problems to create reports in my server without default export engine.
I´m using SpudSoft to create it. I have the following configuration:
Tomcat 7
Birt 4.2.2
uk.co.spudsoft.birt.emitters.excel_0.8.0.201310230652.jar
And i followed this tutorial:
spudsoft-birt-excel-emitters
I haven´t include this file
lib/slf4j-api-1.6.2.jar
because it´s not included in the *.jar file
and either wrote this code:
'if( "XLS".equalsIgnoreCase( outputFileFormat ) ) {
renderOption.setEmitterID( "uk.co.spudsoft.birt.emitters.excel.XlsEmitter" );
} else if( "XLSX".equalsIgnoreCase( outputFileFormat ) ) {
renderOption.setEmitterID( "uk.co.spudsoft.birt.emitters.excel.XlsxEmitter" );
}'
Because I dont really know where to use it.
to run my report i use the following URL
http://127.0.0.1:8090/birt-viewer/frameset?__format=xls&__report=informes/myReport.rptdesign&__emitterid=uk.co.spudsoft.birt.emitters.excel.XlsEmitter
and i get the following message:
org.eclipse.birt.report.service.api.ReportServiceException: EmitterID uk.co.spudsoft.birt.emitters.excel for render option is invalid.
What can i do to run SpudSoft report? I've been reading for a week and I haven´t found any solution!
Thanks a lot for all!
#Dominique,
I recommend upgrading from the emitter included with BIRT 4.3 (and given the lack of responses from the BIRT team I regret letting them put it in there).
Also, you don't need to use a specific IRenderOption type - they are all the same really anyway.
#Jota,
If you are getting that error it means that BIRT hasn't picked up the emitter correctly (you do have the correct emitter ID).
I don't use the BIRT war file, so my instructions aren't aimed at that approach (I just use the report engine in my own service).
The code snippet is no use for you, it's just a way to specify the emitter ID, which you are doing on the query string.
slf4j shouldn't be needed with the version of the emitter that you have - it uses JUL instead (I hate JUL, but it's one fewer dependency).
Can you post a complete listing of the jar files in your war?
It seems because you make use of a generic IRenderOption. With spudsoft emitter you should instantiate your render options like this:
EXCELRenderOption excelOptions = new EXCELRenderOption();
Note if you upgrade to BIRT 4.3 you don't have to set the emitter anymore, it is embedded

Can't find Lucene.Net.Spatial.Tier namespace with the current version of Lucene.Net

In my search for a geolocation search implementation using lucene.net I encountered this article from leapinggorilla.com and download the source code but have no luck compiling, I added the reference using nugget but still no luck, and if I browse the assembly using object browser, can't find the Namespace either.
Any suggestions to what I am missing?
Thanks
The spatial module in Lucene 3.x was found to be buggy and unmaintained, so it's gone as of Lucene 4.x. Lucene 4.x has a new spatial module that I developed with 2 others. If you download it, you should look at the "SpatialExample.java" in the tests (perhaps there's a .net equivalent). You also might want to watch the presentation I gave at Lucene/Solr Revolution, or simply flip through the slides:
http://www.lucenerevolution.org/2013/Lucene-Solr4-Spatial-Deep-Dive
Lucene.Net is at version 3.0.3 and the 3.x spatial module was dropped from it as well. The 4.x spatial module was backported from java lucene 4.x. You can view the source here and the unit tests here
Unfortunately, that means that most of the older blog posts won't work directly with the new API. However, since most of the API calls should be that same as java's, so I would assume that any blog posts written for java could be translated to .NET.
I have a Lucene.NET 3.0.3 solution which allows spatial search with ordering (from a centre point), within a circle of a given radius.
The answer is here on StackOverflow, and a full VS solution can be found on GitHub.
The key portion of code which drives the spatial search is this:
var spatialArgs = new SpatialArgs(SpatialOperation.Intersects, searchArea);
var spatialQuery = _strategy.MakeQuery(spatialArgs);
var valueSource = _strategy.MakeRecipDistanceValueSource(searchArea);
var valueSourceFilter = new ValueSourceFilter(new QueryWrapperFilter(spatialQuery), valueSource, 0, 1);
var filteredSpatial = new FilteredQuery(query, valueSourceFilter); // Restricts results to searchArea
var spatialRankingQuery = new FunctionQuery(valueSource); // Orders results by distance (closest first)
var bq = new BooleanQuery();
bq.Add(filteredSpatial,Occur.MUST);
bq.Add(spatialRankingQuery,Occur.MUST);
Please let me know if anything is unclear. I urge anyone curious to download and examine the full solution.

Zend Framework Can't determine mime type of image upload

Hi all I'm trying to upload a image when creating a item in my app, however the action fails returning the following error: The mimetype of file 'mytestimage.jpg' could not be detected.
I've tried adding a Mime Type validator but the error persists, can anyone tell me where I'm going wrong in the code below.
// Image uploads
$images = new Zend_Form_Element_File('images');
$images->setMultiFile(2)
->addValidator('IsImage')
->addValidator('Size',false,'5242880')
->addValidator('Extension',false,'jpg,png,gif')
->addValidator('ImageSize',false,array(
'minwidth' => 250,
'minheight'=>250,
'maxwidth'=>500,
'maxheight'=>500
))
->setValueDisabled(true);
Many thanks in advance.
Graham
I had the same problem.
Zend_Frameworks tries to determine the mimetype in two ways:
First it tries to use the PECL FILEINFO-Extension (which is not installed on every server)
if the extension is not istalled it tries to use mime_content_type (a php function). This function however is deprecated as of php version 5.3
So in this case I guess your hoster is using php version 5.3 and has not installed the PECL FILEINFO-Extension. Same goes unfortunately for my hoster :(
Here are more details of the two ways in the php-manual:
http://de.php.net/manual/en/function.mime-content-type.php
http://de.php.net/manual/en/ref.fileinfo.php
By the way. You can see the code ZF uses in the file "Zend\File\Transfer\Adapter\Http.php" (lines 1281-1318: methodname is _detectMimeType