Joomla module language file wont work - joomla3.0

I want to follow Joomla best practise but I can't get the module language file working. I've tried everything. I've been through all the Joomla and stack overflow questions and the code I've got seems to match the answers but it won't work :(
I have inside of the files tags in the xml for the module
<folder>language</folder>
under files I have the language def:
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_events_display.sys.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_events_display.ini</language>
</languages>
The language folder and files are present on the server. I've also put copies in the site and the admin language folder just for good measure.
The language file is simple now as I've taken everything out to get it to work:
MOD_EVENTS_DISPLAY="Magazine display"
MOD_EVENTS_DISPLAY_SHOW_EVENT_TITLE_LABEL="Show event title"
It's used int the xml file like this:
<field name="showEventTitle" type="radio" default="0" label="MOD_EVENTS_DISPLAY_SHOW_EVENT_TITLE_LABEL" description="MOD_EVENTS_DISPLAY_SHOW_EVENT_TITLE" class="btn-group btn-group-yesno">
<option value="0">No</option>
<option value="1">Yes</option>
</field>
I've checked the module with language debug and it says that it's loaded the file:
**Loaded** : JROOT/language/en-GB/en-GB.mod_events_display.sys.ini
What started out as a 30 min job to be compatible with Joomla guidelines has turned into a 5 hour nightmare trying to get the system to actually work
Any ideas about what other debugging I could do would be great.
(Joomla 3.8.5 and php 7)

Make a copy of what you have and see if this might work for you.
// <folder>language</folder> // remove this line
<languages folder="language">
<language tag="en-GB">en-GB.mod_events_display.sys.ini</language>
<language tag="en-GB">en-GB.mod_events_display.ini</language>
</languages>
...
<field
name="showEventTitle"
type="radio"
default="0"
label="MOD_EVENTS_DISPLAY_SHOW_EVENT_TITLE_LABEL"
description="MOD_EVENTS_DISPLAY_SHOW_EVENT_TITLE"
class="btn-group btn-group-yesno"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
And that your language folder is structured like this
language
|__ en-GB
|-- en-GB.mod_events_display.sys.ini
|__ en-GB.mod_events_display.ini
Good luck!

Related

WiX installer can't open config file

I have a WPF application and I've created an MSI to install it with the WixToolset 3.11 and Visual Studio Extension 2019. I'm trying to add either XmlFile or XmlConfig item to change values in the config file. I'm getting the following error:
Failed to open XML file C:\Program Files(x86)\CO Apps\Main App\OurApp.exe.config. system error: -2147024786
The file path is the full filepath because I gave it the full path trying to resolve the issue. Here's the important parts of the wxs file
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:wixutil="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="9E76F000-5525-4BDF-8262-AE46B035D9CE"
Name="Our App"
Language="1033"
Version="2.0.0.0"
Manufacturer="CO Apps"
UpgradeCode="7CFB1B51-F5D5-4AD4-A509-F5C9BC05F875">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="Our production application." />
<Directory Id="ProgramFilesFolder">
<Directory Id="VTAPPSDIR" Name="CO Apps">
<Directory Id="INSTALLFOLDER" Name="Our App">
<Component Id="MainExecutable" Guid="748368D7-7581-4809-A8FE-DFB1093D6A02">
<File Id="MainFile" Name="$(var.OurApp.TargetFileName)" DiskId="1" Source="$(var.OurApp.TargetDir)OurApp.exe" KeyPath="yes"></File>
<File Id="OurApp.exe.config" ReadOnly="no" Source="$(var.OurApp.TargetDir)OurApp.exe.config"></File>
... More File items for DLLs
<wixutil:XmlFile Id="SetAppMode" Action="setValue" File="C:\Program Files (x86)\CO Apps\Our App\OurApp.exe.confg" ElementPath="configuration/userSettings/OurApp.Properties.Settings/setting/AppMode/value" Value="Main" />
</Directory>
</Directory>
</Directory>
So I'm trying to set the "AppMode" value to "Main" when this installs. What I'm trying to set isn't the point it's that it can't seem to find or open the file. I've tried putting the XmlFile in its own component. I've tried several variations of File paths including [INSTALLDIR] and [INSTALLLOCATION] and the filename by itself. Without that line everything works great. With that line in, I get the error and it rolls back the install. I also tried XmlConfig instead of XmlFile:
<wixutil:XmlConfig Id="ClearConfigAppMode" Action="delete" File="[INSTALLLOCATION]OurApp.exe.config" ElementPath="userSettings/OurApp.Properties.Settings" Name="AppMode" />
<wixutil:XmlConfig Id="SetAppMode" Action="create" File="[INSTALLLOCATION]OurApp.exe.config" ElementPath="userSettings/OurApp.Properties.Settings" On="install" Node="element">
<wixutil:XmlConfig Id="SetConfigAppModeName" ElementId="SetAppMode" File="[INSTALLLOCATION]OurApp.exe.config" Name="name" Value="AppMode" />
<wixutil:XmlConfig Id="SetConfigAppModeSerializeAs" ElementId="SetAppMode" File="[INSTALLLOCATION]OurApp.exe.config" Name="serializeAs" Value="String" />
</wixutil:XmlConfig>
<wixutil:XmlConfig Id="SetAppModeValue" Action="create" File="[INSTALLLOCATION]OurApp.exe.config" ElementPath="userSettings/OurApp.Properties.Settings" On="install" Node="element" Sequence="2">
<wixutil:XmlConfig Id="SetAppModeVAlueMain" ElementId="SetAppModeValue" File="[INSTALLLOCATION]OurApp.exe.config" Name="Value" Value="Main" />
</wixutil:XmlConfig>
Since XmlConfig doesn't have setValue on an existing element I used the delete action to remove the item for use in development and insert a new one. Same error. It happens logged on as myself or as Administrator. Does anyone have a working example of WiX with WPF creating a MSI? I'm not looking for something as complex as WixBA. I just need to modify the app.exe.config file on install.
Thanks,
Mike
Example: Though I rarely use this feature, I have this working example here (my test project for XML): https://github.com/glytzhkof/WiXUpdateXmlFile. Snippets of the sample here and here.
Disclaimer: I am not sure if follows best practice for XML updates, since I prefer to do XML updates from application launch code instead - if possible (single source, easier debugability and in general more familiar territory for most developers).
app.config/web.config appsettings: Maybe check out this answer regarding appsettings or this answer (looks better) - just for your review, not necessarily a suggestion. Keeping deployed files read-only helps a lot to overwrite them reliably during updates and the file you generate can be kept untouched by the installer (the file is de-coupled from installer - it never touches them). Or as I wrote: HKCU can also be used to write "the few settings you actually have to change". Not so nice conceptually?
Clouded Settings: Personally I think settings should never be file-based but clouded in our day and age (kept in a remote database). See section 6 and 7 here. How realistic this is for your application I don't know. New challenges and problems - no doubt (network issues, firewalls, launch problems, etc...), but benefits: versioned settings, recovery and management (enforce new settings). Not sure about all the practicalities - never been involved that much, but would love to get rid of settings files - especially for corporate apps. However, sometimes nice concepts don't meet reality well - maybe it is too involved?

Onerror directives not working with Solr data import handler / PDFBox

we are trying to index about 10,000 PDFs against a MySQL table. We are using Solr 5.2.1, Tika 1.7 and PDFBox 1.8.8. Data import handler keeps giving various errors, which halts the entire process. Most errors have to do with unreadable content or PDF file not found. I understand this, and would like the process to continue or skip past the problem files. But no matter how I set the onerror directive, it does not seem to work. We have indexed smaller sets of PDFs using the same methods, no problem. But the continuous errors on this larger store are stopping us in our tracks! I would appreciate any advice.
Here is entity from data-config.xml:
<entity name="proceedings" dataSource="proceedings_db" onerror="skip"
query="SELECT productID, title, fileName, buildDate
FROM products
WHERE status = '1'
">
<field column="productID" name="uid" />
<field column="title" name="paper_title" />
<field column="fileName" name="filename" />
<field column="buildDate" name="builddate" />
<entity name="file" dataSource="proceedings_files" processor="TikaEntityProcessor" url="${proceedings.filename}" format="text" onerror="skip">
</entity>
</entity>
I have tried setting onerror for the outer entity, for the inner, and for both (as above). I have tried skip and continue for all of those combinations. It seems to have no impact.
Here is an example of an error I get:
ERROR FlateFilter FlateFilter: stop reading corrupt stream due to a DataFormatException
and
java.io.EOFException
at org.apache.fontbox.ttf.MemoryTTFDataStream.readSignedShort(MemoryTTFDataStream.java:139)
at org.apache.fontbox.ttf.HorizontalMetricsTable.initData(HorizontalMetricsTable.java:62)
at org.apache.fontbox.ttf.TrueTypeFont.initializeTable(TrueTypeFont.java:280)
at org.apache.fontbox.ttf.AbstractTTFParser.parseTables(AbstractTTFParser.java:128)
at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:80)
at org.apache.fontbox.ttf.AbstractTTFParser.parseTTF(AbstractTTFParser.java:109)
at org.apache.fontbox.ttf.AbstractTTFParser.parseTTF(AbstractTTFParser.java:84)
at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.getTTFFont(PDTrueTypeFont.java:632)
at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.getFontWidth(PDTrueTypeFont.java:673)
at org.apache.pdfbox.pdmodel.font.PDSimpleFont.getFontWidth(PDSimpleFont.java:231)
at org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:411)
at org.apache.pdfbox.util.operator.ShowTextGlyph.process(ShowTextGlyph.java:62)
at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:557)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
at org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:460)
at org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:385)
at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:344)
at org.apache.tika.parser.pdf.PDF2XHTML.process(PDF2XHTML.java:134)
at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:146)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:256)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:256)
at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
at org.apache.solr.handler.dataimport.TikaEntityProcessor.nextRow(TikaEntityProcessor.java:162)
at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:243)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:475)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:514)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414)
at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:461)
These are not the only errors, mind you, but they are representative. I'd prefer not to hunt down and zap every offending PDF, but if that is what it takes, then fine. But as with the error above, I don't even get a filename, even if I broaden the log output settings. Sometimes I do, and I zap that file, but it does not happen each time.
I guess I do not understand what purpose the onerror settings serve, when it seems like the only working option is to stop! Again, I'd be most appreciative of any advice or suggestions as to what I am doing wrong.
Thanks in advance!
using the DIH to index large ammount of PDF files in a real prod environment is NOT a good idea:
some pdfs will fail to be extracted, no matter what. If you need to extract content by any means, you should catch the errored ones and use a second extraction library (different from PDFBox), as no two libraries fail with the same set of files.
some will OOM, same as above, try other library if needed when your process continues.
Worse, some pdfs will hang while extracting. You need to setup some infra to find those cases, and kill the extracting process so it goes on to the next ones. Ditto on the second library if you feel like.
Bottomline, you should use some other setup by using some ETL tools, or just write some custom code to do the extraction and then the indexing into Solr, taking the above recommendations into account.

Display project version in ASP.NET Core 1.0.0 web application

None of what used to work in RC.x helps anymore.
I have tried these:
PlatformServices.Default.Application.ApplicationVersion;
typeof(Controller).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
Assembly.GetEntryAssembly().GetName().Version.ToString();
They all return 1.0.0.0 instead of 1.0.0-9 which should be after execution of the dotnet publish --version-suffix 9 having this in project.json: "version": "1.0.0-*"
Basically they give me "File version" from the attached picture instead of "Product version" which dotnet publish actually seems to change.
For version 1.x:
Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
For version 2.0.0 this attribute contains something ugly:
2.0.0 built by: dlab-DDVSOWINAGE041 so use this one:
typeof(RuntimeEnvironment).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
I would do it like this on ASP.NET Core 2.0+
var assemblyVersion = typeof(Startup).Assembly.GetName().Version.ToString();
In .Net Core 3.1 I show the version directly in my View using:
#GetType().Assembly.GetName().Version.ToString()
This shows the Assembly Version you have in your csproj file:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>2.2.2.2</FileVersion>
<Version>4.0.0-NetCoreRC</Version>
</PropertyGroup>
If you want to display the "other" FileVersion or "Informational" Version properties in the View add using System.Reflection:
using System.Reflection;
.... bunch of html and stuff
<footer class="main-footer">
<div class="float-right hidden-xs">
<b>Assembly Version</b> #(Assembly.GetEntryAssembly().GetName().Version)
<b>File Version</b> #(Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version)
<b>Info Version</b> #(Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion)
</div>
</footer>
Note that after adding the System.Reflection the original #GetType().Assembly.GetName().Version.ToString() line returns 0.0.0.0 and you need to use the #Assembly.GetEntryAssembly().GetName().Version
There's a blog post here
Edit: Make sure to follow proper naming conventions for the Version strings. In general, they need to lead with a number. If you don't, your app will build but when you try to use NuGet to add or restore packages you'll get an error like 'anythingGoesVersion' is not a valid version string. Or a more cryptic error: Missing required property 'Name'. Input files: C:\Users....csproj.'
more here:
This work for me too:
#Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion
It works with csproj file - either <Version>1.2.3.4, or <VersionPrefix>1.2.3</VersionPrefix>. However the <VersionSuffix> isn't recoganized as this doc says.
The answer by Michael G should have been the accepted one since it works as expected. Just citing the answer by Michael G above.
var version = GetType().Assembly.GetName().Version.ToString();
works fine. It gets the Package version set in the Package tab of project properties.
As an addition, if we need to get the Description we set in the same tab, this code would work. (core 3.1)
string desc = GetType().Assembly.GetCustomAttribute<AssemblyDescriptionAttribute>().Description;
Just in case someone needs this.
Happy coding !!!

postLink generates invalid code at CakePHP 2.3

I am using CakePHP 2.3
I have two environments where I have my web application. At the testing environment with the exact same version of the application (all files are the same) I am having a problem with the Form->postLink method.
It shows this error on the Javascript console:
Uncaught TypeError: Object # has no method 'submit' users:119
onclick
Comparing the resulting HTML from both environments I can notice that the attributes name and id generated by this method are repeated more than once in the same page (which shouldn't be like that).
This is the code use to generate those post links:
foreach($users as $user){
$delete = $this->Form->postLink(__('Delete'), array('action' => 'delete', $user['user_id']), __('Are you sure you want to delete %s?', $user['user_id']));
}
This is the problematic generated HTML with repeated values for id and name as you can see:
<!-- link 1 -->
<form action="delete/1/" name="post_51e8019d095f1" id="post_51e8019d095f1" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST"/>
</form>
Delete
<!-- link 2 -->
<form action="delete/2/" name="post_51e8019d095f1" id="post_51e8019d095f1" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST"/>
</form>
Delete
Why is this happening?
Could it be related with the configuration of the web server somehow? I don't see another explanation for it...
Thanks.
The problem was caused by a bug in IIS 7.0.6000.16386 and the PHP function uniqid as pointed out here.
I am using a slightly different version in both environments ( IIS 7.0.6000.16386 vs IIS 7.5.7600.16385) and that was the cause of the problem.
In order to solve it I modified the file lib/Cake/View/Helper/FormHelper.php chaning the line $formName = uniqid('post_'); inside the postLink function to:
$formName = uniqid('post_', true);
That adds more entropy and as the documentation says:
If set to TRUE, uniqid() will add additional entropy (using the combined linear congruential generator) at the end of the return value, which increases the likelihood that the result will be unique.
Update
Ended up having to add one more change due to problems with javascript in forms.
I added one more line after $formName = uniqid('post_', true); so it looks like:
$formName = uniqid('post_', true);
$formName = str_replace('.', '', $formName);

Grails AppEngine file upload using GAEVFS

I'm working on Grails web application and need to upload files.
I have a form (simplified here):
<g:form action="save" method="post" enctype="multipart/form-data">
<input type="file" id="image" name="image" />
<input class="save" type="submit" value="Create" />
</g:form>
and in Controller code (I know that this should not be in controller but this is just to make it work and than will be designed better):
def save = {
GaeVFS.setRootPath( servletContext.getRealPath( "/" ) );
FileSystemManager fsManager = GaeVFS.getManager();
FileObject tmpFolder = fsManager.resolveFile( "gae://WEB-INF/upload_files" );
if ( !tmpFolder.exists() ) {
tmpFolder.createFolder();
}
//I NEED CODE HERE TO SAVE THE IMAGE IN THE BIGTABLE VIA GAEVFS
}
So I have two problems:
A. When save create button is pressed a get exception since it tries to use Apache Commons FileUpload that tries to save to file system.
How do I disable it?
Exception is:
java.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.apache.commons.fileupload.disk.DiskFileItem.(DiskFileItem.java:103)
at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
B. I need the code example to save image via gaevfs
I have seen example in GaeVfsServlet but I still don't know how exactly it should look in my case. Any kind of help is welcome.
GaeVfsServlet url: http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/servlet/GaeVfsServlet.java
I came across the very same problem and I am using a grails plugin called ajaxuploader to get around the issue - the file that gets uploaded is available to your controller as an inputstream object and doesnt have to use the commons file upload API at all.
http://www.grails.org/plugin/ajax-uploader

Resources