Problems with Google Api query in Clojure - clojure

When I am executing the following query
(require '[clj-http.client :as http])
(http/post "https://www.googleapis.com/oauth2/v1/userinfo"
{:query-params {:access_token "token"}})
SunCertPathBuilderException unable to find valid certification path to requested target
sun.security.provider.certpath.SunCertPathBuilder.build
(SunCertPathBuilder.java:141)
This error also sometimes appears when executing the code
ExceptionInfo clj-http: status 404 slingshot.support/stack-trace (support.clj:201)
If someone could help me, I would appreciate it ...

You'll need to review these two sections:
Enable logging at the debug level, so you can get a better idea of why it's failing: https://github.com/dakrone/clj-http#logging
I think the issue is related to missing configuration for calls to an HTTPS address. Try changing the call as shown here: https://github.com/dakrone/clj-http#keystores-trust-stores . Here is an example answer that shows how to set SSL certs in more detail: https://stackoverflow.com/a/1710543/483566

Thank you Denis for the prompt response! I have reviewed the links, however what I found is to change the JDK 8 to JDK 7. But I would like to know why this situation occurs.

Related

How to access db.clj methods in core.cljs in clojure

I am trying to create a web app in clojure.
i have used clojurescript om and react.
there are two files core.cljs and db.clj.
core.cljs contains ui for login page and db.clj contains all database connections.
Now i am trying to call a db.clj method add-user[username password] in
core.cljs.
In db.clj
(defn add-user [username,password]
(sql/with-connection db
(sql/insert-values :users [:username :password]
[username password])))
In core.cljs
(dom/button #js {:ref "submit"
:onClick (fn[e](add-user usname passwrd))}"submit")
But i am not able to call that method in core.cljs.
It shows some error message like
clojure.lang.ExceptionInfo : failed compiling file:src\login_page\core.cljs
clojure.lang.ExceptionInfo : No such namespace: login_page.db, could not locate login_page/db.cljs, login_page/db.cljc, or Closure namespace "login_page.db"
Rename db.clj to either db.cljs or db.cljc. That should get you past the 'No such namespace' error message.
That's the basic gist of it. Of course your dependencies on clj libraries will have to be removed - that might be the reason for the negative comment below. Alter your code so that you use a simple atom as your database. That should get you developing.
And you can wait for a much better answer than this one that will show you how to get the Client and Server communication setup. But it may not come because, as pointed out in the comments, there is already documentation for this, and unfortunately quite a few choices that have to be made. Another unfortunate thing is that the way to do it now may not be the way to do it early next year. Watch the Om-Next space!
I've never had any problems compiling .cljs or .cljc files. You just have to set up your lein project.clj file properly. There will be plenty of examples if you Google around, or you can take a look at the following small Github project: https://github.com/chrismurrph/passing-time - no need to worry about the code, just look at its project.clj file.

How to enable Code Assist for ColdFusion builder 2.0.1?

I tried my best to enable the code assist in ColdFusion builder 2.0.1 but no luck.
I found two helping pages:
http://help.adobe.com/en_US/ColdFusionBuilder/2.0/Using/WS0ef8c004658c1089-554789f8121af8f0c8c-7ffb.html
and
http://help.adobe.com/en_US/ColdFusionBuilder/2.0/Using/WSf01dbd23413dda0e1736ebc1213a528ab0-7ffb.html#WS0ef8c004658c1089794dbeb6124c7814753-8000
what I am looking for is to let the coldFusion Builder assist me by auto-completing the REQUEST, SESSION, & APPLICATIONS variables. I tried the follow the instructions in the second link but it didn't work, maybe I wrote some incorrect data?
If any one managed to let it work, please help me.
Assuming you have set up the server correctly in CF Builder, it will talk to the server and cache the respond of what methods does a CFC have. (Console Tab: "Server is available. Getting server settings.")
E.g. If Person.cfc has property Name and Age with accessors=true, and you type p = new Person(), then "p." (Ctrl+Space) should see getAge(), getName(), setAge(), setName(). If you got that to work, you have set it up correctly.
As for variables in REQUEST, SESSION, & APPLICATIONS scopes, I think CFB would see if you have referenced them before on the same .cfm and may give you autocomplete, but don't count on it to be smart enough to know exactly what variables are there in the scopes.

Mongoid 4 finding embedded documents by ID

I have a project that is my first serious dive into Mongoid.
I saw a tip to use the following command:
Parent.where('childrens._id' => Moped::BSON::ObjectId(params[:id])).first
But this doesn't work. Error message was:
NameError: uninitialized constant Moped::BSON
I found that BSON is no longer included, so I added it to my Gemfile, as well as Moped. Then, I did another fix I found (placing Moped::BSON=BSON in application.rb).
This still didn't work, but the error changed to:
NoMethodError: undefined method `ObjectId' for BSON:Module
So I am assuming that this method got deprecated or something. Does anyone have any other tips?
Just to be clear, I am finding myself in the situation where I want to sort embedded documents using jquery-sortable. This requires me to update them in the database, but the serialize from that doesn't include the parent document in the hash. So I figured I'd try to get it on the back end using an ID from the embedded document. That is why I need it.
Thanks again for any help you can provide.
Try simply:
Parent.where('childrens._id' => params[:id]).first
I have solved the question though this won't be of much help to people in the future. The requirements have changed and now I am using human-readable strings as IDs to assist in friendly URLs and some other stuff.
Therefore, I don't have any issues with ObjectIds. Cortex's solution should (from what I have read) work for dealing with ObjectIds but I cannot verify it now.

Maldivian mystery in Sitecore and returning 404 on unsupported languages

A website I am currently working on is currently responding to requests on http://www.mysite.com/dv with 301, where I would have expected a 404.
My site has no content item named DV, there is nothing in the site that corresponds to "DV", and I can't understand why on earth I am seeing this. I originally found these /DV/ URLs while looking at Google Webmaster Tools.
Then I used Fiddler to analyse the request and found
Response sent 26 bytes of Cookie data:
Set-Cookie: wwwwebsite#lang=DV; path=/
This appears to correspond to the Maldivian language. I did not enable this language, and it does not appear under /system/Languages.
I then noticed I can also navigate to http://www.mysite.com/de-CH which is not an enabled language on my site either, leading me to believe I will get results like this for every non-enabled language.
Is there a way to return 404 for unsupported languages in Sitecore?
Try seeing what your "languageEmbedding" value in the web.config is set to.
It can be set to the following: asNeeded | always | never
I would normally set it to "never" unless you have a site, which is set in multiplate languages, then set it to "always". The default is "asNeeded" which I frankly find kinda silly :)
The issue you are having sounds similar to http://sdn.sitecore.net/Forum/ShowPost.aspx?postid=51681 but I an't find DV in LanguageDefinitions.config. I am also able to replicate your error so I don't think it is environment specific to your implementation. Would suggest you contact Sitecore Support.
I don't believe this is actually related to languages at all. If you were to add any random characters in place of the DV, you'd still get a 302 redirect to a 404. Perhaps without the language cookie though.
You should follow the directions here to turn on server side error page redirects.
http://herskind.co.uk/blog/2012/03/sitecore-404-without-302

Apache wink REST - IllegalArgumentException for a particular header

My rest service works fine if I give the authentication header. But the same is throwing 500 internal Service error when I add log-level=debug|info along with the authentication header. I don't know where it is failing. I'm getting only the below errors.
org.apache.wink.server.internal.RequestProcessor logException
IllegalArgumentException occurred during the handlers chain invocation
I could not able to get more information about the error. Please help me. Thanks.
Update:
i'm using wink incubator 1.1.1
Atlast found the solution to this. Instead of debug, when i try with Debug this is working fine. The exception was thrown from a .jar. when I got the source of it, i debugged and found the value for loglevel was in a enum and its in camelcase. The issue is fixed now. Thanks for your responses.