I noticed how to use PHP 7 features you have to use declare(strict_types=1) on every file (or that's what I read on php.net). Now, I'm using Zend Framework 2 and want to use PHP 7's features, do I have to put declare(strict_types=1) in every php file or is there a way to have it load it once and not put it in every php file I make.
Or better yet, not have to put it in at all?
Thanks!
Because you have to refactor every class anyway it makes sense to put it in every file you want to work with strict types. Classes you don 't want to work with strict types don 't need the declare statement.
As far as I know you have to add it in every file (which should work with strict types). There is no way to load it globally.
Related
I'm completely new to translating QML widgets.
I see people using i18n() and i18nc() in their source code.
I've found the commands documented here:
https://techbase.kde.org/Development/Tutorials/Localization/i18n#QML
But the QML documentation only lists the qsTr() method. I guess the other 2 commands are KDE specific?
Do I really have to dabble with those KDeclarative etc objects, in C++? I'm not really sure how that works. My widget doesn't use any of that, just qml files and some javascript files for external functions.
I've found out I can get the translation to work with PoEdit but only for .js files, if I define a custom source keyword (function name) to extract from them, but ONLY if they are i18n and i18nc (qsTr doesn't work) and when using a directory structure I stole from a working widget (that is /contents/locale/language_key/plasma_applet_widget_id.mo). Sadly, since the parser getText can't read qml files, this solution isn't good enough.
Now, I know qt provides a command, lupdate, to extract those keywords from the source, but that only works for qsTr, conversely. Trying to pass -tr-function-alias qsTr=(i18n) as an argument doesn't work. With qsTr() I can have a nice .ts file, but trying to convert that to po and use the previously mentioned trick doesn't work.
I wonder though, why the devs of the downloadable widgets all seem to use i18n and i18nc in their source code if lupdate doesn't seem to be able to extract those keywords.
Why do people use i18n and i18nc instead of qsTr?
Probably because it's way more convenient. I've been able to get .qml files to work using the above-mentioned trick by simply manually editing the .po files (referencing the qml file in question, the line where the keyword occurs and so on).
I have a question, I am using FSharp.Configuration (https://fsprojects.github.io/FSharp.Configuration/YamlConfigProvider.html) library to read configuration file in my project using Yaml provider. Well it all works well and good but I started to wonder how to detect if there is no configuration file, if some no good user deleted this file.
I could replace it with some default hard coded config. But documentarian says none about it.
Anyone maybe solved this problem?
All values from the config file passed to the TP at compile time are stored as default values (right in the generated code), except lists of compound types, which will always be empty due to the TP restriction. So, when you instantiate a TP at runtime, it's "filled" with the default values already. If you need to fill it with different values, you can load a file, a string, or set individual properties in code. Maybe it would be a good idea to add an ability to load config from resources, but I'm not sure it's an idiomatic way in .NET world (in contrast with, say, Scala).
I've tried to lay out my classes in one file each, with the classes belonging to a couple different libraries.
Basically, these files have library inf.logic; at the top:
web/logic/realm.dart (imports region.dart)
web/logic/region.dart (imports ../events.dart)
web/logic/tile.dart
This has library inf.gfx;:
web/gfx/viewport.dart (imports ../logic/realm.dart)
This has just library inf;:
web/events.dart
And then I have the main entry point, which seems to end up in the inf library by default:
web/inf.dart (imports gfx/viewport.dart, logic/realm.dart, logic/region.dart, logic/tile.dart)
When I generate dartdoc, it only seems to catch some classes, seemingly randomly. Even though the main entry point uses all of the above classes explicitly, I only get docs generated for region.dart and events.dart. No other files are included, and the links in the doc that refers to the other classes result in 404's.
It feels like I'm doing something wrong. Should I resort to create a wrapper file for the libraries and use part and part of? I really dislike the idea of adding that need for maintenance between file relations, that should already be implicit from the imports.
Also, how can I get rid of relative paths? I tried package:inf/logic/realm.dart, but it doesn't work…
Andrei Mouravski answered this on the mailing list:
There are several issues here:
If Dartdoc is generating 404 links, then file a bug with all information you can possibly provide. It's very possible something broke. dartbug.com/new
You can document multiple things at the same time by passing multiple entrypoints. Note: if you have multiple entrypoints, you should use the 'pkg' command line option to specify your packages folder.
You shouldn't need a wrapper file, but dartdoc should document every library that was imported in the entrypoint, so a possibility is to just have a simple file that imports all the libraries you want documented. We're working on something better for this, and I'm sorry it's a little broken at the moment.
I am evaluating gnugettext for Delphi XE2. All seems to be OK except that it seems that we don't have translation directory(ies) choice : it is always "\locale\Lc_MESSAGES\".
As I need to share translation for some exe in the same application it's not very convenient. I looked in the sources and see :
BaseDirectory:=ExtractFilePath(ExecutableFilename);
OK, I may change the source but I don't like it.
Any elegant idea ?
You can use the provided bindtextdomain function to change the directory where your application looks for the dictionary files. The first parameter will normally be the string 'default', and the second parameter is the directory to go to. The actual dictionary files will still need to be in a subfolder of the specified directory (using the same \locale\LC_MESSAGES\ pattern), but this at least gives a convenient way of sharing translations across multiple programs.
i'm working on a symfony project and i generated a set of model classes called Base<name>.php, <name>.php, <name>Peer.php and Base<name>Peer.php
I did the famous jobeet tutorial and i still have doubts about locating functions in these files of the model. So my question is:
What kind of functions i have to put in which file?
or expressed other way
How i know where to locate a function in these files?
thank you very much
You should never edit the files prefixed with Base, they can be overwritten if you change something in your schema and regenerate these files.
The custom methods you are writing yourself should be in the Peer class.
To easily locate a method, I use a good IDE like PDT that parses the files and allows searching methods.