Friday, 15 May 2015

Is it possible to restrict a gradle repository to a particular configuration? -



Is it possible to restrict a gradle repository to a particular configuration? -

i want tie gradle repositories specific configurations in build.gradle file, e.g.:

repositories { testcompile { mavencentral() } compile { maven { url 'https://vetted-repo.example.com' } } }

i can't find simple way gradle documentation. need write own plugin?

this not supported gradle @ moment. when resolving dependencies, gradle tries al listed repositories (from top bottom) resolve dependency. 1 time dependency found stops looking in other repositories

gradle repository

Ruby: changing the appearances strings without changing their original values -



Ruby: changing the appearances strings without changing their original values -

i'm trying create spider solitaire ruby. want show first element in array on screen. example...

a = ["ah", "1h", "2h", "3h", "4h", "5h"]

this array represents pile of cards ace 5 in suits of heart. programme print on screen...

a = ["ah", "card", "card", "card", "card", "card"]

but still want a[1] homecoming "1h", not "card". there way alter appearances of strings without changing original values?.

puts a.map.with_index{|e, i| i.zero? ? e : "card"}

ruby

C Read a column of a line from file -



C Read a column of a line from file -

i reading /proc/diskstats (you may or may not know it) file none less, outputs many lines , columns/fields. i'm asking if can show me how retrieve column of line. little piece of data. thanks.

i've taken look. output looks this:

8 17 sdb1 15 0 38 28 0 0 0 0 0 28 28

so have few numbers (seem long integers) , have string @ 3rd place.

now overall can read output line line. fgets standard c choice. can utilize sscanf pick out different elements. without having tested. like

sscanf(readline, "%d%s%d....", &var1, & var2 ....

should "trick" of not work combination of might seek read line strtok.

hope gives idea.

c file fgets fread fscanf

How do you load or even autowire a .json file from the classpath using annotations in java? -



How do you load or even autowire a .json file from the classpath using annotations in java? -

how load or autowire .json file classpath using spring annotations in java?

//something in controller in sts: @value("file:/resources/json/myjsonfile.json") resource jsontemplatefile;

create , abstract class public abstract class resourceloadingtest { @rule public testname testname = new testname(); protected string loadresource(string filename) throws ioexception { final url resource = getclass().getresource(filename); if (resource == null) { throw new illegalargumentexception("no resource file named <" + filename + "> loaded classpath."); } homecoming resources.tostring(resource, charsets.utf_8); } /** * loads json resource name derived running * test. derived reosurce name "[test-method-name].json". * example, if method called test method named * <code>testsomebehavior</code>, resource name loaded * <code>testsomebehavior.json</code> */ protected string loadcurrenttestjson() throws ioexception { homecoming loadresource(testname.getmethodname() + ".json"); } /** * loads xml resource name derived running * test. derived reosurce name "[test-method-name].xml". * example, if method called test method named * <code>testsomebehavior</code>, resource name loaded * <code>testsomebehavior.xml</code> */ protected string loadcurrenttestxml() throws ioexception { homecoming loadresource(testname.getmethodname() + ".xml"); } } --------------------------------------------------------------------- , in sub class public static void main(string[] args){ loadsetupmessage("myjsonfile.json"); } protected void loadsetupmessage(string filename) throws ioexception{ string rawmessage = this.loadresource(filename); system.out.println(string.format("loaded class %s", rawmessage); }

and place myjsonfile.json in same bundle hierarchy.

java json spring resources classpath

java - akka-spring: How to wire actors -



java - akka-spring: How to wire actors -

i next akka-java-spring still don't know how inject actor within another. example:

public class reader extends untypedconsumeractor { private actorref handler; public reader(actorref handler) { this.handler = handler; } // ... } // create handler first final actorref handler = getcontext() .actorof(springextprovider.get(system).props("handler"), "handler"); // how pass handler above reader ??? final actorref reader = ???

if want using spring actorref have spring bean. it's possible imo not elegant there isn't simple way maintain supervision hierarchy expose actorref's singleton beans. played around @ first ended lot of top-level actors created undesirable. i've found appropriate way me combine spring injection , actorref injection other actors via message passing described in akka docs.

my spring service beans injected via spring, , actorref's injected via message passing required. actorref quite ambiguous represents wrap actoref in class provides type receiving actor can decide it, of import if epxetcing many different actorref's injected.

anyway, answering question, create spring managed actorref bean next in spring @configuration class:

@autowired private actorsystem actorsystem; @bean(name = "handler") public actorref handler() { homecoming actorsystem.actorof(springextprovider.get(system).props("handler"), "handler"); }

and in spring annotated actor have like:

@named("reader") @scope("prototype") public class reader extends untypedconsumeractor { @autowired @qualifier("handler") private actorref handler; // ... }

the dependency injection of "handler" actorref happen when create reader actor using spring extension. it's of import remember actorref proxy actor.

java spring akka

Sybase ASE to Oracle Database replication -



Sybase ASE to Oracle Database replication -

hope doing great,

i'm new sybase tried , succeeded in ase ase replication, wish create setup ase oracle replication, please guide me on this, ( can find video's or text related oracle ase replication ase oracle bit different that, please guide me on )

i have connected both source , target db rep server, created subscription , definition connections, while checking status of subscriptions have created looks "subscription valid primary" "subscription defined @ replicate"

so guess problem must @ target database subscription have created showing defined not valid, may problem ?

thank in advance..

oracle sybase database-replication sybase-ase

groovy - In Play Framework 1.2.x, how to use a render arg value in a path expression? -



groovy - In Play Framework 1.2.x, how to use a render arg value in a path expression? -

let's have renderarg named xyz. in groovy template, what's syntax using value of renderarg in path expression?

for example:

href="@@{'/public/stylesheets/whatever/${xyz}.css'}"

the above fails template compilation error (which expected, really). how can utilize value of render arg within path string?

i'll need utilize arg in other path expressions (not css file reference).

you cannot directly, there 1 workaround:

first should have defined route root of application, instance:

get / application.index

next can utilize in way:

href="@@{application.index}public/stylesheets/whatever/${xyz}.css"

if repeat construction above often, can utilize custom tag, so:

add file /app/views/tags/customlink.html(customlink name of tag, can utilize one),

fill content:

@@{application.index}public/stylesheet/whatever/${_key}.css

you can utilize in way:

href="#{customlink key:'xyz' /}"

more custom tags can read here

groovy playframework-1.x