Re-frame dispatches and subscribes not working in the repl and test files - clojurescript

I have a re-frame project, and my events, subs and db cljs files are populated. I use these three in my project and it works well. But I created a test file, and called subscribe and dispatch in it like so:
(deftest category-filter-test
(dispatch [:add-filter "cat"])
(is (= #(subscribe [:filters]) ["cat"]))
)
And that doesn't work. I get
#object[Error Error: No protocol method IDeref.-deref defined for type undefined: ]
On the other hand, if I try to run subscribe in the shadow-cljs repl, I get the following error:
------ WARNING - :undeclared-ns ------------------------------------------------
Resource: :1:2
No such namespace: user, could not locate user.cljs, user.cljc, or JavaScript source providing "user"
--------------------------------------------------------------------------------
------ WARNING - :undeclared-var -----------------------------------------------
Resource: :1:2
Use of undeclared Var user/start
--------------------------------------------------------------------------------
ReferenceError: user is not defined
at eval (eval at shadow$cljs$devtools$client$browser$global_eval (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js), <anonymous>:1:1)
at eval (<anonymous>)
at Object.shadow$cljs$devtools$client$browser$global_eval [as global_eval] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:758:16)
at eval (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:767:44)
at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:167:108)
at Object.shadow$cljs$devtools$client$browser$repl_invoke [as repl_invoke] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:766:46)
at shadow$cljs$devtools$client$browser$handle_message (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:844:37)
at eval (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:307:151)
at Object.shadow$cljs$devtools$client$env$process_next_BANG_ [as process_next_BANG_] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:289:90)
at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:310:40)
How to fix these two errors?

Related

Error during compilation C code generated by Cython bad reloc address 0x0 in section `.data'

I'm trying to compile C code generated from Python code (hello world) and I'm stuck on one error.
I'm using mingw32-w64. After many errors now I'm using this command
gcc -DMS_WIN64 -I Python38\include -o test.exe test.c -lpython38 -lm -L Python38\libs -shared -Wl,--enable-auto-image-base -Wl,--enable-auto-import
But I'm getting error
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x28c): undefined reference to `__imp_PyExc_ImportError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x307): undefined reference to `__imp__Py_NoneStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x34c): undefined reference to `__imp_PyExc_AttributeError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x59c): undefined reference to `__imp_PyExc_RuntimeError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xb51): undefined reference to `__imp_PyExc_ImportError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xc23): undefined reference to `__imp_PyExc_NameError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xcb9): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd22): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd32): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd40): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd8a): undefined reference to `__imp_PyExc_SystemError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xfc4): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xfcd): undefined reference to `__imp__Py_TrueStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x101f): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1037): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1044): undefined reference to `__imp__Py_TrueStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x17c0): undefined reference to `__imp_PyModule_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x17d8): undefined reference to `__imp_PyModule_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x18d4): undefined reference to `__imp_PyBaseObject_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1e92): undefined reference to `__imp_PyExc_DeprecationWarning'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1ee9): undefined reference to `__imp_PyExc_TypeError'
c:/users/ja/documents/winbuilds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
Using Python 3.8.4 x86_64-w64-mingw32 Windows 10

json.parse works in js but not in angular ts

I am re-writing an existing js app into angular and ts. I have a json data file that I read as part of the startup of the existing js app and it works fine. When I try and read the exact same file with the exact same line of code in angular, ts/angular barfs all over it. Here is the code from the existing app:
aircraftData = JSON.parse(data);
and the console log is empty. Here is the the code from the new angular version of the app:
const content = require('./shared/imeiXref.json');
console.log("IMEI=",content[0].IMEI);
and the console output:
AppComponent_Host.ngfactory.js? [sm]:1 ERROR SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at AppComponent.push../src/app/app.component.ts.AppComponent.ngOnInit (app.component.ts:33)
at checkAndUpdateDirectiveInline (core.js:22089)
at checkAndUpdateNodeInline (core.js:23353)
at checkAndUpdateNode (core.js:23315)
at debugCheckAndUpdateNode (core.js:23949)
at debugCheckDirectivesFn (core.js:23909)
at Object.eval [as updateDirectives] (AppComponent_Host.ngfactory.js? [sm]:1)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:23901)
at checkAndUpdateView (core.js:23297)
View_AppComponent_Host_0 # AppComponent_Host.ngfactory.js? [sm]:1
proxyClass # compiler.js:18234
push../node_modules/#angular/core/fesm5/core.js.DebugContext_.logError #
core.js:24129
push../node_modules/#angular/core/fesm5/core.js.ErrorHandler.handleError # core.js:15762
(anonymous) # core.js:18116
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke #
zone.js:391
.....
Is JSON expected to be in a different format from js to angular/ts?
Thanks....
It was actually already working. I didn't realize that when I read the file in I was already able to parse the JSON by field name so I don't even need to run JSON.parse.

Invalid mapping while running gulp

im trying to run gulp in node console and I get an error like below. I was looking over the net for a solution, but nothing has work so far. Hope you can help me.
C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-generator.js:298
throw new Error('Invalid mapping: ' + JSON.stringify({
^
Error: Invalid mapping: {"generated":{"line":157,"column":3},"source":"../bower_components/bootstrap/scss/mixins/_hover.scss","original":{"line":12,"column":-19},"name":null}
at SourceMapGenerator_validateMapping [as _validateMapping] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-generator.js:298:13)
at SourceMapGenerator_addMapping [as addMapping] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-generator.js:110:12)
at C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\concat-with-sourcemaps\index.js:60:28
at Array.forEach ()
at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-consumer.js:157:14)
at Concat.add (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\concat-with-sourcemaps\index.js:58:18)
at DestroyableTransform.bufferContents [as _transform] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\gulp-concat\index.js:68:12)
at DestroyableTransform.Transform._read (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\readable-stream\lib\_stream_writable.js:406:64)
Node version - 8.9.4
npm version - 5.6.0
source-map version - 0.6.1

Webpack breaks when i include node-rsa library

When I try to include the node-rsa library with Webpack, as so:
import NodeRSA from 'node-rsa';
I get the following error:
ERROR in ./~/constants-browserify/constants.json
Module parse failed: /home/hencic00/Dropbox/Documents/Camelot/node_modules/constants-browserify/constants.json Unexpected token (2:12)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:12)
at Parser.pp$4.raise (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack/lib/Parser.js:902:15)
at DependenciesBlock.<anonymous> (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack/lib/NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/home/hencic00/Dropbox/Documents/Camelot/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /home/hencic00/Dropbox/Documents/Camelot/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
# ./~/node-rsa/src/NodeRSA.js 10:16-36
There doesn't seem to be any existing questions on this topic.
Any ideas?
Just add json loader to your webpack config.

Gradle error with Android-studio and googleMap api

I created a simple project to test Google Api under android studio , but I have this error I tried to correct it by adding maps.jar to librairies of project structure no way :
Information:Compilation completed with 12 errors and 0 warnings in 17 sec
Information:12 errors
Information:0 warnings
/home/phenix-dz/AndroidStudioProjects/Geolocalisation/Geolocalisation/src/main/java/com/example/geolocalisation/MainActivity.java
Error:Error:line (4)Gradle: error: package com.google.android.maps does not exist
Error:Error:line (5)Gradle: error: package com.google.android.maps does not exist
Error:Error:line (6)Gradle: error: package com.google.android.maps does not exist
Error:Error:line (9)Gradle: error: cannot find symbol class MapActivity
Error:Error:line (11)Gradle: error: cannot find symbol class MapView
Error:Error:line (12)Gradle: error: cannot find symbol class MapController
Error:Error:line (16)Gradle: error: cannot find symbol variable super
Error:Error:line (17)Gradle: error: cannot find symbol method setContentView(int)
Error:Error:line (19)Gradle: error: cannot find symbol class MapView
Error:Error:line (19)Gradle: error: cannot find symbol method findViewById(int)
Error:Error:line (14)Gradle: error: method does not override or implement a method from a supertype
Error:Error:line (25)Gradle: error: method does not override or implement a method from a supertype
also I tried to add this code :
apply plugin: "java"
dependencies {
compile files('/home/phenix-dz/android-studio/sdk/add-ons/google_apis-671458-mac-x86/libs/maps.jar')
}
in build.gradle file but it gives me a same error.
Thanks