So following this tutorial:
https://github.com/evanmiller/ChicagoBoss/wiki/An-Evening-With-Chicago-Boss
Everything works like a charm except that I can not use "user" as a modelname. A minimum usecase:
-module(customer, [Id, Name, PasswordHash]).
-compile(export_all).
This will work fine.
-module(user, [Id, Name, PasswordHash]).
-compile(export_all).
this will stacktrace, and on ./rebar compile, it throws:
ERROR: pre_compile failed while processing /Users/abe/github/awesome-name: {'EXIT',{{badmatch,{error,["code reload failed: user"]}},
[{boss_load,load_all_modules,3,
[{file,"src/boss/boss_load.erl"},{line,30}]},
{boss_load,load_all_modules_and_emit_app_file,2,
[{file,"src/boss/boss_load.erl"},{line,44}]},
{boss_rebar,compile,4,
[{file,"/Users/abe/github/ChicagoBoss/priv/rebar/boss_rebar.erl"},
{line,85}]},
{boss_plugin,pre_compile,2,
[{file,"priv/rebar/boss_plugin.erl"},{line,105}]},
{rebar_core,run_modules,4,[]},
{rebar_core,execute,5,[]},
{rebar_core,process_dir1,6,[]},
{rebar_core,process_commands,2,[]}]}}
this occurs with both {db_adapter, mock} and {db_adapter, mongo}.
Anybody know what's going on? Is the user keyword reserved somewhere? I can't find it in the documentation if it is...
Erlang has a flat module namespace. There is a module named user in the kernel application.
Related
I recently got the following error when I was trying to read a file in elixir.
iex()> File.read("no_existant_file.csv")
{:error, :enoent}
Luckily I knew what "enoent" meant and quickly realised that this was because I had a typo in the file name. Once I fixed this everything worked as expected.
However, this made me wonder if there was a way to change this error message into a more "human friendly" message that could potentially be displayed to an end user?
The function I was after in this question is the erlang function :file.format_error.
Using the example above
iex()> {:error, error_msg} = File.read("no_existant_file.csv")
{:error, :enoent}
iex()> error_msg
:enoent
iex()> :file.format_error(error_msg)
'no such file or directory'
Using :file.format_error/1 we can see that the error is now a lot more user friendly
I'm developing Twitter sign in for my platform. I want to use for this purpose clj-oauth library (https://github.com/mattrepl/clj-oauth). I added [clj-oauth "1.5.2"] to my project.clj and created seperate file oauth.clj for testing purposes with only this code:
(ns greenius.service.oauth
(:require
['oauth.client :as 'oauth]))
When I try compile oauth.clj I get error:
ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.Named clojure.core/name (core.clj:1518)
I have an impression that I follow the guide in every bit. What could be the cause of that error?
Remove the ' because you are using the require from inside the ns macro, so the names have to be symbols.
Example from the ns documentation:
(ns foo.bar
(:refer-clojure :exclude [ancestors printf])
(:require (clojure.contrib sql combinatorics))
(:use (my.lib this that))
(:import (java.util Date Timer Random)
(java.sql Connection Statement)))
I managed to fix the problem.
First I followed th esuggestion given by #Razvanescu and changed ['oauth.client :as 'oauth] into [oauth.client :as oauth].
After that I was getting new error:
FileNotFoundException Could not locate oauth/client__init.class or oauth/client.clj on classpath: clojure.lang.RT.load (RT.java:443).
When I reran my IDE it changed into CompilerException java.lang.ClassNotFoundException: org.apache.http.conn.ssl.SSLContexts, compiling:(clj_http/conn_mgr.clj:1:1)
Googling that error led me to this: https://github.com/cemerick/friend/issues/128.
I was using friend 0.2.0 and clj-oauth uses clj-http so it applied to my problem. After I upgraded to [com.cemerick/friend "0.2.2-SNAPSHOT"] and reran my IDE the problem was gone and it works now.
Sad thing is that I realized just now that twitter grants info only about username, which in my case is practically useless for sign up...
Having a really strange issue in a Grails service. I have a service thats setup like this:
package com.mydomain
import java.net.URLEncoder
import java.rmi.server.UID
import java.security.*
class EmailConfirmationService {
def sendConfirmation(Person person) {}
}
And I'm calling it from a controller with emailConfirmationService.sendConfirmation(person)
When I startup the Grails app, it throws the following error:
MissingMethodException occurred when processing request: [POST] /api/people/
No signature of method: mydomain.api.EmailConfirmationService.sendConfirmation() is applicable for argument types: (com.mydomain.Person) values: [name#mydomain.com]
All I have to do is save the EmailConfirmationService file, the watcher picks it up and recompiles, then it works great and never again throws that error.
Until I restart, then it errors until I save that file again.
I've tried the following but nothing has worked yet:
clean build
changed function name
made sure person instance existed
Any ideas?
Your service states another package (com.mydomain) than the one in the error message (mydomain.api). Please make sure, that the packages match and that the file is located in grails-app/services/com/mydomain/EmailConfirmationService.groovy (unless all of this is due to some obfuscation you did for SO)
I'm a meck (and Erlang) newbie and I'm struggling a bit with meck. I'm getting the following error:
=ERROR REPORT==== 27-Jan-2014::16:20:05 ===
Error in process <0.1825.0> with exit value: {{not_mocked,substatsDb},
[{meck_proc,gen_server,3,[{file,"src/meck_proc.erl"},{line,443}]},{meck_code_gen,exec,4,
[{file,"src/meck_code_gen.erl"},{line,147}]},{substats,loop,1,
[{file,"/Users/uyounri/gitsandbox/subpub/src/su...
At the beginning of my test I declare the module to be mocked:
meck:new(substats)
At the very end of my test the last thing I do is to unload the module that was mocked mocked:
meck:unload(substats)
The mocking seems to be working as expected until towards the end of the test when the above error is produced.
Thanks,
Rich
EDIT
Adding 2 ?debugFmt() lines seems to have fixed the problem; at least I no longer get the error. Here's the complete function that was modified:
stop(_) ->
meck:expect(substatsDb, stop, 1, fun(dbconn) -> ok end),
substats:stop(),
%% Note: this and the next ?debugFmt() calls prevent a meck
%% exit error. They both have to be present to prevent the error
?debugFmt("stop:~n", []),
meck:unload(substatsDb),
?debugFmt("stop: exit~n", []).
Have you tried adding the option passthrough when mocking the module?
meck:new(substatsDb, [passthrough])
Also, you are using the module "substatsDb" in the meck:expect call, but doing the meck:new for another module (substats), you should be doing everything for the same modules (new, expect, and unload)
hope it helps!
I can upgrade php 5.2 in my server. I have to make this server work today (the vacation I have planned tomorrow is under question because of this error) with new testlink. I am stuck with following error i.e Paamayim nekudotayims.
What changes I should do to resolve it?
This link contains the file with the bug.
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
SO may be in your codes you try to call static method or properties with wrong operator.
From Wikipedia:
In PHP, the scope resolution operator is also called Paamayim
Nekudotayim (Hebrew: פעמיים נקודתיים), which means “double colon” in
Hebrew.
The name "Paamayim Nekudotayim" was introduced in the
Israeli-developed Zend Engine 0.5 used in PHP 3. Although it has been
confusing to many developers who do not speak Hebrew, it is still
being used in PHP 5, as in this sample error message:
$ php -r :: Parse error: syntax error, unexpected
T_PAAMAYIM_NEKUDOTAYIM
As of PHP 5.4, error messages concerning the scope resolution operator
still include this name, but have clarified its meaning somewhat:
$ php -r :: Parse error: syntax error, unexpected '::'
(T_PAAMAYIM_NEKUDOTAYIM)