What is the proper syntax for using subcontrollers with Ufront? - haxe

In my main controller I followed the instructions in the Controller documentation and I have the following meta data:
#:route(GET, "/about/*")
var aboutController:AboutController;
Then in my AboutController file I have:
package controller;
import api.TestApi;
import api.PortfolioItem;
using ufront.MVC;
using ufront.web.result.AddClientActionResult;
class AboutController extends Controller
{
#:route(GET, "/graphicDesign")
public function graphicDesign()
{
// return new PartialViewResult({… etcetera
}
}
When I visit the /about/graphicDesign path in my browser, the PHP server generates an error:
PHP Fatal error: Call to a member function execute() on null in /Users/allan/Documents/Freelance/Confidant/Website/3d confidant site/ufront/www/lib/controller/HomeController.class.php on line 70
The PHP lines 69-71 have:
public function execute_aboutController() {
return $this->context->injector->_instantiate(_hx_qtype("controller.AboutController"))->execute();
}
So, do I need different syntax so that the controller instantiates properly?

fyi i upgraded to 3.4 i don't have the same issues.
yes remoting does not work but only when targeting php7 . in fact even when not targeting php7 and running in a php7 apache environment doesn't work either. also in works with Mamp & php 5.6.
i had no probs with sub controllers though.
my answer is . did you try on another php environment ?

Related

Cassandra source code ConfigurationException expection URI in cassandra.config found cassandra.yaml

For my master thesis, I have to modify the source code of Cassandra. So, as suggested by https://wiki.apache.org/cassandra/HowToBuild, I git clone, then run ant, and everything seems nice (I managed to build the project without any error), but when I run the unitTests (cassandra/test), I have this strange error:
org.apache.cassandra.exceptions.ConfigurationException:
Expecting URI in variable: [cassandra.config].
Found[cassandra.yaml].
Please prefix the file with [file:\\\] for local files and
[file:\\<server>\] for remote files.
If you are executing this from an external tool, it needs
to set Config.setClientMode(true) to avoid loading configuration.
at org.apache.cassandra.config.YamlConfigurationLoader.getStorageConfigURL(YamlConfigurationLoader.java:80)
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:100)
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:252)
at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:131)
at org.apache.cassandra.auth.jmx.AuthorizationProxyTest.setup(AuthorizationProxyTest.java:48)"
I would like to test my modifications on the source code with the unitTests (because I didn't find any tutorial of how to set up cassandra from the source code on Windows, so if you have one, I would like to have the link ^^) but I didn't manage to find any solution for this bug :(. Anyone know a solution to this problem?
I am working on Windows 10 with IntelliJ and I have updated my Jdk and ant to the latest version.
I was facing the same issue. Those variables ("cassandra.config", "cassandra.storagedir", etc...) are System variables.
You can either set them in your code by doing something like:
System.setProperty("cassandra.config", "file:///<PATH>/cassandra.yaml");
You can also set them whilst running the jar file:
java -Dcassandra.config=file:///<PATH>/cassandra.yaml -jar <JAR>
Best,
Shabir
Start a new process in jdk 1.8 and start embedded cassandra in it. and run your junit in your java version. I faced similar isue which jdk11 upgrade. Now i fixed this.
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class EmbeddedCassandraApplication {
public static void main(String[] args) throws Exception {
EmbeddedCassandraServerHelper.startEmbeddedCassandra("cassandra-test.yaml");
}
}

Windows App Certification Kit hangs

I have developed windows 10 App and uploaded that to windows store. However, I wanted to apply Windows Certification App Kit. The testing hangs during these two stages;
Direct3D trim after suspend
In progress...
UTF-8 file encoding
In progress...
I don't use any of those features in my app, but I don't understand why it should hang during process?
Thank you!
I ran into this exact same issue:
"Direct3D trim after suspend In progress... UTF-8 file encoding In progress..."
Problem was that I didn't try to run the Release Version locally first. It didn't run because I used preprocessor directives like so:
public static LicenseInformation licenseInformation = null;
...
#if DEBUG
...
...
licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
licenseInformation = CurrentApp.LicenseInformation;
#endif
"CurrentApp" did cause an exception.. I use code like this now:
#if DEBUG
...
...
licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
try
{
licenseInformation = CurrentApp.LicenseInformation;
}
catch (Exception)
{
}
#endif
And when working with the licenseInformation somewhere I check if it is not null before I use it...
I also found some other issues (warnings) in my code by using "Run Code Analysis on Solution"..
So in my case it was a problem with my code.
WACK "Hangs" because it is waiting for the app to start.The problem occurs if you use packages that internally use native code. An example is SQLite (Written in C++).
SQLite for Universal Windows Platform requires this Directive to be included in Properties/Default.rd.xml. Otherwise the external code will throw exceptions when your app is run in native mode (Release build in Visual Studio).
<Type Name="System.Collections.ArrayList" Dynamic="Required All" />
For details about this directive and EntityFramework.Sqlite (EF7), see: https://docs.efproject.net/en/latest/platforms/uwp/getting-started.html

Yii 2 Running a Cron in the basic template

I have seen instructions on running a cron in the advanced template, but cant figure out how to do it on the basic template. I have the following controller in the basic controllers folder.
<?php
namespace app\controllers;
use yii\console\Controller;
/**
* Cron controller
*/
class CronController extends Controller {
public function actionIndex() {
echo "cron service runnning";
}
public function actionMail($to) {
echo "Sending mail to " . $to;
}
}
I have navigated to the root of my application and tried all these comands
yii cron
php yii cron
Im getting unknown comand "cron"
I know this is an old question but failed to find anyone with an actual answer to this.
If you look at the code for the Yii exec file you'll notice it requires /common/config/aliases.php file as well as console/config/main.php. You can naturally change these or copy over these from the advanced template.
Hope that solves the problem for anyone wanting to do the same thing.

Groovy unable to resolve class in CloudHub

Have the following errors for the following scripts in a Mule flow when I run the application in CloudHub. When I run it on Anypoint studio, there's no issues.
I checked the deployed application archive file and in the classes folder is the compiled company.cloudtools.util.Utilities class. I am not sure why the CloudHub server cannot locate the class file as defined by the error.
Error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script16.groovy: 1: unable to resolve class company.cloudtools.util.Utilities
# line 1, column 1.
import company.cloudtools.util.Utilities
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:858)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:214)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngin
Script in Mule flow:
<scripting:transformer doc:name="parse record type">
<scripting:script engine="Groovy"><![CDATA[import company.cloudtools.util.Utilities
import com.netsuite.webservices.platform.core.types.RecordType
import org.mule.module.netsuite.RecordTypeEnum
// flowVars[ns_record_type] is used for the "get-record" operation
flowVars["ns_record_type"] = Utilities.findRecordType(payload["ns_record_type"], Arrays.asList(RecordType.values()), 0)
// flowVars[ns_record_type_enum] is used for the "update record" operation?
flowVars["ns_record_type_enum"] = Utilities.findRecordTypeEnum(payload["ns_record_type"], Arrays.asList(RecordTypeEnum.values()), 0)
return payload]]></scripting:script>
</scripting:transformer>
Utilities Class:
package company.cloudtools.util;
import com.netsuite.webservices.platform.core.types.RecordType;
import org.mule.module.netsuite.RecordTypeEnum;
import java.util.*;
public class Utilities {
//initial call... findRecordType("downloaditem", RecordType.values(), 0)
public static RecordType findRecordType(String bad_name, List<RecordType> available_enums, Integer current_character) {}
//initial call... findRecordTypeEnum("downloaditem", RecordTypeEnum.values(), 0)
public static RecordTypeEnum findRecordTypeEnum(String bad_name, List<RecordTypeEnum> available_enums, Integer current_character) {}
}
The issue is that CloudHub only supports JRE 1.6 for the version of Mule I am using, Mule 3.5.0. Mule workers that are 3.5.1 above uses the currently supported JRE 1.7. Had the change my applications JRE to get it to work.
As a later task, I will find out how to make it work with JRE 1.7 (probably have to update the runtime environment to 3.5.1 or above).
See the Technical / Troubleshooting section at Mulesoft - http://www.mulesoft.org/documentation/display/current/FAQ

Which is the environment variable for Mono/C# library DLLs?

I'm running the frozen Debian 7.0 Testing/Wheezy.
Here is my C# sample code:
using System.Windows.Forms;
using System.Drawing;
public class Simple : Form
{
public Simple()
{
Text = "Simple";
Size = new Size(250, 200);
CenterToScreen();
}
static public void Main()
{
Application.Run(new Simple());
}
}
I got the above C# WinForms code sample working in Monodevelop by using the System.Drawing and System.Windows.Forms references as well as in the command line when compiling with the following command:
mcs /tmp/Simple.cs -r:/usr/lib/mono/4.0/System.Windows.Forms.dll \
-r:/usr/lib/mono/4.0/System.Drawing.dll
I'm trying to make the mcs command work without needing to use the -r switch/parameter (which, by the way, I cannot find information on by looking through man mcs - I basically found this switch/parameter on some random website and it worked).
To check if it worked temporarily, I issued
export PATH=$PATH:/usr/lib/mono/4.0/System.Windows.Forms.dll:/usr/lib/mono/4.0/System.Drawing.dll
prior to issuing mcs /tmp/Simple.cs, which failed with the errors within the following output:
deniz#debian:~$ cd /tmp
deniz#debian:/tmp$ export PATH=$PATH:/usr/lib/mono/4.0/System.Windows.Forms.dll:/usr/lib/mono/4.0/System.Drawing.dll
deniz#debian:/tmp$ mcs Simple.cs
Simple.cs(1,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Simple.cs(2,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 2 error(s), 0 warnings
deniz#debian:/tmp$
The above output tells me that the mcs compiler/utility is not seeing the dll files but I don't know what else to try.
Any help in getting the WinForms and Drawing libraries to be automatically “looked at” would be greatly appreciated!
I'm trying to make the mcs command work without needing to use the -r switch/parameter
This is not possible, mcs will not look for libraries unless you tell it to look for them (which is done with -r:...).

Resources