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

html - How to change background on hover for 2 elements using css -



html - How to change background on hover for 2 elements using css -

i'm having time trying solve this. want alter background of 2 kid elements if user hovers on parent element.

here image looks using code have. should on hover brownish image, no blue.

the html:

<div id="nav-about" class="nav-btn"> <h2>about us</h2> <div class="nav-btn-lt"></div> <div class="nav-btn-rt"></div> </div>

the nav-btn class uses repeating x background, nav-btn-lt class shadow unfortunately couldn't reproduce using css, , nav-btn-rt class image cannot show on hover.

here css:

.nav-btn { position:relative; width:22%; display:inline-block; height:110px; cursor:pointer; margin:11px 2% 0 0; border-top:2px solid #efffff; border-bottom:2px solid #1f3152; background:url(bg-btn-off.gif) repeat-x; } .nav-btn:hover { background:url(bg-btn-on.gif) repeat-x; } .nav-btn h2 { position:absolute; top:10px; left:10px; font-size:150%; font-weight:600; color:#eee; } .nav-btn-lt { position:absolute; top:-2px; left:0; width:2px; height:114px; background:url(lt-nav.png) no-repeat 0 0; } .nav-btn-rt { position:absolute; top:-2px; right:0; width:54px; height:114px; background:url(rt-nav-off.png) no-repeat 0 0; }

is possible alter images on both kid elements upon hovering on parent element?

you target parent's hover state , add together kid elements want attributes modified.

.nav-btn:hover .nav-btn-lt, .nav-btn:hover .nav-btn-rt { background: blue; }

jsfiddle: http://jsfiddle.net/0zqm0bd7/1/

html css css3

embedded linux - Configure CRANEBOARD U-boot to load kernel images into SDcard via NETWORK -



embedded linux - Configure CRANEBOARD U-boot to load kernel images into SDcard via NETWORK -

i've 1 craneboard.it has sdcard has u-boot v2013.04.i want load kernel images via network(using ethernet interface) sd card. steps should take this. please help.

problem solved.actually there problem related enabling macro. include macro related net , config_mach_davinci_da850_evm in am3517.h file.

linux-kernel embedded-linux u-boot

opencv - Finding the size in bytes of cv::Mat -



opencv - Finding the size in bytes of cv::Mat -

i'm using opencv cv::mat objects, , need know number of bytes matrix occupies in order pass low-level c api. seems opencv's api doesn't have method returns number of bytes matrix uses, , have raw uchar *data public fellow member no fellow member contains actual size.

how can 1 find cv::mat size in bytes?

the mutual reply calculate total number of elements in matrix , multiply size of each element, this:

// given cv::mat named mat. size_t sizeinbytes = mat.total() * mat.elemsize();

this work in conventional scenarios, matrix allocated contiguous chunk in memory.

but consider case scheme has alignment constraint on number of bytes per row in matrix. in case, if mat.cols * mat.elemsize() not aligned, mat.iscontinuous() false, , previous size calculation wrong, since mat.elemsize() have same number of elements, although buffer larger!

the right answer, then, find size of each matrix row in bytes, , multiply number of rows:

size_t sizeinbytes = mat.step[0] * mat.rows;

read more step here.

opencv

Reading Pixel values outside Processing frame -



Reading Pixel values outside Processing frame -

short question: there way read rgb values of pixels on screen, outside processings sketch display window?

you can use's java's robot class has createscreencapture() method. homecoming image in java's mutual image format: java.awt.bufferedimage.

luckily processing's pimage has constructor java.awt.image (including subclasses such bufferedimage), putting 2 straight forward:

import java.awt.*; import java.awt.image.bufferedimage; pimage shot; void setup(){ rectmode(center); seek { robot robot = new robot(); bufferedimage screenshot = robot.createscreencapture(new rectangle(toolkit.getdefaulttoolkit().getscreensize())); shot = new pimage(screenshot); }catch (awtexception e){ throw new runtimeexception("unable initialize", e); } } void draw(){ image(shot,0,0); fill(shot.get(mousex,mousey)); rect(mousex,mousey,15,15); }

processing

symfony2 - Symfony can't detect the roles from FOSUser -



symfony2 - Symfony can't detect the roles from FOSUser -

i setting user management website fosuser first time , i'm having problem figuring out mess up.

the role in database, in roles column, this:

a:1:{i:0;s:10:"role_admin";}

when var_dump($this->getuser()) controller, this:

(...) ["roles":protected]=> array(1) { [0]=> string(10) "role_admin" } (...)

so everything's fine on here too.

when seek either if ($this->get('security.context')->isgranted('role_admin')) controller or {% if is_granted('role_admin') %} twig template, symfony doesn't observe role. profiler tells me there role_user role.

here app/config/security.yml file:

security: providers: main: id: fos_user.user_provider.username encoders: site\userbundle\entity\user: sha512 role_hierarchy: role_moderator: [role_user] role_admin: [role_moderator] firewalls: main: pattern: ^/ anonymous: true form_login: login_path: fos_user_security_login check_path: fos_user_security_check logout: path: fos_user_security_logout target: / remember_me: key: %secret% default: anonymous: ~

it looks didn't clear cache. seek clear cache environment

php app/console cache:clear --env=prod #for prod env

or

php app/console cache:clear #for dev env

symfony2 fosuserbundle roles

java - As soon as VisaulVm.exe launches Intellij becomes unresponsive -



java - As soon as VisaulVm.exe launches Intellij becomes unresponsive -

i using intellij , moment open visiualvm.exe intellij becomes unresponsive. can utilize visualvm correctly , after close intellij hangs. have kill taskmanager.

i tried google’ing cannot seem find post related , don’t have thought start debugging this. ideas?

i using

jdk 1.7.0_51 (64bit) windows 7 64bit intellij 12 visiualvm 1.3.5

java intellij-idea visualvm intellij-12

JQuery Looping a slice(), split(), and wrapped array...for each element of class -



JQuery Looping a slice(), split(), and wrapped array...for each element of class -

i'm pretty sure i'm close 1 can't seem right. im getting next strings dynamically each event listed, in same format. need split() off date each of these entries , homecoming times, split() @ ',' , rendered in spans i've got:

<div class="date">di 22.10.2014 um 14:00, 18:00</div> <div class="date">di 22.10.2014 um 14:00, 18:00, 20:00 </div>

and

var info =$('.date').html().slice(17); var arr = data.split(','); $(".date").empty(); $.each(arr, function(i, v) { $('.date').append($("<span>").html(v)); });

.... far good... http://jsfiddle.net/mealabmay/k3d6d/1088/ working, i've realised each '.date' ending same content. can't seem script converted each ... looked @ splitting text , wrapping each of words in elements in jquery , tried utilize same method....but sigh maintain drawing blank...any helpers out there? thx

use setter version of .text() takes callback function

class="snippet-code-js lang-js prettyprint-override">$('.date').each(function(i, text) { var $this = $(this), info = $this.text().slice(17); var arr = data.split(','); $this.empty(); $.each(arr, function(i, v) { $this.append($("<span>").html(v)); }); }) class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="date">di 22.10.2014 um 14:00, 18:00</div> <div class="date">di 22.10.2014 um 14:00, 18:00, 20:00</div>

probably way same

class="snippet-code-js lang-js prettyprint-override">$('.date').html(function(i, html) { homecoming $.map(html.trim().substring(17).split(','), function(item) { homecoming '<span>' + item + '</span>' }).join('') }) class="snippet-code-css lang-css prettyprint-override">.date span { border: 1px solid lightgrey; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="date">di 22.10.2014 um 14:00, 18:00</div> <div class="date">di 22.10.2014 um 14:00, 18:00, 20:00</div>

jquery split each slice

javascript - Printing in input -



javascript - Printing in input -

i have problem calculate when user enters date of birthday see how much left next , result written in input. here code:

<script type="text/javascript"> function calcform(){ (document.form1) { var today = new date(); var fullyear = today.getfullyear(); var future = new date(+number1.value+ fullyear); var diff = future.gettime() - today.gettime(); var days = math.floor(diff / (1000 * 60 * 60 * 24 )); } } </script> <form name="form1" action=""> type date birth: <input type="text" id="number1" value="" size="30" /><br/> <p> number of days until birthday: <input type="text" id="result" value="" size="13" /><br/> <p> <input type="button" id="calculate" value="calculate" onclick="calcform()" /> <input type="reset" value="clear"/> </form>

fixed it, need increment date until next birthday greater current date, measure days.

function calcform(){ var today = new date(); var fullyear = today.getfullyear(); var future = new date(document.getelementbyid('number1').value); future.setfullyear(fullyear); if(future.gettime()<today.gettime()) future.setfullyear(fullyear+1); var diff = future.gettime() - today.gettime(); var days = math.floor(diff / (1000 * 60 * 60 * 24 )); document.getelementbyid('result').value=days; }

javascript html forms

Meteor crash when runing or deploy -



Meteor crash when runing or deploy -

when run meteor command

im getting crash have done changes, in accounts-ui packange , accounts-ui-unstyled, tryed prepare fail.shoud reinstall meteor?

here erorr:

/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173 throw(ex); ^ error: couldn't read entire resource @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/isopack.js:693:19 @ array.foreach (native) @ function._.each._.foreach (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/isopack.js:677:9 @ array.foreach (native) @ function._.each._.foreach (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11) @ _.extend._loadunibuildsfrompath (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/isopack.js:648:7) @ _.extend.initfrompath (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/isopack.js:512:17) @ _.extend.loadpackageatpath (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/package-cache.js:138:12) @ _.extend.getpackage (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/package-loader.js:66:38) @ object.compiler.eachusedunibuild (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:85:37) @ compileunibuild (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:337:14) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:1060:27 @ array.foreach (native) @ function._.each._.foreach (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11) @ object.compiler.compile (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/compiler.js:1059:5) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/bundler.js:1973:26 @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:254:13 @ _.extend.withvalue (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:112:14) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:247:29 @ _.extend.withvalue (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:112:14) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:245:18 @ _.extend.withvalue (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:112:14) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:236:23 @ _.extend.withvalue (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:112:14) @ object.capture (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:235:19) @ object.exports.bundle (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/bundler.js:1895:31) @ object.bundleanddeploy (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/deploy.js:403:32) @ main.registercommand.name [as func] (/home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/commands.js:1038:27) @ /home/kristian/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/main.js:1255:23

pleas tell me problem.. thanks

meteor crash

android - Mobile + Rails, Firebase vs Couchbase -



android - Mobile + Rails, Firebase vs Couchbase -

i involved in project need utilize nosql database store info used , modified on both ruby on rails , native android application. need kind of user authentication users have different permissions modify different kinds of data. automated syncing app server must, available 1 time every couple of weeks. app used offline. looking @ either firebase or couchbase open others. question pros , cons of using firebase , couchbase? recommend situation?

this jessica pm team @ couchbase. i'm biased, of course, in sentiment couchbase offers lot of granular access control, variety of syncing options including automatic sync opportunistic sync scenarios, , made specific thought offline-ready. embedded database part of couchbase's solution on-device storage can standalone or can replicate remote backend, , have thought out various conflict management requirements needed ensure info consistent across both local , remote systems. couchbase fulfills every 1 of requirements have far posted, happy discuss more if like. sense free reach out me @ jessica [at] couchbase [dot] com.

android ruby-on-rails nosql firebase couchbase

Cmake can't found Boost -



Cmake can't found Boost -

i seek build project cmake. evrything boost work. boost message.

boost version: 1.56.0 boost include path: c:/boost/include/boost-1_56 not find next boost libraries: boost_program_options no boost libraries found. may need set boost_librarydir directory containing boost libraries or boost_root location of boost. phone call stack (most recent phone call first): cmakelists.txt:27 (find_package)

can tell me did wrong? fixed environment variable boost follows : c:\boost.

boost cmake

javascript - Direct Message to online users in MeteorJS -



javascript - Direct Message to online users in MeteorJS -

in chat application, want able send messages 2 users straight if there online. i'm using mizzao:user-status observe if online or not. let's imagine 2 users tom , sam. both online , using application. when tom sends mesaage sam , vice-versa, want send message straight sam without first storing in mongodb through web sockets. meteor streams seemed viable option, here's problem. let's 1000 people using app @ once. people can send friends messages. how ensure security sam can't edit source files , read everyone's messages going through wire.

thanks.

when doing chat app didn't utilize streams, since meteor reactive stored messages in collection, , find() returning data, no packages needed. if wanted send info users, fetch() users online(with mizzao:user-status aswell), , sent message of them using .foreach

javascript meteor

delphi - FMX shape components does not correctly displayed on the Android platform -



delphi - FMX shape components does not correctly displayed on the Android platform -

as can see, shape components normal display on windows platform, smooth (including lines, corners , gradient effect).

but on android platform, unacceptable results: lines no longer smooth, corners cannot been closed, gradients become black.

how happen? , how prepare it?

here .fmx file content:

object form1: tform1 left = 0 top = 0 caption = 'form1' clientheight = 480 clientwidth = 640 formfactor.width = 320 formfactor.height = 480 formfactor.devices = [desktop] designermasterstyle = 0 object roundrect1: troundrect position.x = 40.000000000000000000 position.y = 16.000000000000000000 size.width = 153.000000000000000000 size.height = 65.000000000000000000 size.platformdefault = false stroke.color = clamediumslateblue stroke.thickness = 8.000000000000000000 end object pie1: tpie position.x = 32.000000000000000000 position.y = 96.000000000000000000 size.width = 153.000000000000000000 size.height = 129.000000000000000000 size.platformdefault = false stroke.color = clachocolate stroke.thickness = 8.000000000000000000 endangle = -90.000000000000000000 end object arc1: tarc position.x = 48.000000000000000000 position.y = 224.000000000000000000 size.width = 169.000000000000000000 size.height = 161.000000000000000000 size.platformdefault = false stroke.color = cladeeppink stroke.thickness = 10.000000000000000000 startangle = 30.000000000000000000 endangle = 180.000000000000000000 end object arc2: tarc position.x = 16.000000000000000000 position.y = 184.000000000000000000 size.width = 233.000000000000000000 size.height = 233.000000000000000000 size.platformdefault = false stroke.kind = gradient stroke.gradient.points = < item color = xff297e72 offset = 0.000000000000000000 end item color = xffa6f2bd offset = 1.000000000000000000 end> stroke.gradient.startposition.x = 0.500000000000000000 stroke.gradient.startposition.y = 1.000000000000000000 stroke.gradient.stopposition.x = 0.499999970197677600 stroke.gradient.stopposition.y = 0.000000000000000000 stroke.thickness = 20.000000000000000000 stroke.cap = round endangle = -90.000000000000000000 end end

i believe in docs says gradients on strokes (lines) not work on windows 2d rendering. wasn't able find says however. if want windows version utilize 3d can do:

initialization fmx.types.globalusegpucanvas := true;

you can turn on multisampling overriding rendering parameters. lastly can utilize native android component native drawing if need it.

android delphi graphics firemonkey

c++ - why vector does not updates in loop? -



c++ - why vector does not updates in loop? -

i want update vector 'v' can iterate count 0-100.

i know not allowed, if want only? there way?

int main() { // code goes here vector<int> v; v.push_back(1); int count = 0; for(int elem: v){ if(count<100) v.push_back(count); count++; } for(int elem: v) cout << elem << endl; homecoming 0; }

the output is:

1 0

as can see definition of range-based loop, end_expr not update between iterations. hence have 1 iteration. push_back invalidates v.end() (which end_expr described in linked page), have undefined behaviour.

the arguably simplest way fill vector 0..100 be:

vector<int> v(101); std::iota(v.begin(), v.end(), 0);

c++ c++11 vector

javascript - jQuery: pushing values in .serializeArray(); -



javascript - jQuery: pushing values in .serializeArray(); -

i'm working on ajax form submition in jquery.

i used .serializearray() function serializing form, need add together element obtained object, used push() function.

so may that:

{ name: "test", surname: "test", action: "register" }

when serialize form, name , surname field sent, action field not. send informations php echo function but, console.log() result, show name , surname, not action.

i tried .serialize() function to, i'll still not obtain needed.

here fiddle.

$(document).ready(function () { $("#register").on("submit", function (e) { e.preventdefault(); var info = $("#register").serializearray(); data.push({name: "action", value: "register"}); console.log(data); jquery.post("/echo/json/", data, function () { alert("success"); }, "json"); }); });

the problem sending 2 requests, disable form submit:

$( '#register' ).on( 'submit', function() { homecoming false; });

or can place submit button outside form.

javascript jquery ajax

javascript - How to Select first index of first combobox and disable other comboboxes and reset the values of other combobox with jQuery? -



javascript - How to Select first index of first combobox and disable other comboboxes and reset the values of other combobox with jQuery? -

i have 3 combobxes. comboboxes have values : "select","one","two""three"

here screnario :

if "select" selected first combobox, should disable comboboxes , reset values first index.

jquery $("select").change(function(e){ if($("#box_g1 option:selected").prop("selectedindex",0)){ $("#box_g2").attr("disabled", true); $("#box_g3").attr("disabled", true); // , on $("#box_g5").attr("disabled", true); } }); html <select name="n1" id="box_g1"> <option value="select">select</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="n2" id="box_g2"> <option value="disabled">disabled</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="n3" id="box_g3"> <option value="disabled">disabled</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select>

here box_g1 first combobox. , disabling other comboboxes 2 5.

try this:

$("select").change(function(e){ if($("#box_g1").val() == "select"){ $("#box_g2").attr("disabled", "disabled"); $("#box_g3").attr("disabled", "disabled"); // , on $("#box_g5").attr("disabled", "disabled"); } });

demo fiddle

javascript jquery combobox

sql server - T-SQL Union, but exclude results from one table based on another without using a temp table? -



sql server - T-SQL Union, but exclude results from one table based on another without using a temp table? -

i looking union 2 select statements, have sec select excludes results if first select contains records without using temp table

i trying accomplish this:

select customernumber, name #tempcustomer1 customers1 select customernumber, name #tempcustomer1 union select customernumber, name customers2 customernumber not in (select customernumber #tempcustomer1) order customernumber

is possible without temp table?

your query union should doing want cause union discards duplicate rows result set. so, can say

select customernumber, name customers1 union select customernumber, name customers2

per comment, can utilize inline query accomplish same without using temporary table like

select * ( select customernumber, name customers1 union select customernumber, name customers2 ) tab customernumber not in (select customernumber customers1) order customernumber

sql sql-server tsql union

mysql - how to call `getattr()` to get a Python MySQLCursor method? -



mysql - how to call `getattr()` to get a Python MySQLCursor method? -

what need do before, create python phone call succeed:

>>>getattr(mysqlcursor, "fetchall")

if create phone call @ origin of script, fails. have cursor , need programmatically obtain 1 of it's methods, such fetchall() string, such "fetchall" don't understand how setup phone call succeeds.

getattr(mysqlcursor, "fetchall") work:

>>> mysql.connector.cursor import mysqlcursor >>> getattr(mysqlcursor, 'fetchall') <unbound method mysqlcursor.fetchall>

so there is, unbound method within class mysqlcursor.

if have instance of cursor, can bound method, can call:

>>> mysql.connector.cursor import mysqlcursor >>> cursor = mysqlcursor() >>> cursor <mysql.connector.cursor.mysqlcursor object @ 0x7f9368a86350> >>> getattr(cursor, 'fetchall') <bound method mysqlcursor.fetchall of <mysql.connector.cursor.mysqlcursor object @ 0x7f9368a86350>> >>> getattr(cursor, 'fetchall')()

python mysql

Simple JavaScript Slider - Need some OOP help to make it work -



Simple JavaScript Slider - Need some OOP help to make it work -

im in process of creating own slider library pure javascript. have here:

http://jsfiddle.net/bingo14/bhymxrqr/1/

im trying homecoming latest 'currentvalue' getvalue() function, returning 0 can see initial alert.

this.getvalue = function getvalue() { //how homecoming latest current value? homecoming currentvalue; };

how can create updated every time user moves slider? think need help oop principles here!

thanks.

"it update, added setinterval(function() {console.log(myslider.getvalue()) }, 1000); , every sec current value returned"

i wasnt testing properly! alex k. got right

javascript oop slider

javascript - Check if div has a specific style applied -



javascript - Check if div has a specific style applied -

on website if page first loaded , it's maximized/fullscreen, div combrand has particular css properties want applied.

during resize event apply different properties element using .css() function div doesn't overlap other screen items, however, instead of changing css appears add together style attribute div in code. depending on how resize page, resize function might have ended in such way when utilize maximize button, end wrong placement of particular div. checking few things create sure doesn't happen.

however, don't know if syntax here right checking style attribute of div during resize function because doesn't seem work expected.

$(window).resize(function() { //first check if ( $('#combrand').css('top') == '155px') { //second check see if peculiuar event reached div positioned incorrectly window isn't maximized if ( ($('#combrand').attr('style') == 'top: 155px;margin-left: -615px;left: 50%;') && (window.screen.width > window.screen.availwidth)) { $('#combrand').css({'top': '155px', 'margin-left': '-615px', 'left': '50%'}); } else //assume page maximized , adjust div accordingly { $('#combrand').css({'top': '141px', 'margin-left': '0', 'left': '0'}); } } else //default else, if css of div other checked for, set default location { $('#combrand').css({'top': '155px', 'margin-left': '-615px', 'left': '50%'}); } });

i know it's little confusing , of hack i'd still function.

i added 2 classes, , gave div combrand class of maximized hard coded in html, , used code in resize function, however, doesn't work or anything...

$(window).resize(function() { if ($('#combrand').hasclass('maximized')) { $('#combrand').removeclass('maximized'); $('#combrand').addclass('minimized'); } else { $('#combrand').removeclass('minimized'); $('#combrand').addclass('maximized'); } });

as apul gupta pointed out, should adding , removing classes. so, set couple classes:

css:

.firstclass { top: 155px; margin-left -615px; left:50%; } .secondclass { top:141px; margin-left:0; left:0; }

next, alter logic this:

if (!$('#combrand').hasclass('firstclass') && (window.screen.width > window.screen.availwidth)){ $('#combrand').removeclass("firstclass"); $("#combrand").addclass("secondclass"); } } else { $("#combrand").removeclass("secondclass"); $("combrand").addclass("firstclass"); }

your first nested if statement doesn't anything...you checking see if css x - , if so, setting css x. so, removed code.

i must admit if/else logic unoptimized(a bit redundant) , confusing, should give thought of need do.

javascript jquery html css

javascript - Upload a base64 encoded image using FormData? -



javascript - Upload a base64 encoded image using FormData? -

i have jpeg base64 encoded string.

var image = "/9j/4aaqskzjrgabaqeas..."

i upload jpeg server using formdata.

var info = new formdata();

what proper way append image data?

your image info nil more string, append formdata object this:

data.append("image_data", image);

then on server side can store straight in database or convert image , store on file system. might find this post helpful.

javascript form-data

javascript - How to beautify xml received as string? -



javascript - How to beautify xml received as string? -

this question has reply here:

pretty printing xml javascript 14 answers

i have web service returns xml plain string. need format xml beautifier does. expect performed on client side javascript. how can that? libraries improve fitted task?

one way of doing utilize "javascript code prettifier" google.

you can find here: http://google-code-prettify.googlecode.com/svn/trunk/readme.html.

follow setup guide in link , include javascript file , utilize so:

prettyprintone(xml_to_beautified, 'xml')

javascript xml

java - Three arff files majority voting -



java - Three arff files majority voting -

i have 3 different arff files contain different classification info same instances, each line of each arff file concerns same instance, contains different info on instance. build new classifier have bulk vote on 3 classifiers applied on each arff info file cross validation

any clue or hint highly appreciated...

this basic proposition, based utilize java train , evaluate ensemble:

prepare each of 3 datasets according attribute requirements, or if possible, utilize same dataset 3 models using attribute filter each classifier (never tried this) train each of 3 classifiers using required training/attribute data code bulk vote rules @ end of evaluation process evaluate model on testing set.

there may other ways (such using vote combiner attributeselectedclassifier), doing code may give more command , flexibility trying combine.

java api machine-learning weka

How to give amazon s3 bucket files permission to only viewable? -



How to give amazon s3 bucket files permission to only viewable? -

i streaming videos amazon s3 bucket using jwplayer website has public access can view videos problem tha can download videos using link how give acl permission view while uploading videos?

amazon bucket

C# / Objective-C Extendable Application (Application that can be modified through extensions) -



C# / Objective-C Extendable Application (Application that can be modified through extensions) -

i'm looking extending c# application (and objective-c counterpart) allow user created extensions loaded , utilized.

the thought loaded extensions either 'decorate' output, or replace driving mechanism entirely. example, application working on outputs colors based off logic defined in each operating mode. decorator extension converting grayscale, or upping saturation, built-in mode generate color , extension modifies result. while driver extension deed own mode outputting colors on own.

what design paradigms work sort of problem?

the "managed extensibility framework" help lot c# version of app:

http://msdn.microsoft.com/en-us/library/dd460648(v=vs.110).aspx

this library microsoft created situations 1 you're in.

but know next-to-nothing objective-c, can't offer help that.

c# objective-c extending

c# - ambiguous reference for foreign key data anotations -



c# - ambiguous reference for foreign key data anotations -

i have class following

public class privilege { [foreignkey("user")] // error line public int? userid { get; set; } .... }

everything fine until alter target framework of project. .net 4.0 , changed 4.5

now there error foreignkey("user") part.

the type 'system.componentmodel.dataannotations.schema.databasegeneratedattribute' exists in both 'c:....\packages\entityframework.6.1.1\lib\net40\entityframework.dll' , 'c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\system.componentmodel.dataannotations.dll'

how should solve issue?

by way can understand m using entity framework in project , version 6.1.1

c# asp.net entity-framework-6 ambiguous

java - passing object with bundle returns null property -



java - passing object with bundle returns null property -

i've made list of info i'm trying pass on activity.

public class mydata extends parseobject implements serializable { string name = "tony"; public string getname() { homecoming getstring("name"); } }

mymainactivity:

list<mydata> data; mydata temp;

so here's did:

temp = data.get(1); intent = new intent(mainactivity.this, anotheractivity.class); i.putextra("datatag", temp); startactivity(i);

and on other activity...

mydata newfile; newfile = (mydata) getintent().getserializableextra("datatag");

when log newfile, returns info parseobject. when seek attribute, such name, etc. returns null. wonder i'm doing wrong.

java android

Recursion in Java factorial program -



Recursion in Java factorial program -

what know recursion is function calls itself , has base of operations status stops. professor wrote programme , called recursion occurring in , said no, it's not. confused it. asking clear confusion. programme made him below in code:

int fact(int n) { if (n == 0) { homecoming 1; } (int = n; >= 1; i--) { s1.push(i); } homecoming return_result(); } int return_result() { int f = 1; while (s1.top != -1) { f = f * s1.pop(); } homecoming f; }

first want explain facts:

factorial computed next formula : n! = n * n-1 * n-2 * n-3 * .....* 3 * 2 * 1 stack works in lifo = lastly in first out or filo = first in lastly out

so code next first puts numbers n 1 in stack pops each 1 , multiply current result factorial @ end

and way iterative version factorial (non-recursive), recursive version following

int fact(int n) { int result; if(n==1) homecoming 1; result = fact(n-1) * n; homecoming result; }

java recursion

login - Mechanize Module Python Autologin -



login - Mechanize Module Python Autologin -

so creating script using mechanize module logs in , goes page. problem in order visit page client has click button type="button" instead of "submit" hence mechanize of no utilize me. there apart can stuff using python only...

if not in python other language follow?

selenium + phantomjs if want headless browser.

python login mechanize

visual studio 2013 - Giving error while running code for windows emulator WGA 512MB -



visual studio 2013 - Giving error while running code for windows emulator WGA 512MB -

i trying out trivial index.html file in multi-device-hybrid-app in visual studio 2013. run on android emulator. however, running on windows platform ran next error.

cordova library "wp8" exists. no need download. continuing. generating config.xml defaults platform "wp8" calling plugman.prepare platform "wp8" running command: c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8\cordova\run.bat --nobuild --emulator deploying emulator ... error: command failed in deploy.js : "c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8\cordova\lib\cordovadeploy\cordovadeploy\bin\debug\cordovadeploy.exe" "c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8" -d:1 unhandled exception: system.argumentoutofrangeexception: index out of range. must non-negative , less size of collection. parameter name: index @ system.throwhelper.throwargumentoutofrangeexception() @ system.collections.generic.list`1.get_item(int32 index) @ system.collections.objectmodel.collection`1.get_item(int32 index) @ cordovadeploy.deploytool.getdeviceatindex(int32 index) in c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8\cordova\lib\cordovadeploy\cordovadeploy\program.cs:line 124 @ cordovadeploy.deploytool.main(string[] args) in c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8\cordova\lib\cordovadeploy\cordovadeploy\program.cs:line 208 command finished error code 2: c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8\cordova\run.bat --nobuild,--emulator

the interesting thing creates new solution in the

c:\temp\projects\blankcordovaapp1\blankcordovaapp1\bld\debug\platforms\wp8

folder , if open solution, compile , run it, works fine on windows phone 8.1 emulator. ideas doing wrong? have set paths correctly in visual studio 2013 believe!

looking error message seems programme failed find emulators @ wp8. cpt2.0 used cordovadeploy.exe list of available wp8 emulators/devices buggy. seems issue fixed in latest release of visual studio tools apache cordova -- cpt3.0. follow below steps install cpt3.0

uninstall visual studio apache cordova multi-device hybrid app cpt2.0 install visual update 4 here install cpt 3.0 here refer uninstall issue http://support.microsoft.com/kb/3014133

visual-studio-2013 windows-phone-8.1 multi-device-hybrid-apps

Python regex extract MAC addresses from string -



Python regex extract MAC addresses from string -

i need help writing regular expression, using python re engine to:

extract mac addresses text file extract strings next format: foo bar ... mac:address ... baz bat \r\n

thanks in advance!

i tried next extract mac addresses, without luck:

class="lang-python prettyprint-override">import re p = re.compile(ur'((?:(\d{1,2}|[a-fa-f]{1,2}){2})(?::|-*)){6}') test_str = u"text mac addresses 00:24:17:b1:cc:cc text continues more text 20:89:86:9a:86:24" found = re.findall(p, test_str) in found: print

i have concocted following: ([0-9a-fa-f]:?){12} match mac addresses in text.

here how supposed work:

[0-9a-fa-f] matches characters used represent hexadecimal numbers :? matches optional colon (...){12} - of grouped , repeated 12 times. 12 because mac address consists of 6 pairs of hexadecimal numbers, separated colon

you can see in action here .

the python code becomes:

class="lang-python prettyprint-override">import re p = re.compile(ur'(?:[0-9a-fa-f]:?){12}') test_str = u"text mac addresses 00:24:17:b1:cc:cc text continues more text 20:89:86:9a:86:24" re.findall(p, test_str)

producing result:

class="lang-python prettyprint-override">[u'00:24:17:b1:cc:cc', u'20:89:86:9a:86:24']

python regex

android - how to debug a meteor / cordova app using iron-router stuck at loading screen? -



android - how to debug a meteor / cordova app using iron-router stuck at loading screen? -

i have meteor app (brewsontap) works fine when deployed website, when testing on android device through cordova gets stuck @ loading screen forever.

i don't see relevant console errors or warnings. if go ip i'm serving app displays fine. app using iron-router , waiton display loading template until intial info loaded... apparently isn't happening.

suggestions problem or next steps debug it?

this looks much connectivity problem. first thing seek in console:

router.current().ready()

if doesn't homecoming false there funny going on tracker or iron-router, (reactively) gives master wait-list readiness, if returns true there else preventing page rendering.

the best way find out item(s) in wait-list isn't ready go through router code, pull out subscription handles global object, , pass references waiton callback.

for example, rather than:

waiton: function() { homecoming [meteor.subscribe('somethings'), meteor.subscribe('someotherthings')]; }

do instead:

subs = {}; waiton: function() { subs.somethings = meteor.subscribe('somethings'); subs.someotherthings = meteor.subscribe('someotherthings'); homecoming [subs.somethings, subs.someotherthings]; }

that way, can run subs.somethings.ready() console on each of subscriptions find out is preventing page rendering. hopefully, start.

however, whilst don't understand error messages you've posted, fact it's got "failed load resource" suggests connection issue, prevent subscription info making way client via ddp , prevent subscription returning ready. have in network tab see what's going on (or not doing) there.

apologies isn't solution, it's start. if connectivity, check things in here - i.e. developer tools enabled, usb debugging allowed, android device connected same wifi, ip correct...

update: thinking little more, app installed via usb debugging, fact can run @ indicates there isn't problem there. however, assume info passed on local network, problem is, think must 2 devices not connected same wifi, or else supplied ip incorrect.

android cordova meteor

d3.js - d3 donut chart update with new csv dataset -



d3.js - d3 donut chart update with new csv dataset -

really struggling donut chart updated new info coming several csv files.

how can update chart new csv file? im using setinterval() circulate array of files.

my code:

var updatechart = function(){} var width = 360; var height = 360; var radius = math.min(width, height) / 2; var donutwidth = 75; var legendrectsize = 18; var legendspacing = 4; var color = d3.scale.category20b(); var svg = d3.select('#chart') .append('svg') .attr('width', width) .attr('height', height) .append('g') .attr('transform', 'translate(' + (width / 2) + ',' + (height / 2) + ')'); var arc = d3.svg.arc() .innerradius(radius - donutwidth) .outerradius(radius); var pie = d3.layout.pie() .value(function(d) { homecoming d.population; }) .sort(null); d3.csv('data.csv', function(error, dataset) { dataset.foreach(function(d) { d.population = +d.population; }); / var path = svg.selectall('path') .data(pie(dataset)) .enter() .append('path') .attr('d', arc) .attr('fill', function(d, i) { homecoming color(d.data.age); }); var legend = svg.selectall('.legend') .data(color.domain()) .enter() .append('g') .attr('class', 'legend') .attr('transform', function(d, i) { var height = legendrectsize + legendspacing; var offset = height * color.domain().length / 2; var horz = -2 * legendrectsize; var vert = * height - offset; homecoming 'translate(' + horz + ',' + vert + ')'; }); legend.append('rect') .attr('width', legendrectsize) .attr('height', legendrectsize) .style('fill', color) .style('stroke', color); legend.append('text') .attr('x', legendrectsize + legendspacing) .attr('y', legendrectsize - legendspacing) .text(function(d) { homecoming d; }); });

the csv format:

age,population cumulative,2704659 cumulative prev,4499890

thanks in advanced.

d3.js donut-chart

Using Omnipay for standard PayPal payments -



Using Omnipay for standard PayPal payments -

as know, paypal express , pro methods not available counties.

i'm wondering if there way implement paypal standard available asian countries uae using omnipay.

paypal omnipay

mysql - Syntax error when creating stored function -



mysql - Syntax error when creating stored function -

i'm trying write first stored function in mysql 5.5.38, cannot past annoying syntax error. checked mysql docs, still can't see problem , error message says you have error in sql syntax; blah blah blah ... @ line 1.

here's code:

delimiter $$ create function distm (lat1 double, lng1 double, lat2 double, lng2 double) returns double no sql deterministic begin declare radius double; set radius = 6371008.771415059; declare x1, y1, x2, y2, dlat, dlng double; set x1 = radians(lng1); set y1 = radians(lat1); set x2 = radians(lng2); set y2 = radians(lat2); set dlng = x2 - x1; set dlat = y2 - y1; declare dist double; set dist = 2 * radius * asin( sqrt( pow(sin(dlat / 2), 2) + cos(y1) * cos(y2) * pow(sin(dlng / 2), 2) ) ); homecoming dist; end$$ delimiter ;

edit: exact error message following:

sql error [1064] [42000]: have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'delimiter $$ create function distm (lat1 double, lng1 double, lat2 double, lng2' @ line 1

try removing drop statement before delimiter $$ , run again.

also, alter line returns double no sql deterministic below. notice, it's not no sql deterministic rather not deterministic

returns double not deterministic

mysql syntax-error stored-functions

python - pick TxK numpy array from TxN numpy array using TxK column index array -



python - pick TxK numpy array from TxN numpy array using TxK column index array -

this indirect indexing problem.

it can solved list comprehension.

the question whether, or, how solve within numpy,

when data.shape (t,n) , c.shape (t,k)

and each element of c int between 0 , n-1 inclusive, is, each element of c intended refer column number data.

the goal obtain out where

out.shape = (t,k)

and each i in 0..(t-1)

the row out[i] = [ data[i, c[i,0]] , ... , data[i, c[i,k-1]] ]

concrete example:

data = np.array([\ [ 0, 1, 2],\ [ 3, 4, 5],\ [ 6, 7, 8],\ [ 9, 10, 11],\ [12, 13, 14]]) c = np.array([ [0, 2],\ [1, 2],\ [0, 0],\ [1, 1],\ [2, 2]]) out should out = [[0, 2], [4, 5], [6, 6], [10, 10], [14, 14]]

the first row of out [0,2] because columns chosen given c's row 0, 0 , 2, , data[0] @ columns 0 , 2 0 , 2.

the sec row of out [4,5] because columns chosen given c's row 1, 1 , 2, , data[1] @ columns 1 , 2 4 , 5.

numpy fancy indexing doesn't seem solve in obvious way because indexing info c (e.g. data[c], np.take(data,c,axis=1) ) produces 3 dimensional array.

a list comprehension can solve it:

out = [ [data[rowidx,i1],data[rowidx,i2]] (rowidx, (i1,i2)) in enumerate(c) ]

if k 2 suppose marginally ok. if k variable, not good.

the list comprehension has rewritten each value k, because unrolls columns picked out of data each row of c. violates dry.

is there solution based exclusively in numpy?

you can avoid loops np.choose:

in [1]: %cpaste pasting code; come in '--' lone on line stop or utilize ctrl-d. info = np.array([\ [ 0, 1, 2],\ [ 3, 4, 5],\ [ 6, 7, 8],\ [ 9, 10, 11],\ [12, 13, 14]]) c = np.array([ [0, 2],\ [1, 2],\ [0, 0],\ [1, 1],\ [2, 2]]) -- in [2]: np.choose(c, data.t[:,:,np.newaxis]) out[2]: array([[ 0, 2], [ 4, 5], [ 6, 6], [10, 10], [14, 14]])

python numpy indexing

Intercept specific exception module-wide in Python -



Intercept specific exception module-wide in Python -

i have defined custom exception need maintain track of , trigger process whenever thrown. enclose each line susceptible raise error in try-except pair, code grows, starts more , more ugly , cumbersome.

is there way create module-wide try-except statement?

tl;dr

i doing this:

class myerror(exception): pass try: #error-prone code except myerror: context_aware_function()

and looking this:

class myerror(exception): pass errormanager.redirect(from=myerror,to=context_aware_operation) #error-prone code

you intercept exceptions on per-function basis annotating them decorators. decorator implemented function takes function input , returns modified version of function. in case wrap input function try/except block:

def catch_error(function): def wrapper(*args, **kws): try: homecoming function(*args, **kws) except myerror: #handle error homecoming wrapper @catch_error def foo(): #error-prone code

python exception exception-handling

wpf - Windows Phone 8.1, How to bind style to view? -



wpf - Windows Phone 8.1, How to bind style to view? -

i wrote style button. unfortunately, encountered problem: font size of button depends on value, can compute only in view (specifically, that's displayinformation stuff).

ideally, following:

<style x:key="mystyle" basedon="{staticresource somestyle}" targettype="button"> <setter property="fontsize" value="{binding elementname=rootcontrol, path=someproperty" /> </style>

then, provide necessary properties in view class. doesn't work (does nothing, no messages, no errors).

how can solve problem?

assigning binding setter value not supported in windows runtime. (it might supported in wpf , silverlight 5, however).

if google around, there workarounds, they're kind of hacky. see this, uses attached properties , binding helper class.

wpf binding resources styles windows-phone-8.1

javascript - How to handle large dropdownlist? -



javascript - How to handle large dropdownlist? -

using vb.net/asp.net, have page formview. on insert , edit templates, there multiple dropdownlists depts , people. there multiple sections in these templates , there 3 sections each dept , people dropdown. guess there upwards of 100 depts , close 10000 people. requirement if user not know dept, can take people dropdown provide entire 10,000 listing of people.

needless say, pagesize of page on 5mb....i had increment default

what options in creating dropdown can handle lack of filter , allow me have much more manageable pagesize size? there in ajax or javascript?

thanks.

there lot of tutorials on this. thought have autocomplete control, textbox, when type , lets have typed 'abc', ajax phone call fetch records matching 'abc', results db via ajax, , show in selectable div, there can define events. don't have manage anything, except db phone call required data. autocomplete control job.

help links - http://www.aspsnippets.com/articles/ajax-autocompleteextender-example-in-aspnet.aspx http://www.codeproject.com/articles/201099/autocomplete-with-database-and-ajaxcontroltoolkit

javascript asp.net drop-down-menu formview

java - ParseImageView on Android not displaying image -



java - ParseImageView on Android not displaying image -

i having unusual problem parseimageview. have parseimageview defined in layout:

<com.parse.parseimageview android:id="@+id/view1_imageview" android:layout_width="match_parent" android:layout_height="match_parent" />

and calling method:

imageview = (parseimageview) rootview.findviewbyid(r.id.view1_imageview);

to initialize imageview.

but when call:

pff = (parsefile) object.get("favimg"); log.d("parsefile",pff.tostring()); imageview.setparsefile(pff);

the image view not set. have confirmed parsefile pff set. pointers appreciated. thanks!

you need utilize loadinbackground() fetch file:

imageview.loadinbackground(new getdatacallback() { @override public void done(byte[] data, parseexception e) { // nil if (e != null) e.printstacktrace(); } });

java android web-services parse.com imageview

javafx - how to make a table visible with custom rows & column -



javafx - how to make a table visible with custom rows & column -

i have next code create custom table. in output shows many rows doesn't contain values. display 2 rows , 1 columns. there solution this, else javafx produces default. there alternate way create table. may using gridpanebuilder

private tableview<person> table = new tableview<person>(); private final observablelist<person> info = fxcollections.observablearraylist( new person("jacob"), new person("isabella") ); public static void main(string[] args) { launch(args); } @override public void start(stage stage) { scene scene = new scene(new group()); stage.settitle("table view sample"); stage.setwidth(450); stage.setheight(500); final label label = new label("address book"); label.setfont(new font("arial", 20)); table.seteditable(true); tablecolumn firstnamecol = new tablecolumn("first name"); firstnamecol.setminwidth(100); firstnamecol.setcellvaluefactory( new propertyvaluefactory<person, string>("firstname")); table.setitems(data); table.getcolumns().addall(firstnamecol); final vbox vbox = new vbox(); vbox.setspacing(5); vbox.setpadding(new insets(10, 0, 0, 10)); vbox.getchildren().addall(label, table); ((group) scene.getroot()).getchildren().addall(vbox); stage.setscene(scene); stage.show(); } public static class person { private final simplestringproperty firstname; private person(string fname) { this.firstname = new simplestringproperty(fname); } public string getfirstname() { homecoming firstname.get(); } public void setfirstname(string fname) { firstname.set(fname); } }

you can set columns take much space possible by:

mytable.setcolumnresizepolicy(tableview.constrained_resize_policy);

i don't know if there easy way set height of table according amount of rows, set maxheight of table accoring amount of rows multiplied rowheight:

mytable.setmaxheight(countofrows * rowheight + headerheight);

and more flexible way utilize javafx binding, when add together or delete row height of table changes.

javafx javafx-2 javafx-8

javascript - Submit multiple form values with AngularFire -



javascript - Submit multiple form values with AngularFire -

i seek understand how angularfire works. i'm trying save first name , lastly name firebase database. created "first name" input , saved in firebase. seek add together lastly name input can't figure how create works. here now:

html

<section ng-controller="premiercontrolleur"> <ul> <li ng-repeat="client in clients"> <input ng-model="client.prenom" ng-change="clients.$save(client)" /> <input ng-model="client.nom" ng-change="clients.$save(client)" /> <button ng-click="clients.$remove(client)">x</button> </li> </ul> <form ng-submit="addclient(newclienttext)"> <input type="text" placeholder="prénom" ng-model="newclienttext.prenom" /> <input type="text" placeholder="nom de famille" ng-model="newclienttext.nom" /> <button type="submit">ajouter le client</button> </form> </section>

javascript

var app = angular.module("crmfirebase", ["firebase"]); app.controller("premiercontrolleur", function($scope, $firebase) { var ref = new firebase("https://mydirebaseurl.firebaseio.com/clients"); var sync = $firebase(ref); $scope.clients = sync.$asarray(); $scope.addclient = function(prenom) { $scope.clients.$add({prenom: prenom, nom: nom}); } });

i got error on submit:

failed read 'selectiondirection' property 'htmlinputelement': input element's type ('submit') not back upwards selection.

you not matching values, remember prenon object has properties prenon , nom, try:

$scope.addclient = function(prenom) { $scope.clients.$add({prenom: prenom.prenom, nom: prenom.nom}); }

javascript angularjs angularjs-scope angularfire

c++ - How t solve "Variable 'std::ifstream myfile' has initializer but incomplete type" -



c++ - How t solve "Variable 'std::ifstream myfile' has initializer but incomplete type" -

i create programme record of grades of students , determine it's position in frequency distribution table. records coming file. here code:

#inlcude<fstream> #include<iostream> #include<string> #include<cstdlib> using namespace std; int const ns=40; int main() { int y,x,i,vl=0,l=0,m=0,h=0,vh=0; int argr[ns]; ifstream myfile ( "file.txt", ios::in); if (myfile.is_open()) { while(getline(myfile,x)) for(i=0;i<ns;i++) { argr[i]=x; if(argr[i]<=20 && argr[i]>=0) vl=vl+1; else if(argr[i]<=40 && argr[i]>=21) l=l+1; else if(argr[i]<=60 && argr[i]>=41) m=m+1; else if(argr[i]<=80 && argr[i]>=61) h=h+1; else if(argr[i]<100 && argr[i]>=81) vh=vh+1; cout<<"range\t\tfrequency\n\n"; cout<<"0-20\t\t "<<vl<<endl; cout<<"21-40\t\t "<<l<<endl; cout<<"41-60\t\t "<<m<<endl; cout<<"61-80\t\t "<<h<<endl; cout<<"81-100\t\t "<<vh<<endl; } myfile.close(); } else cout<<"can't find file"; homecoming 0; }

another problem showed saying, "invalud preprocessing directive#include"

what should do?

#inlcude<fstream>

change to

#include<fstream>

you got typo kind of terrible ide using not show immediately?

c++ string c++11 fstream

c# - Select 50 to 100 rows from datatable -



c# - Select 50 to 100 rows from datatable -

this question has reply here:

how sec record in linq sql 8 answers

i need select rows 50 100 datatable. have tried first 50 rows using code:

dt.rows.cast<system.data.datarow>().take(50)

now need rows 50 100 datatable. how do this?

use skip method

dt.rows.cast<system.data.datarow>().skip(50).take(50)

c# linq datatable

c# - Reading a json file and change it with JSON.NET -



c# - Reading a json file and change it with JSON.NET -

json new me. how can utilize json.net add together key value pair created json file?

it looks this:

{ "data": { "subdata1": { "key1":"value1", "key2":"value2", "key3":"value3" }, "subdata2": { "key4":"value4", "key5":"value5", "key6":"value6" } } "key7":"value7", "key8":"value8" }

say illustration want alter following:

{ "data": { "subdata1": { "key1":"value1", "key2":"value2", "key3":"value3" }, "subdata2": { "key4":"value4", "key5":"value5", "key6":"value6" }, "newsubdata": { "mykey1":"myval1", "mykey2":"myval2", "mykey3":"myval3" } } "key7":"anothervalchangebyme", "key8":"value8" }

do need read whole json file dynamic, , alter / add together things need somehow ?

you can parse json jobject, manipulate via linq-to-json api, updated json string jobject.

for example:

string json = @" { ""data"": { ""subdata1"": { ""key1"": ""value1"", ""key2"": ""value2"", ""key3"": ""value3"" }, ""subdata2"": { ""key4"": ""value4"", ""key5"": ""value5"", ""key6"": ""value6"" } }, ""key7"": ""value7"", ""key8"": ""value8"" }"; jobject root = jobject.parse(json); jobject info = (jobject)root["data"]; jobject newsubdata = new jobject(); newsubdata.add("mykey1", "myvalue1"); newsubdata.add("mykey2", "myvalue2"); newsubdata.add("mykey3", "myvalue3"); data.add("newsubdata", newsubdata); root["key7"] = "anothervalchangebyme"; console.writeline(root.tostring());

output:

{ "data": { "subdata1": { "key1": "value1", "key2": "value2", "key3": "value3" }, "subdata2": { "key4": "value4", "key5": "value5", "key6": "value6" }, "newsubdata": { "mykey1": "myvalue1", "mykey2": "myvalue2", "mykey3": "myvalue3" } }, "key7": "anothervalchangebyme", "key8": "value8" }

c# json winforms json.net

c# - Library for database (schema) management -



c# - Library for database (schema) management -

i looking .net library deed abstraction layer between application , database. application deals construction alterations, creating new table or adding column existing table.

i have library deals straight database entities tables, schemas or columns - not orm (unless orms have "utility" layer). back upwards postgresql , sql server required (oracle , sqlite "a nice have" feature).

any free or commercial (but royalty-free i.e. no per-server license) solutions much appreciated.

for dal, recommend nhibernate (http://nhibernate.info/) great all-rounder:

easy use

good abstraction

powerful features.

it gets improve fluentnhibernate (http://www.fluentnhibernate.org/)

--

if looking more speedy , light-weight, take @ stackoverflow's own dapper (https://github.com/stackexchange/dapper-dot-net)

c# .net sql-server database postgresql

asp.net mvc - Error when I used javascript spin.js library -



asp.net mvc - Error when I used javascript spin.js library -

i using asp mvc , need utilize spin.js not working. here code using.

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>spin.js example</title> <script src="//cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js"></script> </head> <body> <div id="foo"></div> <script> var opts = { lines: 10, // number of lines draw length: 7, // length of each line width: 4, // line thickness radius: 10, // radius of inner circle corners: 1, // corner roundness (0..1) rotate: 0, // rotation offset color: '#000', // #rgb or #rrggbb speed: 1, // rounds per sec trail: 60, // afterglow percentage shadow: false, // whether render shadow hwaccel: false, // whether utilize hardware acceleration classname: 'spinner', // css class assign spinner zindex: 2e9, // z-index (defaults 2000000000) top: 25, // top position relative parent in px left: 25 // left position relative parent in px }; var target = document.getelementbyid('foo'); var spinner = new spinner(opts).spin(target); </script> </body> </html>

but when run exception showed in line

var spinner = new spinner(opts).spin(target);

and message

"spinner not defined"

any ideas on how can resolve this?

using qualified path spin library, appears work fine when inserted here stackoverflow code snippet (literally copied question, no additional modifications). point perhaps other issue code (is entire page) or perhaps browser has cached causing issue.

class="snippet-code-html lang-html prettyprint-override"><!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>spin.js example</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js"></script> </head> <body> <div id="foo"></div> <script> var opts = { lines: 10, // number of lines draw length: 7, // length of each line width: 4, // line thickness radius: 10, // radius of inner circle corners: 1, // corner roundness (0..1) rotate: 0, // rotation offset color: '#000', // #rgb or #rrggbb speed: 1, // rounds per sec trail: 60, // afterglow percentage shadow: false, // whether render shadow hwaccel: false, // whether utilize hardware acceleration classname: 'spinner', // css class assign spinner zindex: 2e9, // z-index (defaults 2000000000) top: 25, // top position relative parent in px left: 25 // left position relative parent in px }; var target = document.getelementbyid('foo'); var spinner = new spinner(opts).spin(target); </script> </body> </html>

javascript asp.net-mvc

mysql - how to store null values in listbox c# -



mysql - how to store null values in listbox c# -

i'm developing windows store app , has many list boxes retrieve info database, here mysql database screenshot

after null value in database listboxes not filling info shown next screenshot

i want maintain null values empty in list box , store other details how can that

here c# code

private void button_view_click(object sender, routedeventargs e) { listb0.items.clear(); listb1.items.clear(); listb2.items.clear(); listb3.items.clear(); listb4.items.clear(); seek { string query = @"select * `bcasdb`.`tbl_results`;"; //this command class handle query , connection object. mysqlconnection conn = new mysqlconnection(bcasapp.datamodel.db_con.connection); mysqlcommand cmd = new mysqlcommand(query, conn); mysqldatareader myreader; conn.open(); myreader = cmd.executereader();// query executed , info saved database. while (myreader.read()) { listboxitem itm0 = new listboxitem(); itm0.content = myreader.getstring(0); this.listb0.items.add(itm0); listboxitem itm1 = new listboxitem(); itm1.content = myreader.getstring(1); this.listb1.items.add(itm1); listboxitem itm2 = new listboxitem(); itm2.content = myreader.getstring(2); this.listb2.items.add(itm2); listboxitem itm3 = new listboxitem(); itm3.content = myreader.getstring(3); this.listb3.items.add(itm3); listboxitem itm4 = new listboxitem(); itm4.content = myreader.getstring(4); this.listb4.items.add(itm4); } conn.close(); } grab (exception) { errormsgbox(); } }

if prefer work issue in code need check dbnull using dbnull method of datareader

listboxitem itm2 = new listboxitem(); itm2.content = myreader.isdbnull(2) ? "" : myreader.getstring(2); this.listb2.items.add(itm2);

of course of study pattern should applied other columns potentially null.

c# mysql listbox

MySQL UPDATE with INNER JOIN has warnings but will not show them -



MySQL UPDATE with INNER JOIN has warnings but will not show them -

i'm getting warnings when updating table warnings not showing. through tedious , lengthy trial-and-error, cause of warnings has been tracked downwards inner join. need improve way debug warning.

setup ok. know warnings on because mysql command prompt started alternative '--show-warnings' , warnings turned on warnings '\w':

mysql> \w show warnings enabled. mysql> show variables '%warn%'; +---------------+-------+ | variable_name | value | +---------------+-------+ | log_warnings | 0 | | sql_warnings | on | | warning_count | 0 | +---------------+-------+ 3 rows in set (0.01 sec)

to create sure warnings on, forced truncating warning on varchar(255) field:

mysql> update course of study -> set course.transcript_title = 'field transcript_title varchar(255). on 255 characters forcefulness truncating warning. field transcript_title varchar(255). on 255 characters forcefulness truncating warning. field transcript_title varchar(255). on 255 characters forcefulness truncating warning.' -> course.title '%slp%' -> , course.year = 2008 -> , course.gid = 35; query ok, 104 rows affected, 104 warnings (0.19 sec) rows matched: 104 changed: 104 warnings: 104 warning (code 1265): info truncated column 'transcript_title' @ row 1 warning (code 1265): info truncated column 'transcript_title' @ row 2 .... etc.

i want warning type of query:

mysql> update course of study -> inner bring together group_info on course.gid = group_info.id -> set course.description = 'foo.' -> course.title '%slp%' -> , course.year = 2008 , group_info.id = 35; query ok, 0 rows affected (0.02 sec) rows matched: 104 changed: 0 warnings: 104 mysql> show warnings; empty set (0.00 sec)

from trial , error, know error having inner bring together clause. if remove inner bring together , straight utilize gid (group id) field in course of study table, no warnings:

mysql> update course of study -> set course.description = 'bar.' -> course.title '%slp%' -> , course.year = 2008 -> , course.gid = 35; query ok, 104 rows affected (0.01 sec) rows matched: 104 changed: 104 warnings: 0

but need inner bring together clause because want utilize more friendly 'name' field in joined 'group_info' table:

update course of study inner bring together group_info on course.gid = group_info.id set course.description = 'foo.' course.title '%slp%' , course.year = 2008 , group_info.name = 'one-to-one meeting time';

i've been googling, reading, , debugging warning on 1 hour. i've searched answers or explanations why not show warnings no luck.

how warnings show inner bring together type of update?

mysql join sql-update

Android set layout programmatically results in wrong display -



Android set layout programmatically results in wrong display -

i have linearlayout in layout, if re-create in xml layout file line 3 elements , everythings looks expected. seek add together linearlayout , kid elements programmatically works looks differently , wrong. button seems have right width height low , other 2 elements hardly visible wrong height , width.

this layout:

<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <edittext android:id="@+id/edittextvaluecomposition" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="0.94" android:ems="10" android:hint="@string/valuehint" android:inputtype="numberdecimal" > </edittext> <spinner android:id="@+id/compositionselector" android:layout_width="176dp" android:layout_height="wrap_content" android:layout_weight="0.06" /> <button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onclick="addcomposition" android:text="@string/add" /> </linearlayout>

and code:

public void addcomposition(view view) { final float scale = getbasecontext().getresources().getdisplaymetrics().density; linearlayout linearlayout = new linearlayout(this); linearlayout.setorientation(linearlayout.horizontal); linearlayout.setlayoutparams(new layoutparams(layoutparams.match_parent, layoutparams.wrap_content)); edittext valueedit = new edittext(this); valueedit.setlayoutparams(new tablelayout.layoutparams(layoutparams.wrap_content, layoutparams.match_parent, 0.94f)); valueedit.sethint(r.string.valuehint); valueedit.setems(10); linearlayout.addview(valueedit); spinner compositionselector = new spinner(this); compositionselector.setlayoutparams(new tablelayout.layoutparams(dptopx(176), layoutparams.wrap_content, 0.06f)); arrayadapter<charsequence> adaptercomp = arrayadapter.createfromresource( this, r.array.compositiontypes, android.r.layout.simple_spinner_item); adaptercomp.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); compositionselector.setadapter(adaptercomp); linearlayout.addview(compositionselector); button addcompobutton = new button(this); addcompobutton.setlayoutparams(new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); addcompobutton.settext(r.string.add); addcompobutton.setonclicklistener(new onclicklistener() { public void onclick(view v) { additem(v); } }); linearlayout.addview(addcompobutton); linearlayout additemlayout = (linearlayout) findviewbyid(r.id.screenadditem); int index = additemlayout.indexofchild(findviewbyid(r.id.button1)); additemlayout.addview(linearlayout, index); } public int dptopx(int dp) { displaymetrics displaymetrics = getbasecontext().getresources().getdisplaymetrics(); int px = math.round(dp * (displaymetrics.xdpi / displaymetrics.density_default)); homecoming px; }

try utilize linearlayout.layoutparams instead of tablelayout.layoutparams

android android-launcher

java - Got new HDD so and downloaded Android SDK. Making new project gives 100+ errors -



java - Got new HDD so and downloaded Android SDK. Making new project gives 100+ errors -

today downloaded android sdk eclipse. ran android sdk manager , allow him download every api. when wanted went in eclipse , made new project. programme gave me aroun 108 errors , console showed this:

[2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:75: error: error retrieving parent item: no resource found matches given name 'android:widget.material.actionbutton'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:79: error: error retrieving parent item: no resource found matches given name 'android:widget.material.actionbutton.closemode'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:83: error: error retrieving parent item: no resource found matches given name 'android:widget.material.actionbutton.overflow'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:25: error: error retrieving parent item: no resource found matches given name 'android:widget.material.actionbar.tabview'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:29: error: error retrieving parent item: no resource found matches given name 'android:widget.material.light.actionbar.tabview'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:33: error: error retrieving parent item: no resource found matches given name 'android:widget.material.actionbar.tabtext'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:37: error: error retrieving parent item: no resource found matches given name 'android:widget.material.light.actionbar.tabtext'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:41: error: error retrieving parent item: no resource found matches given name 'android:widget.material.light.actionbar.tabtext'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:65: error: error retrieving parent item: no resource found matches given name 'android:textappearance.material.widget.actionmode.title'. [2014-10-20 19:17:59 - reewwww] d:\androidprojects\appcompat_v7\res\values-v21\styles_base.xml:69: error: error retrieving parent item: no resource found matches given name 'android:textappearance.material.widget.actionmode.subtitle'.

there way more there limitation of how much characters post may contain. knows may causing this? tried redownload 1 time 1 time again aint helping.

here android application settings:

minimum required sdk: api 11 android 3.0 target sdk: api 18 android 4.3 complie with: api 18 android 4.3 theme: holo lite dark action bar.

thanks time!

yesterday update android sdk , back upwards repository, , of thought projects become total of errors. here tried:

change target 21 in project.properties file change 21 in pom.xml file change project sdk in project settings 21

don't know step needed, project start build

java android eclipse sdk

php - How to send two different actions in a form, with one submit button -



php - How to send two different actions in a form, with one submit button -

this question has reply here:

javascript: send multiple submitions 4 answers

i have 1 actions sends info journals.php , sec actions sends info uploads.php file. how can 1 submit button.

if show illustration awesome :)

<form id="login" action="journal.php?journal=journals&id=<?php echo $opened['id']; ?>" method="post" role="form"> <div class="form-group"> <label for="title">title</label> <input class="form-control" type="text" name="title" id="title" value="<?php echo $opened['title']; ?>" placeholder="title"> </div> <div class="form-group"> <label for="body">body</label> <textarea class="form-control" name="body" id="body" rows="14" placeholder="body"><?php echo $opened['body']; ?></textarea> </div> <button type="submit" id="loginsubmit" class="btn btn-default">save</button> <input type="hidden" name="submitted" value="1"> <?php if(isset($opened['id'])) { ?> <input type="hidden" name="id" value="<?php echo $opened['id']; ?>"> <?php } ?> </form> <form action="uploads.php" enctype="multipart/form-data"> <input type="file" name="file"> </form>

i have tried create script.

<script type="text/javascript"> $(document).ready(function() { $("#login").click(function(e) { e.preventdefault(); $.ajax({ type: "post", url: "uploads.php", datatype: "html", data: $("#loginsubmit").serialize(), success: function(data) { } }); $("#loginsubmit").submit(); }); }); </script>

you can submit text form ajax, wait come successfully, , submit file form regularly.

or

you can create single action file , include journal.php , uploads.php in it.

php html forms action

arduino - IRremote Library causes SD Card to stop… Why? -



arduino - IRremote Library causes SD Card to stop… Why? -

i'm tring utilize irremote library sd card library doesn't work, if import irremote library, sd card stops work knows why?

here's code i'm working with.

http://pastebin.com/fth9lftb

note: if comment line "#include " works, can help me pleaseee

you inquire why? irremote library messes arduino timers.

it's possible alter timer uses.

in irremoteint.h says:

// uncomment timer wish utilize on board. if you // using library uses timer2, have options // switch irremote utilize different timer.

that's worth try!

arduino sd-card infrared

java - Latest Jersey example does not work -



java - Latest Jersey example does not work -

i have isntalled latest version of bailiwick of jersey (bundle-version: 2.13.0) , examples version. tried (for testing restful services - \examples\helloworld-pure-jax-rs\src\main\java\org\glassfish\jersey\examples) hello world illustration in eclipse. result ist this:

"hello world" bailiwick of jersey illustration application exception in thread "main" java.lang.illegalargumentexception: no container provider supports type interface com.sun.net.httpserver.httphandler @ org.glassfish.jersey.server.containerfactory.createcontainer(containerfactory.java:87) @ org.glassfish.jersey.server.internal.runtimedelegateimpl.createendpoint(runtimedelegateimpl.java:71) @ org.glassfish.jersey.examples.helloworld.jaxrs.app.startserver(app.java:72) @ org.glassfish.jersey.examples.helloworld.jaxrs.app.main(app.java:88)

i thought illustration should work out of box not utilize specific http servers. only

import com.sun.net.httpserver.httphandler; import com.sun.net.httpserver.httpserver;

my java version is:

java version "1.8.0_25" java(tm) se runtime environment (build 1.8.0_25-b18) java hotspot(tm) client vm (build 25.25-b02, mixed mode, sharing)

any thought wrong or missed?

best klemens

with maven , eclipse

first tried maven command line (you need maven installed). worked fine.

steps:

downloaded jersey 2.13 examples bundle here unzipped ${myjerseyexamplelocation} (whatever location may be) cd ${myjerseyexamplelocation}/jersey/examples/helloworld-pure-jax-rs mvn package - downloaded dependencies , ran 1 unit test helloworldtest successfully

to run main app mvn exec:java. runs app class through exec-maven-plugin listed in <plugins> section of pom. result:

application started. seek accessing http://localhost:8080/helloworld in browser. nail come in stop application... from browser to http://localhost:8080/helloworld. result hello world! go command line , nail come in stop server

from eclipse:

i first delete entire unzipped example, built. wanted scratch eclipse.

steps:

unzipped from eclipse import -> maven -> existing maven projects browse helloworld-pure-jax-rs , select select finish right click on project run -> maven build. in dialog in goals field type package apply -> run. grab dependencies. should build successful along successful unit test. two options run: open app class, right click , run -> java application. should same result in eclipse console mention maven step 5. right click on project, select run -> maven build (there 2 select 1 haven't selected yet previous step). dialog again. allows configure different run configuration. in goals type exec:java. run. should same result above.

in eclipse environment, tested 1.7.0_65 , 1.8.0_20

hopefully can work. allow me know come with.

java eclipse http jersey

r - How to return the positions of first occurrence for (different) duplicated rows in a data.frame? -



r - How to return the positions of first occurrence for (different) duplicated rows in a data.frame? -

suppose have info frame following:

dfiris <- rbind(iris[1:5, -5], iris[1:5, -5], iris[1:5, -5], iris[1:5, -5], iris[1:5, -5])

since first 5 rows repeated other 4 times, efficiently get:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

the function duplicate() not help me because returns true sec occurrence on of duplicated row.

my (inefficient) solution:

apply(dfiris, 1, function(df) { which(apply(unique(dfiris), 1, function(df_u) identical(df, df_u))) })

there must quicker way that. suggestions?

using data.table:

library(data.table) setdt(dfiris, keep.rownames=true) print(setkey(dfiris[, list(rn=as.numeric(rn), firstocc=.i[1]), by=c(names(dfiris)[-1])], rn))

r data.frame duplicates

java - Spring ftp configuration is wrong -



java - Spring ftp configuration is wrong -

i have poll ftp location. testing purpose have created ftp site on machine using iis manager. listens @ port 21 , started.

the dependancies proper project

this xml configuration spring ftp

<bean id="ftpclientfactory" class="org.springframework.integration.ftp.session.defaultftpsessionfactory"> <property name="host" value="localhost"/> <property name="port" value="21"/> <property name="username" value="icmas"/> <property name="password" value="kavita12"/> <property name="clientmode" value="0"/> <property name="filetype" value="2"/> <property name="buffersize" value="100000"/> </bean> <int-ftp:inbound-channel-adapter id="ftpinbound" channel="ftpchannel" session-factory="ftpclientfactory" charset="utf-8" auto-create-local-directory="true" delete-remote-files="true" local-filter="compositefilter" remote-directory="c:\ftproot" remote-file-separator="\" preserve-timestamp="true" local-directory="c:\data" > <int:poller fixed-rate="1000"/> </int-ftp:inbound-channel-adapter> <int:channel id="ftpchannel"/>

the filenamegenerator , compositefilter nowadays in code havent pated code here.

my problem local-directory getting polled instead of remote-directory. thought files read remote-directory location go filter , if successful go filenamegenerator , set in local-directory location. wrong code???

please right me if doing wrong.

need help on issue... please set in suggessions!!

have resolved issue.

firstly needed filter attribute rather local-filter there difference in them.

secondly , more importantly have given romote-directory location absolute path. needs relative ftp directory mentioned while creating ftp site.

thanks. hope useful someone!!

java ftp spring-integration