Using object in views in Kohana 3.0 - kohana-3

I am upgrading a project from Kohana 2 to Kohana 3.
In the Kohana 2 version, in the view file, it is written:
if ($this->uri->segment('page'))
{
if ($this->uri->segment(5))
{
In Kohana 3, I changed this to
if ($this->request->param('page'))
{
if ($this->request->param('param5'))
{
but it's giving the following error message.
ErrorException [ Fatal Error ]: Using $this when not in object context
How should I resolve this?

Use Request::current()->param();. Refer to Upgrading from 2.x for further details.

Related

What is the proper syntax for using subcontrollers with Ufront?

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 ?

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

LiveTile plugin for Windows Phone 8 in Cordova 3.3

I have tried to add the LiveTile plugin (found here) to my clean Cordova 3.3 project. But I can't seem to get it to work. It works with the instruction from the link but that uses Cordova 2.0.0.
I get the following printout when I try to add a new Tile:
An exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll
An exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll and wasn't handled before a managed/native boundary
Unable to cast object of type 'System.Collections.Generic.List`1[System.Object]' to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]'.
Failed to deserialize Cordova.Extension.Commands.LiveTiles+LiveTilesOptions with JSON value :: ["System.Collections.Generic.Dictionary`2[System.String,System.Object]","LiveTiles963855178"]
A first chance exception of type 'System.NullReferenceException' occurred in CordovaWP8_2.9.14.DLL
An exception of type 'System.NullReferenceException' occurred in CordovaWP8_2.9.14.DLL but was not handled in user code
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll
An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
ERROR: Exception in ProcessCommand :: Exception has been thrown by the target of an invocation.
ERROR: failed to InvokeMethodNamed :: createSecondaryTile on Object :: LiveTiles
The thread 0xbac has exited with code 259 (0x103).
Error occurred: Invalid action
Are plugins added differently with this new version of Cordova or is the LiveTile plugin simply not compatible anymore?
This might have been a dumb question, but since the documentation is so poor it is hard to call any question dumb.
I have however manage to solve this now, and in the off chance that someone else runs in to the same problem I'll try to explain what I did.
First I found this implementation of the LiveTiles plugin which seemed to be more recent then the one in the question. Instead of creating a new project through Visual Studio I used the CLI.
phonegap create hello com.example.hello HelloWorld
Then I used plugman to install the plugin according to the link above.
plugman install --project . --platform wp8 --plugin com.risingj.cordova.livetiles
Now I looked through my files to see what had happened.
config.xml - some addition
<?xml version='1.0' encoding='utf-8'?>
<widget>
<access origin="*" />
<feature name="LiveTiles">
<param name="wp-package" value="LiveTiles" />
</feature>
</widget>
a new file was generated: cordova_plugins.js in the www-folder with the following content:
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/livetiles.js",
"id": "com.risingj.cordova.livetiles.livetiles",
"clobbers": [
"LiveTiles"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{
"com.risingj.cordova.livetiles": "0.1.0"
}
// BOTTOM OF METADATA
});
I added these files to a Cordova Visual Studio-project and it worked! So I guess if a new plugin is added this is what is needed.
You need to do this :
cordova plugin add path/to/your/plugin
It will do all the stuff.

Griffon JMX Plugin 0.3 don't work.(update descript)

Griffon JMX Plugin 0.3 don't work.
anyone use this version
1.got error: no lib folder
then i download the src, cp lib/griffon-jmx-addon-0.3.jar
2.create a service
class SmsManagerService {
static expose = ['jmx:service=Country,type=special']
def serviceMethod() {
"a"
}
}
3.run-app && connect by jconsole, by did not find my mbean.
am i missing some step? plz help,thanks
Andres Almiray :
1 fixed in version 0.4 of the plugin
2 you are selection the wrong Java process. You must select the process that runs the application (griffon.swing.SwingApplication) not the one that runs the griffon command (o.c.g.GriffonMain).
3 JmxGriffonAddon and JmxGriffonPlugin are the only sources needed by the plugin

I update kohana 3.0.5->3.1.1 error

I followed the example http://www.dealtaker.com/blog/2010/02/25/kohana-php-3-0-ko3-tutorial-part-5/
I get the following error:
ErrorException [ Notice ]: Undefined property:Response::$response.
APPPATH\views\pages\hmvc.php [ 2 ].
I don’t know how to fix it. Can you offer any suggestions?
In Ko3.1 execute() method returns Response object. You must use echo Request::factory('posts/getposts')->execute()->body() or just echo Request::factory('posts/getposts')->execute().
Follow this tutorial to upgrade your Kohana app.

Resources