ATK4 Fatal Error - atk4

Fatal error: Class 'h1' not found in /home/iracersr/public_html/atk4/lib/AbstractObject.php on line 131
I have installed the latest version and here is the code im using. Any suggestions?
<?php
class page_index extends Page {
function init(){
parent::init();
$p=$this;
//Get Articles
$articles=$this->add('Model_News')->getRows();
$p->add('h1')->set('Latest News');
foreach($articles as $article){
$content=$this->add('view',null,null,array('view/blog'));
$content->template->set('title',$article['title']);
$content->template->set('content',$article['content']);
}
}
}

It's case sensitive.
->add('H1');

Related

mobx observable field for class type isn't working

I am using MobX 6+ in my project and I have a class with an #observable annotated field that contains class type.
I initialize the type with:
class MyClass {
#observable myObservableField = ClassToInitialize;
problemHere() {
....
const MyType = this.myObservableField;
const TypeInstance = new MyType(); // <-- Error is thrown at this line
....
}
}
class ClassToInitialize {
constructor() {
....
}
}
However I get the following error:
Uncaught TypeError: Class constructor IgnoreRegion cannot be invoked without 'new'
After investigating the issue, it appears to happen due to MobX wrapping the field in a proxy function.
In order to solve the issue, use shallow:
class MyClass {
#observable.shallow myObservableField;
....
}

"class constructors must be invoked with 'new'" when using Dexie in React

I am using Dexie with Gatsby, I try to create database in db.ts with the code below, but there is error class constructors must be invoked with 'new' pointing to the line super('newDB'). Any help for solving the error?
export class NewDB extends Dexie {
store0!: Table<Store0>;
constructor() {
super('newDB');
this.version(1).stores({
store0: '++id',
});
}
}
export const db = new NewDB();

React Native Navigation does not exist

I had to take a break from working on my react native app for a couple of months and when i came back to work on it again i couldn't boot anything up and i am getting a load of React Native Navigation errors...
I dont really know where to start with this, i have made some changes to the java files but nothing seems to get me out of this hole...
the error is below... if anyone knows how to deal with this i would be really greatful
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainActivity.java:3: error: package com.reactnativenavigation does not exist
import com.reactnativenavigation.NavigationActivity;
^
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainActivity.java:5: error: cannot find symbol
public class MainActivity extends NavigationActivity {
^
symbol: class NavigationActivity
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:21: error: package com.reactnativenavigation does not exist
import com.reactnativenavigation.NavigationApplication;
^
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:22: error: package com.reactnativenavigation.react does not exist
import com.reactnativenavigation.react.NavigationReactNativeHost;
^
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:27: error: cannot find symbol
public class MainApplication extends NavigationApplication {
^
symbol: class NavigationApplication
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:29: error: cannot find symbol
new NavigationReactNativeHost(this) {
^
symbol: class NavigationReactNativeHost
location: class MainApplication
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:47: error: method does not override or implement a method from a supertype
#Override
^
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:51: error: method does not override or implement a method from a supertype
#Override
^
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:53: error: cannot find symbol
super.onCreate();
^
symbol: variable super
location: class MainApplication
C:\git\BattleBuddy\android\app\src\main\java\com\battlebuddy\MainApplication.java:54: error: cannot find symbol
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
^
symbol: method initializeFlipper(MainApplication,ReactInstanceManager)
location: class MainApplication
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
This is from the build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
RNNKotlinVersion = "1.3.61" // Or any version above 1.3.x
RNNKotlinStdlib = "kotlin-stdlib-jdk8"
}
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
maven { url "$rootDir/../node_modules/react-native/android" }
maven { url 'https://maven.google.com' }
// ADD THIS
maven { url "https://www.jitpack.io" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
classpath 'com.android.tools.build:gradle:3.6.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
this if from the app build.gradle
dependencies {
implementation project(':#react-native-community_async-storage')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-vector-icons')
implementation "androidx.appcompat:appcompat:1.0.0"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:design:27.1.0'
}
This is the mainapp
public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost =
new NavigationReactNativeHost(this) {
#Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
#Override
protected List<ReactPackage> getPackages() {
#SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
#Override
protected String getJSMainModuleName() {
return "index";
}
};
#Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
#Override
public void onCreate() {
super.onCreate();
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
main activigty just looks like this
package com.battlebuddy;
import com.reactnativenavigation.NavigationActivity;
public class MainActivity extends NavigationActivity {
}
If there is anything you can think of that would help a lot

Unhandled Rejection (TypeError): Failed to construct 'AudioWorkletNode' [ReactJS]

class InputWorkletNode extends window.AudioWorkletNode {
constructor(context) {
super(context, 'input-processor');
}
get recBuffers() {
return ['test', 'test!'];
}
}
When the code is put into my reactjs project (initiated with create-react-app), it's giving me the following error:
Unhandled Rejection (TypeError): Failed to construct
'AudioWorkletNode': Please use the 'new' operator, this DOM object
constructor cannot be called as a function.
Has anyone had the same issue before? Any help would be appreciated.
Solved by putting the code into public folder and change it to
window.InputWorkletNode = class InputWorkletNode extends window.AudioWorkletNode {
constructor(context) {
super(context, 'input-processor');
} get recBuffers() {
return ['test', 'test!'];
}
}
One option that had success for me was to change from es5 to es6.
"target": "es6"
in tsconfig.json

How do I run shell with custom Error handler?

I have custom AppError class which starts with
App::import('Core', 'Error');
When I try to run any shell script I run into "Fatal error: cannot redeclare class ErrorHandler in ...\cake\libs\error". It seems the ErrorHandler for console is loaded...
Why don't you simply extend the ErrorHandler class if it is already loaded?
<?php
class AppError extends ErrorHandler {
}
?>

Resources