Premake on windows gets incorrect realpath - premake

I need to create define in premake that give me absolute path to project (Windows and Linux).
I used
defines {'ABSOLUTE_PATH="' ..path.getabsolute('.').. '"'}
But it's not working for me. define returns eg. c:/aaa/bbb/ccc and windows need
c:\\aaa\\bbb\\ccc
I also tried with
defines {'ABSOLUTE_PATH="' ..os.realpath('.').. '"'}
but it gives me c:\aaa\bbb\ccc and that makes error "incorrectly formed universal character name". Is there easy way to get correctly generated value?

You are probably looking for something more like this:
defines { 'ABSOLUTE_PATH="%{prj.abspath}"' }
Using this token ensures that you will get the actual path where the project is generated, which depending on your project may or may not be the same as the current working directory.
But you could also try:
defines { 'ABSOLUTE_PATH="' .. path.translate(os.getcwd()) .. '"' }

Related

How to set JSHint options on per directory basis

I see that the ability to specify JSHint options on a per directory basis was added here.
However it is not clear to me how you actually take advantage of this. What do I do to set JSH options in a single directory, so that the options differ from other directories?
It appears that the change in question actually allows you to specify overriding options on a per-file basis. You can add an overrides property to your config, the value of which should be an object. The keys of this object are treated as regular expressions against which file names are tested. If the name of the file being analysed matches an overrides regex then the options specified for that override will apply to that file:
There's an example of this in the cli.js test file diff in the commit you linked to:
{
"asi": true,
"overrides": {
"bar.js$": {
"asi": false
}
}
}
In that example there is a single override which will apply to any files that match the bar.js$ regular expression (which looks like a bit of an oversight, since the . will match any character and presumably was intended to only match a literal . character).
Having said all that, it doesn't look like the overrides property is going to help you. I think what you actually want is a new .jshintrc file in the directory in question. JSHint looks for that file starting in the directory of the file being analysed and moves up the directory tree until it finds one. Whichever it finds first is the one that gets used. From the docs:
In case of .jshintrc, JSHint will start looking for this file in the same directory as the file that's being linted. If not found, it will move one level up the directory tree all the way up to the filesystem root.
A common use case for this is to have separate JSHint configurations for your application code and your test code. This allows you to define the different environments and globals separately.

Qt - Don't append major version number to the end of executable/library name

How can I stop Qt from renaming my DLL to MyDLLName{MAJOR_VERSION_NUM}.dll?
This only happens when I set the VERSION in my project file, but I also want to set the version. For example, if I have:
VERSION = 1.2.3.4
And my library is named MyDll, it will create my DLL in the debug folder as MyDLL1.dll. If I take the version number away, it keeps the name as I want it (MyDLL.dll).
Thanks.
Use this:
CONFIG += skip_target_version_ext
See this answer (on SO) for why it is there: Why library name gets an additional 0 in its name?
You can "not-set" the version to remove it from the generated name, but are you sure you want to do that? (It's there to avoid DLL Hell.)
The "proper-answer" is that the LIB template is adding the version number.
Also, note:
VERSION is used to define VER_MAJ and VER_MIN
msvc_nmake generator adds /VERSION:major.minor to link flags if !empty
msvc_vcproj generate adds /VERSION:major.minor to link flags and MSVCPROJ_VERSION if !empty
You can explicitly set those yourself, or "unset" any of them.
You can explicitly remove the version number from the target name with the TARGET_EXT variable, for example, see: http://qt-project.org/faq/answer/how_can_i_add_version_information_to_my_application
If you want to create your own plugin to decide how to generate the target name (without the version number), you can make your own plugin as described in this answer (on SO): How to avoid having version numbers in .so file name

boost-build/bjam constant for path to Jamroot

Is there a way to get the location of the Jamroot file, for use as a constant in another Jamfile in the project?
Right now, I have this kludge in my Jamroot:
constant HOME : [ os.environ HOME ] ;
constant MYPROJECT_ROOT : $(HOME)/src/myproject ;
And then later I might do something like this in another Jamfile, to allow me to include headers with paths from the root of the project.
<include>$(MYPROJECT_ROOT)
It's especially unsatisfactory because it means that if I share this project with others, they have to either keep it in exactly the same location relative to their $HOME or they have to update the Jamroot.
I'm interested in the smart way to do this specific include (instead of my ignorant beginner way of using constants). But I'd also be interested in solving the problem the way I asked -- by getting the Jamroot location into a constant -- because this might be useful in other ways too.
Use the path-constant rule.
path-constant MYPROJECT_ROOT : . ;
Then in sub-projects, you can get the directory of the Jamroot with $(MYPROJECT_ROOT).
Note that usually people name this variable TOP instead of MYPROJECT_ROOT, but that's just a convention.

I'm having problems with configuring a filter that replicates specific tables only

I am trying to use filters to select specific tables to replicate.
I tried running this with the installer
./tools/tungsten-installer --master-slave -a \
...
--svc-extractor-filters=replicate \
--property=replicator.filter.replicate.do=test,*.foo"
and got this exception in trepctl status after the master had not installed properly:
Plugin class name property is missing or null: key=replicator.filter.replicate
which file is this properties file? How do I find it? Moreover, in specifying the settings for the filter, how do I know what exactly to put?
I discovered that I am supposed to Modify the configuration template file prior to configuration according to Issue 219 but what changes am I supposed to make in tungsten-replicator-2.0.5-diff that will later on be patched to the extraction?
Issue 254 suggests that If you want to apply a filter out of the box, you can use these options with tungsten-installer:
-a --property=replicator.filter.Replicate.ignoreFilter=schema_x.tablex,schema_x,tabley,schema_y,tablez
--svc-thl-filter=Replicate
However when I try using this for --property=replicator.filter.replicate.do,
but the problem is still the same:
pendingExceptionMessage: Plugin class name property is missing or null: key=replicator.filter.replicate
Your assistance will be greatly appreciated.
Rumbi
Update:
Hi
I had a look at this file: /root/tungsten/tungsten-replicator/samples/
conf/filters/default/tableignore.tpl .Acoording to this sample, a
static-SERVICE_NAME.properties file is supposed to have something like
this configured, please confirm if this is the correct syntax:
replicator.filter.tabledo=com.continuent.tungsten.replicator.filter.JavaScr iptFilter
replicator.filter.tabledo.script=${replicator.home.dir}/samples/
scripts/javascript-advanced/tabledo.js
replicator.filter.tabledo.tables=foo(database).bar(table)
replicator.stage.thl-to-dbms.filters=tabledo
However, I did not find tabledo.js (or something similar) in the
directory where tableignore.js exists. Could I please have the
location of this file. If there is an alternative way of specifiying
--property=replicator.filter.replicate.do=test without the use of
this .js file, your suggestions are most welcome.
Download the latest version of tungsten replicator. The missing tpl file was added about a month ago. After installation, the filtered tables should be added to static-service.properties under the section FILTERS.
Locate your replicator configuration file in static-YOUR_SERVICE_NAME.properties, e.g.
/opt/continuent/tungsten/tungsten-replicator/conf/static-mysql2vertica.properties
Make sure the individual dbms properties are set, in particular the setting replicator.applier.dbms:
# Batch applier basic configuration information.
replicator.applier.dbms=com.continuent.tungsten.replicator.applier.batch.SimpleBatchApplier
replicator.applier.dbms.url=jdbc:mysql:thin://${replicator.global.db.host}:${replicator.global.db.port}/tungsten_${service.name}?createDB=true
replicator.applier.dbms.driver=org.drizzle.jdbc.DrizzleDriver
replicator.applier.dbms.user=${replicator.global.db.user}
replicator.applier.dbms.password=${replicator.global.db.password}
replicator.applier.dbms.startupScript=${replicator.home.dir}/samples/scripts/batch/mysql-connect.sql
# Timezone and character set.
replicator.applier.dbms.timezone=GMT+0:00
replicator.applier.dbms.charset=UTF-8
# Parameters for loading and merging via stage tables.
replicator.applier.dbms.stageTablePrefix=stage_xxx_
replicator.applier.dbms.stageDirectory=/tmp/staging
replicator.applier.dbms.stageLoadScript=${replicator.home.dir}/samples/scripts/batch/mysql-load.sql
replicator.applier.dbms.stageMergeScript=${replicator.home.dir}/samples/scripts/batch/mysql-merge.sql
replicator.applier.dbms.cleanUpFiles=false
Depending on the database you are replicating to you may have to omit/modify some of the lines.
For more information see:
https://code.google.com/p/tungsten-replicator/wiki/Replicator_Batch_Loading
I don't know if this problem is still open or not.
I am using this version 2.0.6-xxx and installing the service using the parameters works for me.
I would like to point it out, that as the parameter says "--svc-extractor-filters" defines an extractor filter. Meaning that the parameters will guide the extraction of data in the master server.
If you intend to use it on the slave service, you should use the "--svc-applier-filters".
The parameters
--svc-extractor-filters=replicate \
--property=replicator.filter.replicate.do=test,*.foo"
supposed to create the following in the properties file:
This is the filter set up.
replicator.filter.replicate=com.continuent.tungsten.replicator.filter.ReplicateFilter
replicator.filter.replicate.ignore=
replicator.filter.replicate.do=test,*.foo
And you should also be able to find the
replicator.stage.binlog-to-q.filters=replicate
parameter set.
If you intend to use this filter in the slave, please find the line with:
replicator.stage.q-to-dbms.filters=mysqlsessions,pkey,bidiSlave
and change it as
replicator.stage.q-to-dbms.filters=mysqlsessions,pkey,bidiSlave,replicate
Hope this brief description did help to you!

requires named attributes

After I migrated my project from Windows to Mac, every time I try to embed an asset in Flash builder like this:
[Bindable] [Embed("assets/assets.swf#mySymbol")]
public var myClass:Class;
I get this error:
[Embed] requires named attributes
if I close the files containing the embedding, it compiles fine and doesn't give any problem.
I googled the error, and haven't found anything similar.
If I remember correctly:
[Embed(source="assets/assets.swf", symbol="mySymbol")]
These are named attributes FB is telling you about - source and symbol.
Update: as Jason Towne mentioned, the only required attribute is source. Symbol allows to bind specific symbol from swf to variable.

Resources