How to exclude DBGrid.Column.FieldName in .pot file - delphi

I made an application with Delphi 6.
After that I extracted a .pot file with all the strings to translate.
The problem is that there are strings that don't have to be tranlated, and if translated will generate problems.
Une of this is TDBGrid.Columns[x].FiedlName
I tryed to put this lines into the ggexclude.cfg file, but they doesn't work.
# exclude all occurences of the specified class
# and property in all DFM files in or below the
# path where "ggexclude.cfg" is in
[exclude-form-class-property]
TDBGrid......FieldName
TDBGrid.....FieldName
TDBGrid....FieldName
TDBGrid...FieldName
TDBGrid..FieldName
TDBGrid.FieldName
item.FieldName
TDBGrid.Columns.FieldName
TDBGrid.Columns.TDBGridColumns
TDBGrid.Columns.TDBGridColumns.FieldName
TDBGrid.Columns.Item.FieldName
TColumn.FieldName
TDBGridColumns.FieldName
FieldName
*.FieldName
I think that the problem is that within the .dfm file the parser doesn´t understand that they are part of a TColumn object
inherited DBGTable: TDBGrid
Height = 309
DataSource = DMUsers.DSUser
Columns = <
item
Expanded = False
FieldName = 'USER'
Visible = True
end
item
Expanded = False
FieldName = 'CODE'
Width = 31
Visible = True
end
item
Expanded = False
FieldName = 'NAME'
Width = 244
Visible = True
end>
end
Does anybody have a workarround?
I can't trust the automatic ignore.pot, because there are some strings that cause false possitives.

The documentation to the ggexclude.cfg-File states that you cannot access items, that are part of a collection:
A special case are collections in forms (like TDBGridColumns in a
TDBGrid [...]) You can exclude only the whole collection, but not
certain properties of a collection.
So the workaround would be to exclude the whole Columns-Collection:
TDBGrid.Columns
But this way you will lose Title.Caption too.
The only other workaround I see, would be to modify dxgettext. The following would be nice to have IMHO:
[always-exclude-property]
FieldName
Edit: I wanted to link to the ggexclude.cfg-documentation, but I cannot find it online right now. So I feel free to post the documentation as it is saved in my own ggexclude.cfg-file - but without any guarantee:
# Text in square brackets, like "[exclude-dir]", is called a "section".
# Each line that is not empty, not a comment and not a section holds
# exactly 1 "value".
# All lines below a section are scanned for values belonging to that
# section until the next section starts. You can use the same section
# several times. It will all be added up.
[exclude-dir]
# This section prevents a whole folder and all it's subfolder from being scanned.
# Each value is exactly one folder. On Windows, it's not case-sensitive.
# You can use relative or absolute paths. No wildcards allowed.
# example:
# subfolder
# these are valid values as well:
# another\folder
# another\folder\
# Windows: D:\yet\another\folder
# Linux: /home/zaphod/projects/subfolder/
# You don't have to worry about the path delimiters, both "/" and "\"
# can be used. They are converted to "/" internally
[exclude-file]
# This section prevents a whole file from being scanned.
# Each value is exactly one file. On Windows, it's not case-sensitive.
# You can use relative or absolute paths. Wildcards allowed.
# example:
# Unit4.dfm
# Using the wildcard ".*" for a file extension means that the following
# matching Delphi-files will be excluded: dfm, xfm, pas, inc, rc, dpr:
# Unit5.*
# If Unit3 is already excluded by the [exclude-dir] above, because it
# is located in a subfolder of "subfolder", listing it here therefore
# has not further effect:
# subfolder\subfolder\Unit3.dfm
# you can use absolute paths as well, like this:
# on Windows: D:\test\Unit.pas
# on Linux: /home/zaphod/projects/MainForm.*
[exclude-form-class-property]
# This section prevents a certain property of a class to
# be excluded from scanning in all forms of the folder and subfolders
# where "ggexclude.cfg" is located.
# The format for a value is "Classname.Properyname". It's not case-sensitive. No wildcards allowed.
# Classname is obvious, the propertyname has to be written the way it
# is written in the form file. If you're in doubt about how a certain property
# has to be stored here, just copy and paste the line from the DFM file here and
# put the classname before that.
# For simple strings the property name is one word:
# TLabel.Caption
# ...and for TStrings it's like this:
# TListbox.Items.Strings
# TMemo.Lines.Strings
# TQuery.SQL.Strings
# TEdit is listed in the [exclude-form-class]-section below which means
# that the whole class will be excluded. Listing TEdit.Text here therefore
# has no further effect
# TEdit.Text
# A special case are collections in forms (like TDBGridColumns in a TDBGrid,
# TParams in a TQuery or TActionManager.ActionBars). You can exclude only
# the whole collection, but not certain properties of a collection. That
# means as well that in the case of nested collections (see TActionManager.ActionBars
# in the sample unit "nestedcollections.dfm"), everything that appears below
# the collection with the highest level will be ignored.
# Note that some collections are saved with another name than their propertyname.
# For example: "TQuery.Params" will be saved as "ParamData" in the form file.
# TQuery.ParamData
# TDBGrid.Columns
# TActionManager.ActionBars
# these lines won't work:
# TDBGrid.Columns.Title.Caption
# TActionManager.ActionBars.ContextItems
# ("ContextItems" is a nested collection, which can hold another nested collection and so on)
[exclude-form-class]
# This section prevents a whole class to
# be excluded from scanning in all forms of the folder and subfolders
# where "ggexclude.cfg" is located.
# The format for a value is just "Classname". It's not case-sensitive.
# A wildcard "*" can be used optionally.
# A special case are collections, see [exclude-form-class-property] for that
# Here, everything of TEdit in DFM/XFM-files will be ignored. Remember:
# other classes derived from TEdit have to listed seperatly in order to
# exclude their properties as well. Inheritance is not recognized by dxgettext:
# TEdit
# Visual containers like TPanel or TScrollbox have to be treated slightly different.
# If you have a TPanel with a TLabel on it, writing "TPanel" would only
# exclude the properties of TPanel itself. If you want to exclude
# everything contained in a TPanel, use the wildcard "*" at the end, like this:
# TPanel*
# The following only excludes the properties of TScrollbox itself, but not the controls
# contained in Scrollboxes (except other classes explicitly listed here, like
# TEdit above):
# TScrollbox
[exclude-form-instance]
# This section prevents a certain instance (=object) of a class in a certain form file to
# be excluded from scanning.
# Each value is exactly one file with one instance. The format is
# "filename:instancename". On Windows, the "filename" part is not
# case-sensitive. You can use relative or absolute paths.
# Note that if the instance is something like a container or menu,
# everything belonging to that will be excluded.
# Note also that a frame on a form might contain a component with the
# same name as a component on the form. They would both be excluded.
# Unit6.dfm:Popupmenu
# Unit6.dfm:Label5

You should probably try running
msgmkignore filenamethatcontainsextrajunk.po -o autogenignore.po
Then open up the autogenignore.po and find the special way it has declared all your fieldname excludes (Thats the job of msgmkignore). Every time you auto-generate it you then have to review the auto-generated exclusion rules. It seems you're trying to generate all your exclusion rules by hand. It looks to me like you'd be better off taking the auto-generated includes and reviewing them by hand to exclude all the database field names and column names.
You obviously can't hand the entire job of "ignores" to the msgmkignore tool, as you state in your question, but you can use your brain, plus this tool, and combine those results.

Related

hygieia jira collector shows 401 unauthorized

I have installe hygieia components using the hygieia starter repo Here is the docker compose yaml link-https://github.com/hygieia/hygieia-starter-kit/blob/master/hygieia-starter-kit/Dockerfile
I have installed jira collector in one of my server, and it is throwing below error
Unexpected error occurred in scheduled task.
org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
Here is my application.properties
# Database Name
dbname=dashboarddb
# Database HostName - default is localhost
dbhost=XXX
# Database Port - default is 27017
dbport=27016
# MongoDB replicaset
dbreplicaset=[false if you are not using MongoDB replicaset]
dbhostport=[host1:port1,host2:port2,host3:port3]
# Database Username - default is blank
dbusername=dashboarduser
# Database Password - default is blank
dbpassword=dbpassword
# Logging File location
logging.file=./logs/jira.log
# PageSize - Expand contract this value depending on Jira implementation's
# default server timeout setting (You will likely receive a SocketTimeoutException)
feature.pageSize=100
# Delta change date that modulates the collector item task
# Occasionally, these values should be modified if database size is a concern
feature.deltaStartDate=2016-03-01T00:00:00.000000
feature.masterStartDate=2016-03-01T00:00:00.000000
feature.deltaCollectorItemStartDate=2016-03-01T00:00:00.000000
# Chron schedule: S M D M Y [Day of the Week]
feature.cron=0 * * * * *
# ST Query File Details - Required, but DO NOT MODIFY
feature.queryFolder=jiraapi-queries
feature.storyQuery=story
feature.epicQuery=epic
# JIRA CONNECTION DETAILS:
# Enterprise Proxy - ONLY INCLUDE IF YOU HAVE A PROXY
feature.jiraProxyUrl=http://proxy.com
feature.jiraProxyPort=9000
feature.jiraBaseUrl=https://XXX
feature.jiraQueryEndpoint=rest/api/2/
# For basic authentication, requires username:password as string in base64
# This command will make this for you: echo -n username:password | base64
feature.jiraCredentials=XXXX
# OAuth is not fully implemented; please blank-out the OAuth values:
feature.jiraOauthAuthtoken=
feature.jiraOauthRefreshtoken=
feature.jiraOauthRedirecturi=
feature.jiraOauthExpiretime=
#############################################################################
# In Jira, general IssueType IDs are associated to various 'issue'
# attributes. However, there is one attribute which this collector's
# queries rely on that change between different instantiations of Jira.
# Please provide a string name reference to your instance's IssueType for
# the lowest level of Issues (for example, 'user story') specific to your Jira
# instance. Note: You can retrieve your instance's IssueType Name
# listings via the following URI: https://[your-jira-domain-name]/rest/api/2/issuetype/
# Multiple comma-separated values can be specified.
#############################################################################
feature.jiraIssueTypeName=Bug
#############################################################################
# In Jira, your instance will have its own custom field created for 'sprint' or 'timebox' details,
# which includes a list of information. This field allows you to specify that data field for your
# instance of Jira. Note: You can retrieve your instance's sprint data field name
# via the following URI, and look for a package name com.atlassian.greenhopper.service.sprint.Sprint;
# your custom field name describes the values in this field:
# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]
#############################################################################
feature.jiraBugDataFieldName=customfield_10201
#############################################################################
# In Jira, your instance will have its own custom field created for 'super story' or 'epic' back-end ID,
# which includes a list of information. This field allows you to specify that data field for your instance
# of Jira. Note: You can retrieve your instance's epic ID field name via the following URI where your
# queried user story issue has a super issue (for example, epic) tied to it; your custom field name describes the
# epic value you expect to see, and is the only field that does this for a given issue:
# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]
#############################################################################
feature.jiraEpicIdFieldName=customfield_10002
#############################################################################
# In Jira, your instance will have its own custom field created for 'story points'
# This field allows you to specify that data field for your instance
# of Jira. Note: You can retrieve your instance's storypoints ID field name via the following URI where your
# queried user story issue has story points set on it; your custom field name describes the
# story points value you expect to see:
# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]
#############################################################################
feature.jiraStoryPointsFieldName=customfield_10003
#############################################################################
# In Jira, your instance will have its own custom field created for 'team'
# This field allows you to specify that data field for your instance
# of Jira. Note: You can retrieve your instance's team ID field name via the following URI where your
# queried user story issue has team set on it; your custom field name describes the
# team value you expect to see:
# https://[your-jira-domain-name]/rest/api/2/issue/[some-issue-name]
#############################################################################
feature.jiraTeamFieldName=
# Defines how to update features per board. If true then only update based on enabled collectorItems otherwise full update
feature.collectorItemOnlyUpdate=true
#Defines the maximum number of features allow per board. If limit is reach collection will not happen for given board
feature.maxNumberOfFeaturesPerBoard=1000
# Set this to true if you use boards as team
feature.jiraBoardAsTeam=false
#Defines the number of hours between each board/team and project data refresh
feature.refreshTeamAndProjectHours=3

How do you store custom constants in Rails 4?

I made some regular expressions for email, bitmessage etc. and put them as constants to
#config/initializers/regexps.rb
REGEXP_EMAIL = /\A([^#\s]+)#((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
REGEXP_BITMESSAGE = /\ABM-[a-zA-Z1-9&&[^OIl]]{32,34}\z/
and use it like
if #user.contact =~ REGEXP_EMAIL
elsif #user.contact =~ REGEXP_BITMESSAGE
Is that's good practice? What's the best way to store them?
It makes sense, that's one of the possible approaches. The only downside of this approach, is that the constants will pollute the global namespace.
The approach that I normally prefer is to define them inside the application namespace.
Assuming your application is called Fooapp, then you already have a Fooapp module defined by Rails (see config/application).
I normally create a fooapp.rb file inside lib like the following
module Fooapp
end
and I drop the constants inside. Also make sure to require it at the bottom of you application.rb file
require 'fooapp'
Lazy-loading of the file will not work in this case, because the Fooapp module is already defined.
When the number of constants become large enough, you can more them into a separate file, for example /lib/fooapp/constants.rb. This last step is just a trivial improvement to group all the constants into one simple place (I tend to use constants a lot to replace magic numbers or for optimization, despite Ruby 2.1 Frozen String literal improvements will probably let me remove several constants).
One more thing. In your case, if the regexp is specific to one model, you can store it inside the model itself and create a model method
class User
REGEXP_EMAIL = /\A([^#\s]+)#((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
REGEXP_BITMESSAGE = /\ABM-[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{32,34}\z/
def contact_is_email?
contact =~ REGEXP_EMAIL
end
end

Ruby 1.8.7 extend constant in another module

I need to extend an existing module (namely Redmine::MimeType) by adding a few items to a constant MIME_TYPES Hash.
This is what I tried so far and that only gives me a "dynamic constant assignment" error:
module MimeTypePatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.class_eval do
MIME_TYPES_VIDEO = {
'video/x-flv' => 'flv,f4v',
'video/mpeg' => '*.mpeg *.mpg *.mpe',
'video/quicktime' => 'qt,mov',
'video/vnd.vivo' => 'viv,vivo',
'video/x-msvideo' => 'avi'
}.freeze
# merge the new mime types with the existing ones
MIME_TYPES = MIME_TYPES.merge(MIME_TYPES_VIDEO).freeze
EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)|
exts.split(',').each {|ext| map[ext.strip] = type}
map
end
end
end
end
So what am I doing wrong and what might be the correct approach to alter an existing constant in another module? I do see that changing a constant at runtime is a bit off, but I couldn't think of a more elegant approach to achieve what I want (detecting video mime types).
Except for the freezing, you can modify existing constants in many cases rather than trying to redefine them. For instance, in your example using #merge! rather than #merge would alter the constant in place. I'm not sure whether you'd have to take steps to distinguish the definition in the current scope from that in the inherited one (i.e., you don't want to change any ancestry-upstream values of MIME_TYPES if there are any).
MIME_TYPES = {} unless (defined?(MIME_TYPES))
MIME_TYPES.merge!(MIME_TYPES_VIDEO)
Also of interest is the #replace method for Hash, Array, and others:
MIME_TYPES.replace(MIME_TYPES.merge(MIME_TYPES_VIDEO))
Cheers!
you can't assign a value to constant after initial definition, you have to create a new constant which will have the merged hash value. Change this line from
# merge the new mime types with the existing ones
MIME_TYPES = MIME_TYPES.merge(MIME_TYPES_VIDEO).freeze
to
# merge the new mime types with the existing ones
MERGED_MIME_TYPES = MIME_TYPES.merge(MIME_TYPES_VIDEO).freeze
and then you can use this new constant MERGED_MIME_TYPES in further logic

How can I refer to a parameter ('#param' tag) from another parameter?

I am using Ruby on Rails 3.1.0 and the YARD 0.7.4 gem for documentation purposes. I would like to refer to a parameter (#param tag) from another parameter. That is, I have:
# ...
#
# #param [String] argument_1
# Here I would like to have a description text with a reference/link to the
# 'argument_2' parameter (see below)...
#
# Maybe here I can use something like '#param', '{}' or '#macro'... but, how?
#
# #param [String] argument_2
# Some description text...
#
def method_name(argument_1, argument_2)
...
end
Is it possible? If so, how can I make that?
A decade later, there still does not appear to be a way to reference another parameter, which I think makes sense as the default html docs do not have anchors to parameters (see #rene-saarsoo's comment on the other answer if you want to use anchors), but you can make it look a bit nicer.
Use <code>paramName</code> tags to apply styling, which is all that I think needs to be done if the parameter is in the method that is being documented. Example:
# Adds <code>a</code> and <code>b</code>.
#
# #param a [Integer] a number that will be added to <code>b</code>
# #param b [Integer] a number that will be added to <code>a</code>
def add(a, b)
a + b
end
Here's what the above example looks like on the generated webpage:
If you are referencing a parameter of another method, you can use an object link alongside the <code> tag.
I don't know much about YARD, but no documentation tool I've used has provided such an ability. I guess that's because this is rarely if ever really needed.
Instead just mention the name of the parameter and it should be obvious from the context that it's the parameter that you are referring to:
# True when number is between given min and max values.
# #param [Number] min
# Must be smaller or equal to max.
# #param [Number] max
# Must be larger or equal to min.
def between?(min, max)
min <= self && self <= max
end

ASP.NET MVC3: Which is the best method to implement listbox?

I have a 'mylist' model entity which contains a IEnumerable field.
I'd like to populate 'mylist' and another to retreive possible elements, retreiving the elements from another mylist entity.
So, I would have two listboxes, one related to my 'mylist', the other one containing all the poexisting elements....
In particular I'd like to have the possibility put/remove elements using two add/remove buttons, acting in the following way:
MYLIST FIELD FULL MYLIST
############## ###############
# EL #1 # # EL #2 #
# EL #3 # # EL #4 #
# # <-- # EL #5 #
# # --> # ... #
# # # EL #n #
############## ###############
Could you give me some suggestions / examples, please?
You can use the select input element with multi-select enabled in asp.net and in client side you can use many beautiful jquery select plugins.
Check out this plugin, it's very close to what you need http://quasipartikel.at/multiselect/
And for a complete list check http://archive.plugins.jquery.com/plugin-tags/multiple-select

Resources