Is it possible to run clojure in kotlin? More specific in spring?
I have made scrapers in clojure and I want to use them on a web application written in kotlin. How does that look like in kotlin? The code..
I would suggest using the clojure.java.api.Clojure class, as documented in the Java interop section of Clojure reference documentation under the heading Calling Clojure From Java.
A Java example:
import clojure.java.api.Clojure;
import clojure.lang.IFn;
// this part taken from the reference page linked above:
IFn plus = Clojure.var("clojure.core", "+");
plus.invoke(1, 2);
Related
I am developing an web application using the Play framework in Scala language. In my application I have to access the native methods which is written in C++ and converted into .so by using swig.
My aim is to call the native method which is in .so file from the Controller class. I have searched in the internet, but I didn't get any documentation for this.
I have seen some links which is used by scala language.
https://code.google.com/p/scala-native-access/
https://code.google.com/p/bridj/wiki/Download#Specialized_subsets_(smaller_JARs_!)
https://github.com/xudongyang/scala-native-access
But they didn't mention how exactly use this in the Play framework.
Can anybody have the documentation for Play scala native access?
Can anybody have the sample applcation for the same?
Like in any JVM language, JNA/JNI gives you native access. Be aware that because of Play's use of class loaders, you'll need to make sure you access from the same class. See fail to load a native library using activator (Play Framework)
This is hard to answer in general. Play! is just a Scala library and framework, some any tool that allows you to use native calls in Scala will work similarly with play. From the first link that you pointed to, there are instructions to integrate with SBT (the Scala Build Tool) which also manages your Play framework. You will need to make the changes they mention to your build.sbt file which you can find in the top level of your Play project folder.
I want to read text from the tool tip of a web element in Python. Working on automation testing of UI in selenium.
Given that you are using Python, there is no getAttribute method. As seen in the documentation, it should be get_attribute:
self.browser.find_element_by_css_selector('span.blue-c6').get_attribute('title')
I've gone through the Ring/Enlive tutorials. I'm trying to pick up the rest of the Clojure webstack by learning how to use Google Closure with Clojure. So far, I have the Google Closure book (but haven't read it yet). What are the good resources for learning the Clojure/Closure webstack?
Thanks!
if you want to use clojure on the client (clojurescript) too (and it probably makes sense to do so, because it has very tight integration with closure) then you need to download + play with clojurescript one.
it's a complete example (server + client) that you can pull apart and play with.
Are there any open source projects that use both JRuby and Clojure and integrate the two parts somehow?
I have never used these projects, but they should give you a starting point:
https://github.com/stilkov/jruby-rails-clojure
https://github.com/technomancy/clojure-gem
The AltLaw project (2007-2010) used JRuby and Clojure.
Example Clojure code calling JRuby
I added a Clojure REPL to Redcar Editor. It was a pretty painless process and worked just as you would expect. The source code is available on GitHub.
I need to write a Clojure script to create a simple app by using Vaadin.
In Java I cam use some thing like this. "import com.vaadin.Application;"
But I don't know how to do it in Clojure.
I need to know how to import it and the place I should keep that .jar.
There is a build tool for clojure called leiningen.
Follow these instructions to install it: https://github.com/technomancy/leiningen
Create a new project
Put that jar to lib folder
Import classes you need
For example:
(ns your-project-name.core
(:import (com.vaadin Application)
(com.vaadin.ui Button Form HorizontalLayout)
(com.vaadin.data.Property ValueChangeEvent)))
Also read this article on how to use java classes in clojure: http://java.ociweb.com/mark/clojure/article.html#JavaInterop
Note that clojure does not provide a way to import every class in a Java package without specifying each class explicitly: How do I import the entire package but exclude some in Clojure?
I use Vaadin with Clojure as well and I initially had alot of pain. In the end I made sure I wrote alot of example Vaadin applications using Java only. Once I was familiar with Vaadin I wrote alot of example Clojure applications. Once I was proficient in both then I attempted to use Vaadin with Clojure, and I haven't looked back since.