"Function was not implemented" when trying to use ONI recording - osx-lion

I'm trying to use an oni recording in my application using OpenNI. Here is my xml file:
<OpenNI>
<Licenses>
<!-- Add application-specific licenses here
<License vendor="vendor" key="key"/>
-->
</Licenses>
<Log writeToConsole="false" writeToFile="false">
<!-- 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default) -->
<LogLevel value="3"/>
<Masks>
<Mask name="ALL" on="true"/>
</Masks>
<Dumps>
</Dumps>
</Log>
<ProductionNodes>
<Recording file="Recording.oni" />
<!-- Set global mirror -->
<GlobalMirror on="true"/>
</ProductionNodes>
</OpenNI>
Everything looks ok, but when I try to run my program, I get:
Open failed: Function was not implemented!
What could be the problem?

The problem were the two following lines:
<!-- Set global mirror -->
<GlobalMirror on="true"/>
After removing them, my program works fine.

Related

VSTest#2 Task is Updating / Overriding coverlet.runsettings and not respecting exclusions

I am trying to add code coverage to a .NET Framework 4.8 solution in Azure DevOps. I have based my approach on the questions here and here and the coverlet docs, and am successfully getting code coverage results.
However this solution also contains a number of shared projects which have their unit tests in a different solution. I wish to exclude these projects, and the test projects themselves from the coverage report.
In my coverlet.runsettings file I have included the following lines based on the docs:
<Exclude>[coverlet.*.tests?]*,[*]Coverlet.Core*,[Company.*UnitTest]*</Exclude>
<Include>[Company.Application.*]*</Include>
However when the tests are run using the VSTest#2 I see the following in the logs
Provided settings file:
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>cobertura</Format>
<Exclude>[coverlet.*.tests?]*,[*]Coverlet.Core*,[Company.*UnitTests]*</Exclude>
<Include>[Company.Application.*]*</Include>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Updated Run Settings:
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<!-- As above -->
</DataCollector>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<!-- Lots of configuration ommitted for brevity -->
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
<RunConfiguration>
<MaxCpuCount>0</MaxCpuCount>
<BatchSize>1000</BatchSize>
<ResultsDirectory>D:\a\_temp\TestResults</ResultsDirectory>
</RunConfiguration>
</RunSettings>
**************** Starting test execution *********************
So it appears the VS test task is altering my runsettings on the fly and then not respecting the inclusions and exclusions values
My yaml is:
- task: VSTest#2
displayName: 'Run Tests'
inputs:
testAssemblyVer2: '**\*UnitTests*.dll'
searchFolder: '.\Output'
codeCoverageEnabled: true
runSettingsFile: .\Builds\coverlet.runsettings
Can anyone suggest a setting or some other way to respect the inclusions and exclusions?
It is counterintuitive, but in order to VS test task does not alter runsettings on the fly, need to remove "codeCoverageEnabled: true" and add "runSettingsFile: .\Builds\coverlet.runsettings":
- task: VSTest#2
displayName: 'Run Tests'
inputs:
testAssemblyVer2: '**\*UnitTests*.dll'
searchFolder: '.\Output'
runSettingsFile: .\Builds\coverlet.runsettings
Code coverage still will be calculated because of runsettings file.
In order to exclude something, you can check https://learn.microsoft.com/en-us/visualstudio/test/customizing-code-coverage-analysis?view=vs-2022#sample-runsettings-file
I copy pasted here in case the link is broken
<!--
About include/exclude lists:
Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
Each element in the list is a regular expression (ECMAScript syntax). See /visualstudio/ide/using-regular-expressions-in-visual-studio.
An item must first match at least one entry in the include list to be included.
Included items must then not match any entries in the exclude list to remain included.
-->
<!-- Match assembly file paths: -->
<ModulePaths>
<Include>
<ModulePath>.*\.dll$</ModulePath>
<ModulePath>.*\.exe$</ModulePath>
</Include>
<Exclude>
<ModulePath>.*CPPUnitTestFramework.*</ModulePath>
</Exclude>
</ModulePaths>
<!-- Match fully qualified names of functions: -->
<!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.) -->
<Functions>
<Exclude>
<Function>^Fabrikam\.UnitTest\..*</Function>
<Function>^std::.*</Function>
<Function>^ATL::.*</Function>
<Function>.*::__GetTestMethodInfo.*</Function>
<Function>^Microsoft::VisualStudio::CppCodeCoverageFramework::.*</Function>
<Function>^Microsoft::VisualStudio::CppUnitTestFramework::.*</Function>
</Exclude>
</Functions>
<!-- Match attributes on any code element: -->
<Attributes>
<Exclude>
<!-- Don't forget "Attribute" at the end of the name -->
<Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
</Exclude>
</Attributes>
<!-- Match the path of the source files in which each method is defined: -->
<Sources>
<Exclude>
<Source>.*\\atlmfc\\.*</Source>
<Source>.*\\vctools\\.*</Source>
<Source>.*\\public\\sdk\\.*</Source>
<Source>.*\\microsoft sdks\\.*</Source>
<Source>.*\\vc\\include\\.*</Source>
</Exclude>
</Sources>
<!-- Match the company name property in the assembly: -->
<CompanyNames>
<Exclude>
<CompanyName>.*microsoft.*</CompanyName>
</Exclude>
</CompanyNames>
<!-- Match the public key token of a signed assembly: -->
<PublicKeyTokens>
<!-- Exclude Visual Studio extensions: -->
<Exclude>
<PublicKeyToken>^B77A5C561934E089$</PublicKeyToken>
<PublicKeyToken>^B03F5F7F11D50A3A$</PublicKeyToken>
<PublicKeyToken>^31BF3856AD364E35$</PublicKeyToken>
<PublicKeyToken>^89845DCD8080CC91$</PublicKeyToken>
<PublicKeyToken>^71E9BCE111E9429C$</PublicKeyToken>
<PublicKeyToken>^8F50407C4E9E73B6$</PublicKeyToken>
<PublicKeyToken>^E361AF139669C375$</PublicKeyToken>
</Exclude>
</PublicKeyTokens>

How to return a value from a phing target?

I would like to have a foreach task like this, which iterates over all the files/directories in a directory "A" -
<foreach param="dirname" absparam="absname" target="subtask">
<fileset dir="${dir.destination}/${dir.subdir}/">
<type type="file" />
</fileset>
</foreach>
The target "subtask" should check if the counterpart of the file/folder exists in another directory "B" (I am comparing directory A and B basically), and return either of the following if it does not -
a flag.
name of the file.
Following is some code for reference -
<target name="subtask">
<if>
<filesmatch file1="${file1}" file2="${file2}"/>
<then>
Return false. But how?
</then>
<else>
Return true of name of the file. How?
</else>
</if>
</target>
Note - It is okay if this can be done without calling a target. I am not sure if the logic can be fit inside the foreachtask itself. Could not find any such thing in the phing documentation.
Basically, I should be having the list of file names which are not present in the directory B, by the end of the loop.
You may also read this question of mine, if you can give some pointers to solve the issue in some other way.
Update
Rephrasing this question, since I feel that the problem description is not clear. The phing documentation says, a target has no return value -
Targets are collections of project components (but not other targets)
that are assigned a unique name within their project. A target
generally performs a specific task -- or calls other targets that
perform specific tasks -- and therefore a target is a bit like a
function (but a target has no return value).
I don't understand why is it designed so. With this bounty, I would like to know if there is some workaround for me other than having to define my own custom tasks in PHP, and then set properties -
$this->getProject()->setNewProperty('modifiedElements', implode("\n\n",$modifiedElementsArray));
which can be accessed in the build file
I have a target which checks whether my production code base has any differences from the expected git revision -
<target name="compare_prod_with_expected_revision">
<input propertyname="box.git_version">
Enter git version of the production codebase:
</input>
<exec command="git reset --hard ${box.git_version}" dir="${dir.scratchpad}" />
<!-- Scratchpad brought to revision ${box.git_version} -->
<echo>Verifying whether production is at revision ${box.git_version}..</echo>
<exec command="diff -arq --exclude='.git' ${dir.scratchpad}/${dir.subdir} ${dir.destination}/${dir.subdir}" outputProperty="diffList"/><!-- #TODO ignore.swp files in this step. Diff says .swp files present in production code. But doing ls -a there does not show the same. -->
<php function="strlen" returnProperty="productionDeviationFromExpectedBranch"><!-- #TODO - find how to not show this step during build process. Put it in a target and set hidden="true" -->
<param value="${diffList}"/>
</php>
<if>
<equals arg1="${productionDeviationFromExpectedBranch}" arg2="0" />
<then>
<echo>Verified production is at revision ${box.git_version}</echo>
</then>
<else>
<echo>Differences - </echo>
<echo>${diffList}</echo>
</else>
</if>
</target>
Now, I want to phingcall this target and would like to access some property set by it.
I think I understood your purposes, and at the same time I feel like you chosen not the optimal tool of doing this.
As you mentioned in your question, official documentation on phing is clear about tasks (targets):
Targets are collections of project components (but not other targets) that are assigned a unique name within their project. A target generally performs a specific task -- or calls other targets that perform specific tasks -- and therefore a target is a bit like a function (but a target has no return value).
Targets should be components of your application, which execute specific task, atomic task. It could be initialization task, configuration fetching, compilation step, assets preparation and dumping, deployment task, clean-up task, etc. There's no "output", returned by target in the standard sense, but the result of target execution is the success of execution itself: success or failure.
One should not try to put way too much of logic into such project targets, as it is not intended to do complicated calculations, do heavy logical decisions, etc. I mean, Phing can do it, such things are possible, but this setup would be bulky, unreadable, and hard to scale/re-factor.
With Phing you can easily define conditional execution and branching of logical flow, you may define the sequence of execution of tasks (dependencies) - this is what makes it laconic and elegant. Keep targets as simple as possible, split the project into small, finished logical tasks.
Based on the projects I've been working with, the biggest targets, probably, were initialization stage and configs fetching. Here's some example, to understand what it might contain, I took it from real project:
<target name="init_configuration">
<echo msg="Define initial configuration for the deployment..." />
<if>
<not>
<isset property="host" />
</not>
<then>
<property name="host" value="dev" override="true" />
<echo message="The value of hostname has been set to ${host}" />
</then>
<else>
<echo message="The value of hostname is ${host}" />
</else>
</if>
<if>
<not>
<isset property="version" />
</not>
<then>
<property name="version" value="1.0.0" override="true" />
<echo message="The value of version has been set to ${version}" />
</then>
<else>
<echo message="The value of version is ${version}" />
</else>
</if>
<property name="host_credital_file" value="config/hosts/${host}.properties" />
<property file="${host_credital_file}" />
<available file="${host_credital_file}" property="hostfilefound" value="true"/>
<fail unless="hostfilefound" message="Missing Hostfile configuration file (${host_credital_file})!" />
<echo msg="Configuration is done" />
</target>
Other targets were extremely simplistic, they are normally – 1-5 lines long, and do only small purpose, small task. This would be, probably, the best recommendation when working with Phing.
The logic which you are trying to put on shoulders of Phing is possible, but would be extremely bulky.
Consider the point: how much quicker, easier, and more readable the same thing could be done with simple bash script in your example. Or even to write small CLI utility in PHP, which will do the job elegantly and quick. After that in Phing you'll leave parametric target which will execute this "revision diff script" from CLI.
Phing is a great tool for what it is designed for, but it can't be an optimal choice for every purpose. Just do not put way to much responsibility and logic into it.
As a workaround, for more complicated things it's better to combine Phing with with something specialized: bash scripting, PHP CLI, nodeJS (+ Grunt, Gulp, etc)... and just to add calls of a Phing targets later.
This is the way I managed to have targets which behave like functions:
<target name="-console-cmd-return-property" hidden="true">
<exec command="${command}" checkreturn="${checkreturn}" logoutput="${logoutput}" outputProperty="${outputProperty}"/>
</target>
It gets invoked like this:
<phingcall target="--console-return-property">
<property name="command" value="ps auxwww"/>
<property name="checkreturn" value="true"/>
<property name="logoutput" value="false"/>
<property name="outputProperty" value="ps_output"/>
</phingcall>
Of course it works because it relies on existing exec, and it is not generic...
The target "subtask" should check if the counterpart of the file/folder exists in another directory "B" (I am comparing directory A and B basically), and return either of the following if it does not -
a flag.
name of the file.
You could compare two directories without using a foreach task like this:
<project name="Phing Build Test" default="print-missing" basedir=".">
<resolvepath propertyName="dir.a" path="path/to/dir/a"/>
<resolvepath propertyName="dir.b" path="path/to/dir/b"/>
<target name="print-missing">
<apply executable="echo" failonerror="false" returnProperty="files.found" outputProperty="missing">
<srcfile/>
<fileset id="srcfiles" dir="${dir.a}" includes="*">
<present present="srconly" targetdir="${dir.b}"/>
</fileset>
</apply>
<if>
<equals arg1="${files.found}" arg2="0"/>
<then>
<echo msg="${missing}"/>
</then>
</if>
</target>
</project>

How to include resources file in anjuta project

I'm trying to update a graphical project in vala, moving lot of code lines into an ui file.
I want to use template (available with glib-2.38 and GTK+3.8, something like that).
My project is managed with Anjuta and autoconf.
In the src directory there are
application.ui:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="SpiWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
<property name="default-height">400</property>
<child>
<placeholder />
</child>
</template>
</interface>
resources.xml:
<?xml version="1.0" charset="UTF-8" ?>
<gresources>
<gresource prefix="/org/app/spi">
<file compressed="true" preprocess="xml-stripblanks">application.ui</file>
</gresource>
</gresources>
in src/Makefile.am I have append --gresources resources.xml to the spi_VALAFLAGS. And finally I declared The Gtk.ApplicationWindow like this
[GtkTemplate(ui = "/org/app/spi/application.ui")]
internal class SpiWindow : Gtk.ApplicationWindow {
// Constructor
public Window (Gtk.Application application) {
Object(application: application);
}
}
But when I compile and then run the application, there is the error message :
(spi:9749): Gtk-CRITICAL : Unable to load resource for composite template for type 'SpiWindow': The resource at '/org/app/spi/application.ui' does not exist
(spi:9749): Gtk-CRITICAL : gtk_widget_init_template: assertion 'template != NULL' failed
You still need to compile the resources and include them:
GLIB_COMPILE_RESOURCES=glib-compile-resources
resources.c: resources.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies resources.xml)
$(GLIB_COMPILE_RESOURCES) --target=$# --generate-source $<
and include resources.c as a source file in spi_SOURCES.

Namespace/Mymodule/Block/Item.php file code not accessible on frontend after adding through xml

i am working on a module e.g "Mymodule", in which i need to filter the results. i.e. for Partners i created Partner.php and for Community i created Community.php in
Mymodule/Block/Partner.php
Mymodule/Block/Community.php
Now i wanted to access their code in frontend through Mymodule.XML
<block type="mymodule/partner" ......................... />
but this doesn't work on LIVE SERVER, although it does work on local Wamp server :( ... Any idea ?
Although when i access the default Mymodule.php code in the same and add the code i placed in partner and community file, it does work.
Is there something i am missing ?
First, you have to define the blocks in your module's config.xml:
<config>
<global>
<blocks>
<mymodule>
<class>Namespace_Mymodule_Block</class>
</mymodule>
</blocks>
</global>
</config>
Second, you have to use the right block type in your layout XML:
<block type="mymodule/partner" ......................... />
You must not write ".php" in the block type. Note, that the term "mymodule" has to be the same in the config xml as well as in the block type.
Hope this helps!
I'm not strictly sure how your code would ever have worked. But assuming you haven't built a module before, you'll need a minimum of 3 files.
app/etc/modules/Sonassi_Module.xml
app/code/community/Sonassi/Module/etc/config.xml
app/code/community/Sonassi/Module/Block/Partner.php
In the first file ... app/etc/modules/Sonassi_Module.xml
<?xml version="1.0"?>
<config>
<modules>
<Sonassi_Module>
<active>true</active>
<codePool>community</codePool>
</Sonassi_Module>
</modules>
</config>
In the second file ... app/code/community/Sonassi/Module/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Sonassi_Module>
<version>0.1.0</version>
</Sonassi_Module>
</modules>
<frontend>
<routers>
<module>
<use>standard</use>
<args>
<module>Sonassi_Module</module>
<frontName>module</frontName>
</args>
</module>
</routers>
</frontend>
<global>
<blocks>
<module>
<class>Sonassi_Module_Block</class>
</module>
</blocks>
</global>
</config>
In the third file ... app/code/community/Sonassi/Module/Block/Partner.php
class Sonassi_Module_Block_Partner extends Core_Block_Template
{
}
Then finally, you can then use
<block type="module/partner" ......................... />

Code coverage fails with PHPUnit and the Zend Framework

I have some issues with code coverage reports in PHPunit and the zend framework. Whenever I run a phpunit test the code coverage fails returning the following message:
PHPUnit 3.4.15 by Sebastian Bergmann.
I.......III.I................................IIIIIIIIIIIIIII 60 / 93
IIII....I....I..II..II.....IIIIII
Time: 4 seconds, Memory: 22.25Mb
OK, but incomplete or skipped tests!
Tests: 93, Assertions: 174, Incomplete: 36.
Generating code coverage report, this may take a moment.PHP Fatal error: Cannot redeclare class Klunde_Auth in /Users/kristianlunde/workspaces/private/klunde/Library/Klunde/Auth.php on line 9
Fatal error: Cannot redeclare class Klunde_Auth in /Users/kristianlunde/workspaces/private/klunde/Library/Klunde/Auth.php on line 9
My phpunit.xml file looks like this:
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Klunde">
<directory>./application/</directory>
<directory>./Library/Klunde</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application</directory>
<directory suffix=".php">../Library/Klunde</directory>
<exclude>
<directory suffix=".phtml">../application/</directory>
<file>../application/Bootstrap.php</file>
<file>../application/controllers/ErrorController.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8" yui="true"
highlight="true" lowUpperBound="50" highLowerBound="80" />
<log type="testdox-html" target="./log/testdox.html" />
</logging>
</phpunit>
I did a
var_dump(get_included_files());
at the top of the Auth file and it did try to include the file more than once before it failed.
I have also tried to remove the Klunde_Auth.php file just to see if it was a one file issue, but then the error is triggered on the next file in the Library/Klunde directory.
I am running OSX Snow Leopard, with PHP 5.3.1, XDebug 2.1.0beta3 and PHPUnit 3.4.15
All help and assistance will be highly appreciated.
Thanks.
add a debug_print_backtrace() call to the top of your Klunde_Auth.php, before the class declaration itself starts.
Then run the testsuite again, now you will see the whole backtrace each time the file is included, this should help you to figure out what/from where it is being included twice.