w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Play! 2.1 sbt publish a dist cycle in tasks error
The problem was that the dist task and publish task where in a cycle. So all we had to do is have the publish task depend on distHack. In other words, we replaced this: .settings(addArtifact(Artifact(appName, "zip","zip"), dist).settings : _*) with .settings(addArtifact(Artifact(appName, "zip","zip"), distHack).settings : _*) There was also another problem. The main app.jar was not being included in the dist. So we had to comment the line that prevented from publishing the packaged binary in 2.0.4: //publishArtifact in (Compile, packageBin) := false,

Categories : Scala

Change 'play dist' output file name via command-line
You can modify the output by changing the build.sbt file in your project directory. name := "myname" version := "1.0-SNAPSHOT" Remember to recompile, might have to clean too.

Categories : Scala

Include javascript libraries scoped
Google and Facebbok with their +/like buttons resolves this using an iframe. But it really depends on what your widget will be doing. If it needs to interact and modify the page in which it is included, then you've to deal with what there could be on the page. Like using the already included backbone version if any, or include your zepto and bb within a different namespace.

Categories : Javascript

How to "prefer source" for a few selected dependencies, and "prefer dist" for the rest?
You should simply not allow your own dependencies to have a distribution download link. That excludes using Github, but will happily work with any pure Git repository. Composer explicitly checks if the repo url points to Github and then tries to download from the known sources instead of cloning the repo, which usually is way faster. So you probably should reference your local Git repos instead of Github (which I assume you are doing right now). There is however no way to decide per dependency which method to use.

Categories : PHP

How can I use Play Framework's FakeApplication to stub out calls to web services via play's WS object?
You could create a structural type that mimics the WS signature and use that in your code. type WSLike = { def url(url: String): WSRequestHolder } Then you can inject your own version of a WSLike class. In combination with a mock library I guess you could do about anything you want. As for the second question. You could call it like this: val url = Play.current.configuration .getString("my.webservice.url") .getOrElse(throw new PlayException( "Configuration error", "Could not find my.webservice.url in settings")) WS.url(url) Then in your application.conf add the correct url. You can supply a different one using the FakeApplication. FakeApplication(additionalConfiguration = Map("my.webservice.url" -> "http://localhost/service"))

Categories : Web Services

Running Play framework 2.1.1 and getting "exception when typing play.Project.javaCore"
Ok so in the end I had to delete the repository cache - I'm guessing it'd got corrupted somehow. Which would explain why it was complaining about not being able to find some class files. Another possibility about why it stopped working may be due updates to java itself. There had been at least one update to java (to 1.7.0_25 on ubuntu) since I last tried running play, so there may have been some issue there (perhaps minor binary class file change?). My play folder is in my home directory, so I did the following: $ cd ~/play-2.1.1/ $ rm -r repository/cache/ Then tried running play again inside one of the sample app folders. It took a while (presumably as it was rebuilding the cache) and then worked.

Categories : Java

Play Framework 2.1.1 cannot find play object in multi-project setup Build.scala
Are you sure the Play plugin is correctly loaded ? Without it, the Play library cannot be used in the Build file (or anywhere else). As explained here, the project/plugins.sbt file must contain the plugin definition. You can look at these samples to have working examples of this file: // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0"))

Categories : Scala

Play Framework - Is it posible to combine use of Promise and WebSocket in Play?
I do not believe you can use a promise with a web socket. However, you can use Akka to execute a task in the background. For example, the following code should let Akka handling the longer operation (database query) in the background: public static WebSocket<String> webSocket() { return new WebSocket<String>() { public void onReady(final WebSocket.In<String> in, final WebSocket.Out<String> out) { in.onMessage(new F.Callback<String>() { public void invoke(String event) { Akka.system().scheduler().scheduleOnce( Duration.Zero(), new Runnable() { public void run() { String result =

Categories : Java

Mongoose include model with dependencies
If you want to define an array of references, you should use the following definition: ResourceSchema = new Schema({ "comment": [{type : Schema.ObjectId, ref : 'Comment'}] }); The way you defined comments is used to define an array of subdocuments (see mongoose API docs). So, you should use it only if you want to store all your comments directly inside of the parent document. In this case Comments schema should be already defined, or required from another module.

Categories : Node Js

How to include local dependencies in my ant build
You should use the war task instead: <war destfile="${warname}" webxml="war/WEB-INF/web.xml"> <fileset dir="${work.home}"/> <lib dir="${lib.dir}/" includes="log4j.jar"/> <classes dir = "${CLASSES}" /> </war> You can configure it to find the dependency jars to be included in your war file and to specify the path to the web.xml folder. You shouldn't be coping the .class files to the destination in the war folder, let the war task do it for you.

Categories : Java

Distribute Play! Application With All Dependencies
Yes you can. In your dev machine, from the command line, cd into your app and run play dist. This will create a zip file into the dist directory. Upload that to your server. Then log into your server and unzip it. To start the app run something like this: nohup jdk7/bin/java -Dhttp.port=9000 -cp "mopra/lib/*" play.core.server.NettyServer & replace jsk7/bin/java with your java location, 9000 with the port you'll be forwarding to in apache and "mopra" with the path of what you unzipped.

Categories : Apache

How should one handle dependencies among Play sub-projects?
After more searching, I came across this blog entry. I'm going to give this a shot and see how it works: http://eng.42go.com/play-framework-dependency-injection-guice/ After using this for a couple of weeks, it's been mostly a success. There are still chicken/egg problems to work out, but I think that's because I hadn't really thought through how much each of my sub-projects depended on others. There's still no really easy way to access routes from parts of projects you don't depend on, but you probably shouldn't be linking to projects you don't depend on, anyway. I did figure out how to specify a main template and urls/calls for things like my "Not Found", "Permission Required", and "Login" pages so that all sub-projects could access them.

Categories : Scala

How to make Visual Studio resolve and include all the dependencies of my project during build?
Basically, using Visual Studio, you can set all of your Solution's Projects to build into the same Output folder and use this folder as your Windows Form application folder (where the application EXE will reside). By doing this, you will coordinate all of the possible assemblies references that your app is depend on. In VS 2012, right-click on a Project => Properties => Select Build (left pane) => Set your Output path: I would select a a solution-level folder as the Output path. And if it's prohibited to perform such a modification at your workplace so I would suggest you to use dependency analysis tools like the following in order to interrogate and gather the appropriate assemblies that your app is depend on and will require at run-time: Dependency Walker NDepend Red-Gate Reflect

Categories : C#

How to use component binding in JSF right ? (request-scoped component in session scoped bean)
In JSF 2.x, unless you want to manipulate components programmatically (which is at its own also rather fishy), there is no sensible real world use case to bind components to a backing bean. For sure not if they are further not been used in the backing bean itself, or if it are solely their attributes which are been flattened out. As to the functional requirement of getting the current row of the data table, there are much better ways listed here, How can I pass a parameter to a commandLink inside a datatable?, for example if your environment supports EL 2.2: <h:dataTable value="#{bean.items}" var="item"> <h:column> <h:commandLink value="Foo" action="#{bean.foo(item)}" /> The two last requirements are totally unclear. At least, if you're doing something

Categories : JSF

Java Framework with Service Dependencies?
This is trivial (and common) to accomplish in OSGi with Declarative or Blueprint Services, where you declaratively define dependencies between services. Really, the only thing to be careful of is cyclic dependencies which would cause everything to fail to start.

Categories : Java

Launching ruby script with gem dependencies but with no framework at all?
Looks normal to me! Are you certain this line: concerts = data.css('.concert_listing') results in concerts having anything enumerable in it? Have you tried this right after it? puts concerts

Categories : Ruby

Does the Boost testing framework support test dependencies?
Well, you've found yourself that the feature is there and according to the links, it's there for end user to use. It's not documented by accident and "should be added soon" (as per links). Now, here's a nother post I've found which uses feature: http://boost.2283326.n4.nabble.com/Unit-Test-Framework-strange-behaviour-of-test-unit-depends-on-td2653654.html Sample from there (unfortunately, looks like no BOOST_AUTO_TEST_CASE works there). Also note that code is incorrect because Dependency() is never called and therefore dependent test doesn't run as well. #include <boost/test/included/unit_test.hpp> using boost::unit_test::test_suite; void Dependency() { BOOST_MESSAGE( "Dependency!" ); BOOST_CHECK( 1 ); } void TC_TestCase() { BOOST_MESSAGE( "A test case!" ); BOOST_CHECK(

Categories : C++

@ManagedProperty - access properties Injected from one view scoped bean into another view scoped bean
I have injected one request scoped bean into another view scoped bean You're not allowed to inject a bean into another bean of a wider scope. As a rule, the following abominations are not allowed :) @RequestScoped >> @ViewScoped @ViewScoped >>@SessionScoped @SessionScoped >> @ApplicationScoped EDIT (Based on your update): Injecting a property of a bean, as against injecting the bean itself, will result in a static injection. The static injection means that the value that's injected into the target is what's available as at the time of injection. As a the time the following line was executed: @ManagedProperty(value="#{selectOfferMpans.selectedSites}") selectedSites is null. So what you should be doing there instead is injecting the entire bean @ManagedProperty(value="#{sele

Categories : JSF

How to include zend framework?
The 'Zend' folder is part of the library, so your include path should be C:wampzend-library. You'll also need to have setup the autoloader (ZF or Composer) for your code example to work.

Categories : PHP

SDL framework include on MacOS Qt
I don't know why it had previously worked, but let's note the following: Addition of the framework to the LIBS only takes care of linking, not compilation. You don't need the INCLUDEPATH, it's not necessary. You need to add the frameworks path for both the linker and the compiler: // The directory where some frameworks are installed. There must // exist SDL.framework as a subdirectory of that directory. // It's simply to avoid typing the path twice. // It's a user variable, not interpreted by qmake SDL = -F/Library/Frameworks // Let the C/C++ compiler know where to find the frameworks. // This is so that when you include <xyz/foo>, it'll be replaced // by $$SDL/xyz.framework/Headers/foo // $$var is replaced by qmake by the contents of var QMAKE_CFLAGS += $$SDL QMAKE_CXXFLAGS += $$

Categories : Qt

How to do Play Framework with AngularJS e2e testing or with Play testing
Please be a little bit more precise about "proper behaviour". What is the bug ? Is the problem about integrating e2e tests with the Play workflow or just having e2e AngularJS green instead of red ? The difficulty here is to define "End-to-end" since there is no good definition of it, in wikipedia there is no mention about it. You can have have a good idea of what it is just because it is self-speaking, and there is also a excellent thread about end-to-end here : http://www.geekinterview.com/question_details/40319 So let's say that you want to test all scenarios with Front + Back in a close-to-prod environment. End-to-end testing AngularJS is supposed to be done with Karma, but, warning, it will be soon changed by ProtractorJS. Doing e2e test with Karma has serious drawbacks : It may

Categories : Javascript

getting the value of a checkbox in play framework
From what I can understand of your question, in simple Javascript: if(checkBoxDetails.checked){...} or even if(checkBoxDetails.checked == true){...}

Categories : Twitter

Play framework 2.1.x and EbeanServer
Try running your test code inside a fakeApplication(): import ... import play.test.Helpers.*; public class TestSomeModel extends BaseModelTest { @Test public void myModelCreate() { running(fakeApplication(), new Runnable() { public void run() { SomeModel model = new SomeModel(); model.someStringAttribute = "some value"; assertThat(model.id).isNull(); model.save(); assertThat(model.id).isPositive(); } } } }

Categories : Java

Play Framework MVC mailer
That's easy. You can just call addRecipient multiple times to add more recipients. Or you can pass multiple recipients to it, like this: addRecipient("alice@example.com", "bob@example.com", "charlie@example.com"); Or you can pass an array to addRecipient: String[] rcpts = new String[] {"alice@example.com", "bob@example.com"}; addRecipient(rcpts); Or you can take a List, make an array from it, and then pass it: List<String> rcptsList = new ArrayList<String>(); rcptsList.add("alice@example.com"); rcptsList.add("bob@example.com"); addRecipient(rcptsList.toArray(new String[rcptsList.size()]));

Categories : Java

Enforcing SSL in Play! Framework 2.1.3
This is super easy with Play 2.2, not sure it works on 2.1.3, I didn't see it in the 2.1.x docs...but was in the 2.2.x docs...so give it a shot, it might be implemented. Throw this in your configuration file : http.port=disabled Or you could run it with the command line option : -Dhttp.port=disabled http://www.playframework.com/documentation/2.2.x/ConfiguringHttps

Categories : Ssl

How to run a JPA Query in Play Framework 1.2.5
You have to import the Query class. import javax.persistence.Query; Doesn't your IDE flag such errors? SHouldn't you be able to fix basic compilation errors before using Play and JPA? Start by learning the basics of Java. Also, select * from Book is not JPQL. select b from Book b is.

Categories : Java

Play framework 2.1 with Spring
Play has it's own way of managing REST, transactions (depending on the JPA library used) and interceptors. You can integrate it with Spring, see this demo in github, but I'd first think about if you really need it.

Categories : Spring

Entity Framework .Where nested in .Include
The short answer is no, EF will not let you do that using Include(). Think about the result if it let you do this: in one case your MemberLink.MasterMember.ReceivedMessages will be fully populated, on another identical looking object MemberLink.MasterMember.ReceivedMessages is actually a sub-set of messages! What happens if you try to add to the ReceivedMessages? What if the addition doesn't match the filter? It is a bag of hurt. The answer is to use projections: public IList<MemberLinkWithFiltereredMessages> GetMasterLinks(int p_MemberID) { return Get() .Include(memberLink => memberLink.MasterMember) .Include(memberLink => memberLink.SlaveMember) .Where(memberLink => memberLink.MasterMember.RecordID == p_MemberID) .Select(memberLink =&

Categories : Entity Framework

Zend Framework php.ini include path
I don't know which docs you got the code snippet from, but you are mixing up ZF1 and ZF2. The part with Zend_Locale and Zend_Registry are ZF1 components, so this is clearly not going to work with the ZF2 library installed.

Categories : PHP

Error include in Yiiibase.php - Yii Framework
Post::model() Post model should be in path protected/models/Post.php or your model Post use namespace, than you should will set alias of Yii::setPathOfAlias($alias,$path)

Categories : PHP

Entity framework linq include
var res = from a in _db.Articles.Include("Authors") .Include("Authors.Institution") .Include("Authors.Institution.Type") from auth in a.Authors where papers.Contains(a.JoomlaId) select auth.Institution;

Categories : C#

entity framework 5 take and order by in include
You cant use OrderBy inside an include. what about the following using (var db = new MyContext()) { return db.EntryCollections .Where(ec => ec.Foo == "bar") .Select(ec=> new Something{Entries = ec.Entries.OrderByDescending(e => e.Added).Take(5) }, /*some other properties*/) .SingleOrDefault(); } or do it in two seperate queries

Categories : Entity Framework

Entity Framework include property
This might qualify as more of a comment, but too much to fit there... Put all your custom stuff aside and try querying EF directly as it was intended. This will at least rule out any issues with your own code vs. how the entities are set up (right now its hard to tell since we can't see where the problem might be with this limited code sample). A better way (IMO) to use Include's is to use the strongly typed version: query.Include(u => u.Client). Makes your code less prone to runtime errors. Show the query that is failing to bring back a related property, and post all the relevant entities/properties. Are you including a Foreign Key Id property that matches EF conventions? Is this using EF Code First or EDMX model? EDIT - This link may help you set up the relationship. I'm also noti

Categories : C#

Google Maps v2 : how import google-play-service.jar into Android Dependencies
Have you declared the Activity in your manifest? Edit: Once you import library into your workspace (In Eclipse), you right click on the project, open properties, click android and at the bottom you will see library import section. Add it to that.

Categories : Android

Play Framework 2.1.1: Run/debug configurations
Start play in debug mode in a separate command line console: $ play eclipse $ play debug run which should print... Listening for transport dt_socket at address: 9999 ... and start the app. Now you can attach a debugger in Eclipse (remote debug attached to port 9999). More details here Debug Playframework in Eclipse

Categories : Java

Play Framework 2.1.1 Deployment Issues
Ok, so I didn't really find a solution for this, but I found a workaround. This isn't anywhere in the Play Framework 2.x documentation (yet), so I figure I'll put it here in case someone else gets stuck: Putting applyEvolutions.default=true into application.conf DOES work, and will make database evolutions apply automatically. The command line argument -DapplyEvolutions.default=true DOES NOT work and is ignored for reasons unknown. Putting http.port=80 into application.conf DOES NOT work. The command line argument -Dhttp.port=80 also DOES NOT work for setting the port number to run on. So, to set the port number use this command instead: play "start 80" or play "run 80" (use double quotes exactly as shown). For some reason when the port command is written exactly as above in doub

Categories : Java

Play framework can't find javac
Make sure that the javac is in the OS's search path For example, on Windows, goto Control Panel -> System, click Advanced System Settings, click on Environment Variables. In the System variables, locate the variable named path and insert C:Program FilesJavajdk1.7.0_25in at the start of the value. Don't forget to add ; between the values ;) Click Okay, Okay. Close any command prompt windows you have open and re-open them. This will ensure that they are updated with the new environment variables.

Categories : Java

Play framework input without label
I guess you would need to write your own field constructor, eg: @(elements: helper.FieldElements) <div class="@if(elements.hasErrors) {error}"> <div class="input"> @elements.input <span class="errors">@elements.errors.mkString(", ")</span> <span class="help">@elements.infos.mkString(", ")</span> </div> </div> More info here: http://www.playframework.com/documentation/2.0/JavaFormHelpers

Categories : Java

Play Framework joins and the model
Option 1 is the right way to go. You can use a query such as A.find().where().eq("b.id", yourBId).findList(); Possibly adding a fetch("b"), if it isn't fetched automatically.

Categories : Java

Autofilling a form using the Play Framework
The documentation says something about it http://www.playframework.com/documentation/2.2.x/ScalaForms - scroll down to "Fill values" val userForm = userForm.fill(User("Bob", 18))

Categories : Forms



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.