Posts

Showing posts from February, 2010

windows - error: cannot open .git/FETCH_HEAD: Invalid argument -

i'm using git (from github windows distro) , trying pull repo , following error: d:\code\dopey-weaver [master]> git fetch error: cannot open .git/fetch_head: invalid argument d:\code\dopey-weaver [master]> git fetch --verbose error: cannot open .git/fetch_head: invalid argument this isn't "permission denied" of many other questions, seems i'm special snowflake... can open .git/fetch_head , looks fine(?): 010779f14f5bdf1d2d806a0ce0ac4c5e50314186 branch 'master' of https://github.com/nicktimko/dopey-weaver i think have conflict what's on remote should pulling/merging, can't fetch start... error message on push little long (is equivalent of hg saying "this create multiple heads" in not many words?) d:\code\dopey-weaver [master]> git push https://github.com/nicktimko/dopey-weaver.git ! [rejected] master -> master (fetch first) error: failed push refs 'https://github.com/nicktimko/dopey-weaver.g...

xml - Complex Grouping using XSLT 1.0 -

i've revised data file , added grouping column. not figure out logic grouping otherwise. the data contains information stamp collection. here sample xml: <?xml version="1.0" encoding="utf-8"?> <stamps> <stamp> <group>25</group> <scott>3133</scott> <title>32¢ thornton wilder</title> <series>literary arts</series> </stamp> <stamp> <group>26</group> <scott>3134</scott> <title>32¢ charlie chaplin</title> </stamp> <stamp> <group>26</group> <scott>3135</scott> <title>32¢ raoul wallenberg</title> </stamp> <stamp> <group>27</group> <scott>3136</scott> <title>sheet of 15</title> <issue>the world of dinosaurs</issue> </stam...

r - Update modification time of a file (touch) -

how touch file (i.e., update modification time without changing contents) in r? i'm looking cross-platform built-in (or packaged) equivalent of: system2("touch", file_name) see ?sys.setfiletime in case sys.setfiletime(path_to_file_or_directory, sys.time()) presumably job done: on unix-alike uses system call ‘utimes’ if available, otherwise ‘utimes’. on posix file system sets both last-access , modification times. on windows uses system call ‘setfiletime’ set ‘last write time’. windows file systems record time @ resolution of 2 seconds. although i'm not sure how reconcile " it uses system call ‘utimes’ if available, otherwise ‘utimes’ " meaningful statement.

java - IntelliJ does not generate Copy Constructor -

Image
i try automatically generate copy constructor intellij, can not select due box grey out. how automatically generate copy constructor intellij? my java class public class parameter { public double ma; public double mb; public double mc; public double md; public string mpath; public parameter(double ma, double mb, double mc, double md, string mpath) { super(); this.ma = ma; this.mb = mb; this.mc = mc; this.md = md; this.mpath = mpath; } public parameter(double ma, double mb, double mc, double md) { this(ma, mb, mc, md, ""); } public double geta() { return ma; } public double getb() { return mb; } public double getc() { return mc; } public double getd() { return md; } public string getpath(){ return mpath; } } the button grey out. generating copy constructor functionality not built inte...

perlbrew - Plackup cannot use specific perl version -

my application using plackup , required perl version 5.16 app can run well. used perlbrew downgrade current perl version(5.18) 5.16 here perl --version output this perl 5, version 16, subversion 0 (v5.16.0) built darwin-2level (with 1 registered patch, see perl -v more detail) copyright 1987-2012, larry wall perl may copied under terms of either artistic license or gnu general public license, may found in perl 5 source kit. complete documentation perl, including faq lists, should found on system using "man perl" or "perldoc perl". if have access internet, point browser @ http://www.perl.org/ , perl home page. but app still include perl 5.18 , shows error can't locate text/microtemplate.pm in @inc (you may need install text::microtemplate module) (@inc contains: lib ./lib /library/perl/5.18/darwin-thread-multi-2level /library/perl/5.18 /network/library/perl/5.18/darwin-thread-multi-2level /network/library/perl/5.18 /library/perl/updates/5.1...

network programming - Arduino and LoRa sx1272 the long range wireless -

how can develop lora sx1272 arduino uno? want link arduino arduino using wireless @ long range. maybe can : https://github.com/lora-net : implementations of lora in c http://www.research.ibm.com/labs/zurich/ics/lrsc/lmic.html : lora wan in c v1.5 ibm openlora.com/forum can cool too

asp.net mvc 4 - Using Image Resizer AzureReader2 with MVC website "The image cannot be displayed because it contains errors" -

i'm trying use image resizer's azurereader2 plugin read images blob storage. , works fine when try , retrieve unedited image. when go following url redirects local storage account image stored http://localhost:2000/azure/test/image.jpg but when navigate following "the image cannot displayed because contains errors" http://localhost:2000/azure/test/image.jpg?width=400&height=400&mode=crop&borderwidth=10&bordercolor=red here web.config file looks like <configuration> <configsections> <section name="resizer" type="imageresizer.resizersection,imageresizer" requirepermission="false" /> </configsections> <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5" /> <httpmodules> <add name="imageresizingmodule" type="imageresizer.interceptmodule" ...

java - Unable to make my itemListener select the appropriate action based on its source -

i making application school supposed accept locations 2 choice boxes , set mile distance between locations textfield. problem textfields not getting numbers intended. in checking teacher found itemstatechange method not reading sources of itemlisteners. can tell me wrong seem unable teach myself particular concept. relevant code issue follows: //connect actionlisteners , itemlisteners submit.addactionlistener(this); reset.addactionlistener(this); fromchoice.additemlistener(this); tochoice.additemlistener(this); vehicletype.additemlistener(this); gastype.additemlistener(this); submit.setactioncommand("submit"); reset.setactioncommand("reset"); ... public void actionperformed(actionevent e) { string arg = e.getactioncommand(); if (arg == "submit") { string val1 = miles.gettext(); string val2 = gasprice.gettext(); double double1 = double.parsedouble(val1); double doubl...

c# - StreamInsight and long running queries -

i have application built on top of streaminsight 1.2 has several standing queries running calculations in user defined operators. 1 of calculations take relatively long time complete (a few seconds), , i'm seeing blocks other queries executing. i'm not familiar how streaminsight works i'm speculating queries run on single thread. there way have queries run in parallel? aside somehow putting queries on separate threads, there other things prevent 1 sporadically long running query blocking other queries? if calculation take few seconds , that's nature of and running standard edition, best thing can not block thread while calculation taking place. streaminsight doesn't have built-in ... it's your responsibility. streaminsight's perspective, udo taking time. doesn't know why is. , if thread blocked, can't run else until udo returns. a) validate running standard edition , b) if are, change udo it's non-blocking/async.

C# vs 13- setup project- where is the db located? -

im new setup project , im trying understand db located app locate it. the app have 4 layers : (each of them has dll includes rest) api - have dll of app level app level - have dll of bl bl - have dll of dal dal- database. i need tell bl layer db located.

android - Custom service class with a ThreadPoolExecutor killed when app is off -

i need execute multipe tasks in parallel inside custom service these working : - location service , activity recognition api. - geofence api , rest api calls. i'm new threads in java , android, , found best way implement use threadpoolexecutor instead of making own thread classes , dealing handler looper stuff. when execute app, service starts, location updates , activity updates works fine inside thread. but, when close app, service restarts (when return start_sticky; ) , thread not working anymore.when ( return start_not_sticky; ), service disappears. (in case, can't use startforeground()) i'm using library( smart-location-lib ) location , activity updates. - here's custom service code : public class locationservice extends service { private threadpoolexecutor mdecodethreadpool; private blockingqueue<runnable> mdecodeworkqueue; private int number_of_cores = runtime.getruntime().availableprocessors(); private final int keep_alive_tim...

linux - Animated PS1 prompt BASH -

this question has answer here: how make animated bash shell prompt terminal? 2 answers i'm aware has been asked before couldn't find answer wanted anywhere. need (would have) bash prompt looks this: [ blah@blah ] > [ blah@blah ] > [ blah@blah ] > (then animation repeats) life of me can't figure out , i've been searching days (apparently not many people don't want animated prompt). want go through 1 frame of animation every 1/2 second every full animation 1 1/2 seconds long. is there way can this? in advance , sorry if way explained bit confusing. this got: animation() { s="\033[s" u="\033[u" pos="\033[1000d\033[2c" while [ : ] eval echo -ne '${s}${pos}\>\ \ ${u}' sleep 0.3 eval echo -ne '${s}${pos}\ \>\ ${u}' sleep 0.3 eval echo -ne '${s}${pos...

dictionary - Contig Extension with Python -

i want add function program creates dictionaries dna sequences receives contig (incon= initial contig; dna sequence) , extends right finding overlapping parts in form of keys in dictionaries , concatenating values "+" operator. i'll give quick example: gatttgaagc initial contig atttgaagc:a 1 of many entries in dictionary i want function search such overlapping part (i asked here yesterday , worked fine , specific values not within function variables) key in dictionary , concatenate value of key initial sequence (extend contig right) , save new sequence incon delete dictionary-entry , repeat until there no entries left (this part haven't tried yet). first want function search keys length of 9 values of length 1 (atttgaagc:a) , if there no overlapping parts keys length 8 values of length 2 (f.e. atttgaag:tg) , on. additional info: dictionary "suffixdicts" has such entries values length 1 (key has length 14) 10 (key has length 5). "reads...

python - multiple custom plugins in py.test -

my question regarding multiple custom plugins in pytest. have 2 (or more) pytest plugins created installed using setuptools , pytest11 entry point, each plugin has own setup.py. seems first installed plugin active. have verified via print statements in pytest_configure hook. if first installed plugin uninstalled, second configure hook second plugin seems called. also, same behavior observed addoption hook, options plugin installed second unrecognized. i'm thoroughly confused because i've used third party plugins , seem work fine. aren't hooks installed plugins supposed called ? problem way plugins installed, i.e. setuptools ? (the command use python setup.py -v install). pip correctly shows plugin modules installed. edit: names different, below setup files: from setuptools import setup setup( name="pytest_suite", version="0.1", packages=['suite_util'], # following makes plugin available pytest entry_points={ ...

concatenation - Javascript to record multiple selections from a list box will only separate with commas -

i using database platform , have multi-select listbox javascript. issue need these items separated ";" instead of ",". have separating character in code , otherwise code works intended (it stores multiple selections). here code: var v_state = "[@field:reason_for_cancelltaion]" ; var o_state = document.getelementbyid("editrecordreason_for_cancelltaion") ; o_state.multiple = true ; function f_listbox() { if ( v_state.indexof(";") > 0 ) { (var i=0 ; < o_state.options.length; i++ ) { if(o_state[i].value == v_state) { o_state.remove(i); break ; } } var o_st = v_state.split("; "); (var j=0 ; j < o_st.length; j++) { (var i=0 ; < o_state.options.length; i++ ) { if(o_st[j]== o_state.options[i].value){ o_state.options[i].selected = true ; break ; } } } } } window.onload = f_listbox ; any , appreciated! edit: shou...

String manipulation in javascript object -

i trying populate following string if have n data: group.items[0].fname || group.items[1].fname ||..........|| group.items[n].fname i have implemented following, know there better way that? nam=""; (i = 0; < data.length; i++) { if(i==0) nam="groups.items["+i+"]"+".fname"; else nam=nam+"||"+"group.items["+i+"]"+".fname"; } since data array can use array.prototype.map build array of substrings , join them: var data = [1,2,3]; var nam = data.map(function(el, i) { return 'group.items[' + + '].fname'; }).join('||'); alert(nam);

javascript - PHP floatval bizarre parsing -

i have calculations on client side javascript. var total = (((3 * 24) / 100) + 3); //result 3.7199999999999998 i need store 3.7199999999999998 number in database is. database on mysql, use doctrine 2 orm, , entity has precision set /** @column(type="decimal", precision=32, scale=16, nullable=false) * */ , after saving see in database number 3.72 , wtf ? after checking found doctrine uses floatval , after executing floatval(3.7199999999999998) 3.72 !! why? is there workaround ? telling doctrine not use floatval , store value is? dont want use varchar column. thanks in advance! 3.72 correct value. 3.7199999999999998 result due floating-point imprecision in javascript (see: how deal floating point number precision in javascript? ). i'd suggest using tofixed() in javascript code avoid this. var total = (((3 * 24) / 100) + 3).tofixed(2);

python - How to extend init method with inheritance -

i have following code, in trying extend init method of baseexporter : from apps.ingest.platform_export import baseexporter class vudu(baseexporter): def __init__(self): baseexporter.__init__() self.platform = ' vudu' basically, of init'd variables baseexporter plus additional variable of self.platform = 'vudu' . how correctly? you on right track, missing self on parent class from apps.ingest.platform_export import baseexporter class vudu(baseexporter): def __init__(self): baseexporter.__init__(self) self.platform = ' vudu'

ruby - find start and end of range given a point -

i created basic class right here: class timeperiod months_per_quarter = 3 quarter_range = { 0 => [1,3], 1 => [4,6], 2 => [7,9], 3 => [10,12] } def self.quarter(month_num) (month_num - 1) / months_per_quarter end def self.quarter_range(month_num) quarter = quarter month_num t1,t2 = quarter_range[quarter] [time.parse(date::monthnames[t1]).beginning_of_month, time.parse(date::monthnames[t2]).end_of_month] end end it gives me time range quarter, given month provided integer: > timeutils.quarter_range(time.now.month) => [2015-04-01 00:00:00 -0400, 2015-06-30 23:59:59 -0400] so works. however, have cheated. had difficulty finding start , end, given, let's say, month 6. hardcoded values in quarter_range constant. want able remove quarter_range constant , find beginning , end (e.g. [4,6]) without it. so example, if input 3 (march),6 (june),9(september),12(december) passed, know end of quarter, using modulus ...

osx - Implement .gitignore behavior in a shell script? -

i'm writing shell script syncs files , want give users ability exclude files syncing creating .syncignore file similar git's .gitignore file. according gitignore documentation , , own experiments, these exclusion rules more complicated simple glob match. examples: if have foo in .gitignore file, exclude foo appearing anywhere in path (e.g. ./foo , ./bar/foo , , ./bar/foo/baz excluded) not partial matches of foo (e.g. ./foobar , ./bar/foobar/baz not excluded). if include slash, rule applied relative current directory. example, if have /foo in .gitignore file, exclude ./foo not ./bar/foo . you can include wildcards. example, foo* exclude ./foo , ./foobar , , ./bar/foobar/baz . is there easy way replicate exclusion rules .gitignore in shell script on os x? use rsync synchronize files. use existing include/exclude pattern support. put rules in .rsync-filter , pass -f flag make read patterns file. rsync man page just use git . make sure have...

function - javascript: explain how to use certain class as static -

this question has answer here: what define used in javascript (aside obvious) 1 answer i have scrip structure: define('game-logic/clib',[], function () { var audio = null; return { //some functions.... localordef: function(name, def) { /.... }, } }); and have no idea, how 'define' stuff on top works, want understand it, want rewrite script in such way, call functions clib.localordef(name,def), including other scripts using: "script type="text/javascript" src="js/clib.js"></script>" this 'define('game-logic/clib',[], function ()' - how replace call static class? to keep simple - define keyword comes requirejs framework , used guarantee particular dependencies met when call them, e.g. jquery loaded when want use it. more info found on projects homepage: http:...

Publish will not push adovbs.inc to target File System destination (classic asp and IIS 7.5) -

i have classic asp site on visual studio 2012 development machine , have noticed strange behavior publish . a file called adovbs.inc exists in folder called debug within root of site. quite few files on (development) site reference without problem syntax: <!--#include file="../debug/adovbs.inc" --> after "successful" publish operation, note adovbs.inc file did not in-fact copied target location (on production machine) , hence get: include file '../debug/adovbs.inc' not found. i wonder if filetype .inc problem? server-side include files have filetypes of .asp in site. there "knob turn" somewhere in iis 7.5? after lots of frustration, copied file , pasted windows explorer , file found @ runtime. don't use vs publish website option classic asp site because there nothing compile, use copy website option instead, can find in website menu or right-click on website in solution explorer.

matlab - solving least square for matrix instead of vector -

Image
the problem find z such epsilon(e) (equation 21) minimized. z mxn matrix need find. zx , zy mxn matrix known already. dx , dy nxn matrix carry out numerical differentiation (see matrix circled in red in photo), known matrix. f denotes 'fobrenius norm', or 'entry-wise norm'. how solve problem? know how solve least square problem vector, in matrix form , stuck.

java - Adding a Spring context to a Jackson generated object -

i experiment adding business logic data objects. therefor have jackson inject spring application context automatically each generated object (generated json). is there way tell jackson add spring context each generated object? use @jacksoninject annotation specify values should come object mapper/reader. @test public void inject_global_context_object() throws exception { contextobject ctx = new contextobject(); mapper.setinjectablevalues(new injectablevalues.std() .addvalue(contextobject.class, ctx)); dataneedingcontext data = mapper.readvalue("{\"prop\":\"foo\"}", dataneedingcontext.class); assertthat(data.ctx, sameinstance(ctx)); assertthat(data.prop, equalto("foo")); } @test public void inject_local_context_object() throws exception { contextobject ctx = new contextobject(); dataneedingcontext data = mapper.reader(datane...

c++ - Creating a Qt widget belonging to another widget made with Qt Designer -

i have created label in mainwindow.cpp lblmylabel = new qlabel(this); what put in place of "this" in order have show in layout created qt designer? i know silly question simple answer open lot of doors me far understanding how works. for example can try following. first shall add qwidget want qlabel displayed in widget created in designer. , after try following lines: void setmainwidget( qwidget* aparent, qwidget* achild, const int amargin = 0 ) { qgridlayout* layout = new qgridlayout( aparent ); layout->addwidget( achild ); layout->setmargin( amargin ); aparent->setlayout( layout ); } in case: mylabel = new qlabel( ui->widget ); setmainwidget( ui->widget, mylabel ); it useful more complex custom widgets.

node.js - Creating a typed array from a byte array stored as a node Buffer -

from node docs regarding creation of typed arrays buffers: the buffer's memory interpreted array, not byte array. is, new uint32array(new buffer([1,2,3,4])) creates 4-element uint32array elements [1,2,3,4] , not uint32array single element [0x1020304] or [0x4030201] . this contrasts plain javascript, creating typed array view arraybuffer uses arraybuffer's memory bytes. need behavior in node when operating on node buffers. i convert buffer arraybuffer, slow application. (i've tried many methods -- they're o(n) time.) (edit: fastest method i've found this , single memmove op , pretty fast, still has @ least momentary 2x memory consumption until reference original buffer released.) is there (fast/o(1)) way typed array buffer, using buffer's contents bytes instead of elements? (the needed typed array element size >1 byte, needless say.) as far know, not possible without making copy of data in memory. example new uint32array(ne...

Use javascript to detect if an MP4 video has a sound track -

i creating custom controller mp4 video on web page. controller includes volume slider. of videos played have no sound track. disable volume slider these videos, user not confused when changing position of volume slider has no effect. is there property or trick checking if mp4 file has audio track? (jquery option). edit: using @dandavis's suggestion, have solution chrome (and .ogg on opera): var video = document.getelementbyid("video") var volume = document.getelementbyid("volume-slider") function initializevolume() { var enablevolume = true var delay = 1 if (video.webkitaudiodecodedbytecount !== undefined) { // on chrome, can check if there audio. disable volume // control default, , reenable non-zero value // webkitaudiodecodedbytecount detected. enablevolume = false starttimeout() function starttimeout () { if (!!video.webkitaudiodecodedbytecount) { enablevolume = true togglevolumeenabled(enable...

java - Using regular expression (String + number) in Scala -

i using regression expression find patterns such as: "today user id: 123556 cancelled" "january user id: 236477 renewed" "february user id: 645689 dispute" basically looking string contains "user id: " + number. using following code, couldn't match anything. please give suggestions? if (mystring.matches("user id: ([0-9]+)")) { println(a) } it should be: if (mystring.matches("^user id: ([0-9]+)$")) { without slashes in regex string , space after user id: just tested , worked me follows: string string = "user id: 12345"; if(string.matches("^user id: ([0-9]+)$")){ system.out.println("matches"); } there lots of "regex cheatsheets" out there. can find 1 such here: http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

Unable to login into private docker registry (v2.0) -

i trying setup private docker registry using standard docker registry image , docker registry reverse proxy ( https://registry.hub.docker.com/u/marvambass/nginx-registry-proxy/ ) the goal secure registry using ssl (using self-signed ssl cert) , username/password authentication. seems go well, when try navigate via browser private docker registry using : https://<private-docker-reg>:443/v2/ prompt provide username , password , correct output in case {} but when try login using docker client seem unable login: > docker login https://<private-docker-reg>:443 > username: foo > password: bar > email: > > fata[0005] error response daemon: v1 ping attempt failed > error: https://<private-docker-reg>:443/v1/_ping: x509: > certificate signed unknown authority. if private registry > supports http or https unknown ca certificate, please add > `--insecure-registry <private-docker-reg>:443` daemon's > arguments. in case of h...

java - how to print this array in reverse -

i started learning java , i'm trying print array in reverse not sure i'm doing wrong doesn't return second loop, no errors package com.company; import java.util.scanner; public class main { public static void main(string[] args) { scanner red = new scanner(system.in); int[] arr; arr = new int[3]; (int i=0;i<arr.length;i++) { system.out.println("enter number"); arr[i]=red.nextint(); } (int j=2;j<0;j--) { system.out.println(arr[j]); } } } try this for (int j = arr.length-1; j >= 0; j--) { system.out.println(arr[j]); }

node.js - How to make the package manager npm use bash 4 on Mac OS X? -

i've updated bash version 4 on mac os x yosemite using homebrew , in order make possible use "globstar" in npm scripts. e.g. recursively list .js files in test directory using pattern ./test/**/*.js . however, npm run scripts older bash version (version 3). is possible make npm uses updated bash version? (i'm not sure, guess npm uses /bin/bash instead of /usr/local/bin/bash) update: particular use case investigate possibilities use npm build tool, , instance bundle test specs browserify using npm script such "build:test:scripts": "browserify ./test/**/*.js -o /build/test-bundle.js", . try wrapping "globstar" single quotes: "build:test:scripts": "browserify './test/**/*.js' -o /build/test-bundle.js",

java - Accessing multiple sensors in non-activity classes -

i trying use multiple sensors accelerator,magnetic field, light , on , each sensor wrote individual class not activity , each of them has sensoreventlistener well. want when user chooses 1 of them start show data on fragment(on mainactivity) , when user changes previous sensor should stop , new 1 should start. however, when try stop previous 1 unregistering listener , doesn't unregister registers , works. want stop previous listener. wrong? ideas? here sensor class; public class accelerometer { private sensormanager sensormanager; private sensor sensor; public list<objaccelerometer> lstdata; objaccelerometer currentdata; float lastx,lasty,lastz; string currenttime; int numberofsamples; context context; public accelerometer(context _context,int _numbersample) { context=_context; sensormanager = (sensormanager) context.getsystemservice(context.sensor_service); sensor = sensormanager.getdefaultsensor(se...

php - Codeiginter : Error in URL -

my front url is- http://localhost/myproject/ admin url - http://localhost/myproject/admin it works in windows not works on ubuntu. it gives error "not found". what works in ubuntu - the front page working - http://localhost/myproject/ the admin login page working if add index.php in url - http://localhost/myproject/index.php/admin not other pages working my .htaccess file contents- rewriteengine on rewritecond $1 !^(index\.php|assets|themes) rewriterule ^(.*)$ /myproject/index.php/$1 [l] my apache's mod-rewrite module on. i following similar issue in centos, , followed below tutorial : how permit changes in .htaccess file: open httpd using ------------------> vi /etc/httpd/conf/httpd.conf once inside file, find following section, , change line says allowoverride none all. section should this: options indexes followsymlinks multiviews allowoverride order allow,deny allow after save , ex...

What is the proper way to setup integration tests in grails 2.5 using junit? -

with grails 2.2 following code (which integration test gorm class) working fine: public class dbdeploymentintegrationtests extends groovytestcase { deploymentstorageimpl deploymentstorage deploymentservice deploymentservice @override protected void setup() { super.setup() deploymentstorage = deploymentservice.deploymentservice.deploymentstorage } ... } when updated grails 2.5, failing: | failure: testincludedetails(org.linkedin.glu.console.domain.dbdeploymentintegrationtests) | java.lang.nullpointerexception: cannot property 'deploymentservice' on null object @ org.linkedin.glu.console.domain.dbdeploymentintegrationtests.setup(dbdeploymentintegrationtests.groovy:41) the documentation ( http://grails.github.io/grails-doc/2.5.0/guide/upgradingfrom22.html ) states following: dependency injection integration tests in order support alternate junit4 test runners, grails 2.3 no longer uses special test runner run tests , integrati...

java - maven ignoring jenv settings -

i had osx java 1.6 installed, , installed jenv along java 1.7 : $ jenv local '1.7' $ jenv versions system 1.6 1.6.0.65 * 1.7 (set /users/me/workspace/.java-version) 1.7.0.79 oracle64-1.6.0.65 oracle64-1.7.0.79 jenv doing job, $ java -version working, showing 1.6 when i've set 1.6, , 1.7 when i've set 1.7: $ java -version java version "1.7.0_79" <--------------------------------- yay!! java(tm) se runtime environment (build 1.7.0_79-b15) java hotspot(tm) 64-bit server vm (build 24.79-b02, mixed mode) ... maven ignoring settings: $ mvn -version apache maven 3.0.2 (r1056850; 2011-01-08 19:58:10-0500) java version: 1.6.0_65, vendor: apple inc. <--------------------------------- bah!! java home: /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home default locale: en_us, platform encoding: macroman os name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac...

java - spring-data Property name with underscore is not escapable as the documentation states -

so i've read spring documentation states when have property names underscore ( first_name ) should escape , underscore in query method using underscore ( findbyfirst__name(...) ). spring data documentation however, in practice not work , runtime error stating property first cannot found. has been documented other devs here: link 1 link 2 but none of provided answers addresses fact not working in practice. answers state remove underscore property name.... not easy or possible task. can confirm have gotten work? guess there bug in spring-data reason no 1 has acknowledged or filed bug yet. is there workaround problem has had success besides renaming database field? i debugged spring-data-commons 1.9.2.release version , created following pull request since code seems not handle case. further information please review following link: https://github.com/spring-projects/spring-data-commons/pull/126 read here: https://jira.spring.io/browse/datacmns-569

ReactJS: Child component updates before parent state is set -

i have parent , child components state of child (openwhen shouldchildrender) controlled parent. i'm running issue child updated (receives props) before parent state updated after calling parent's setstate() child receives stale state until second pass through of flow. in second pass through child receives updated state , renders correctly. parent: opendeactivatewarning: function (resource) { this.setstate({ opendeactivatemodal: true, workingresource: resource }); console.log('this.state.opendeactivatemodal still false here', this.state); }, render: function () { return ( <modal openwhen={this.state.opendeactivatemodal} opencallback={this.opendeactivatewarning}> <p>some modal content</p> </modal> ) } child: componentwillreceiveprops: function () { console.log('this fired before parent state changes , openmodal not called'); if (this.props.openwhen) { ...

java - nonuniqueobjectexception when Updating Database and Database creating new records instead of updating existing ones -

i'm having issue don't understand, since started working databases. keep getting nonuniqueobjectexception, when try save 2 instances of project database. when save session project keep information , update database accordingly inspection table connected project database continue add new entries. tried multiple fixes of trying throw exceptions can't figure out way save information in table without creating new entries in instance table. can give me advice on how tackle issue , look? public static void editproject(long warehouseid, long managerid, long supervisorid, long classid, long projectitemid, long statusid, long stageid, long typeid, string scope, map<string, string>params, long inspectiontn) throws classnotfoundexception, parseexception { //initialize services dateformat formatter = new simpledateformat("mm/dd/yyyy"); //get essential pro...

django DecimalField - how do I retrieve the value as a float? -

so never have used django's decimalfield option if had known how difficult serialize model data json result. long story short, how float value decimalfield ? my model looks this: class dailyreport(models.model): earnings = models.decimalfield(max_digits=12, decimal_places=4) def earnings_float(self): return self.earnings.to_float() obviously there no to_float() method available, do instead? below later addition: this works: class dailyreport(models.model): earnings = models.decimalfield(max_digits=12, decimal_places=4) def earnings_float(self): return float(self.earnings) but seems complicated. i'm trying use django-rest-framework serializing, since i'm using rest-framework stuff in app generally. in particular case i'd transform , serialize data python lists , dictionaries , store them documents in mongo db via pymongo 3. just cast decimalfield float: def earnings_float(self): return float(sel...

Menu CSS issue in IE8 -

Image
i have created menu list. working on chrome , firefox misaligned in ie8 chrome snapshot :- http://postimg.org/image/g6uf9zikr/ ie8 snapshot :- http://postimg.org/image/u6o3pzasz/ here's css ------ div.menu { background-color:#383838; height:65px; margin-bottom:20px; } div.menu ul { vertical-align:middle; list-style:none; margin:0; padding:0; } div.menu ul li { float:left; display:block; } div.menu ul li { color:#ffffff; display:block; float:left; font-family:"trebuchet ms", verdana, arial; font-weight:bold; padding:24px 20px 22px; text-transform:uppercase; text-decoration:none; } div.menu ul li a:hover { text-decoration:underline; background-color:#2b2b2b; } div.menu ul li:hover ul { display:block; } div.menu ul li ul { vertical-align:middle; text-align:center; float: none; list-style: none; display: none; position:absolute; z-index:999; margin-top:60px; background-color:#383838; ...

ajax - Rails - Session Variable Does Not Persist -

i want save state of side-menu in rails session variable, if user collapses side-menu, collapsed state persist when view changed. have js set uncollapsed state send "0" through controller, , if side menu in collapsed state, ajax send "1" through controller action. if controller action receives "1", want session variable set in app. i have ajax request respective controller action, , collapsed side-nav sending "1" through successfully, session variable not seem persist. here see in console when side-nav collapsed: console: (when side-nav collapsed) started post "/dashboard/side_nav_state" 10.0.2.2 @ 2015-06-02 15:58:08 +0000 processing dashboardcontroller#side_nav_state */* parameters: {"hide_side_nav"=>"1"} completed 200 ok in 2ms (views: 0.2ms | activerecord: 0.0ms) (when side-nav expanded) started post "/dashboard/side_nav_state" 10.0.2.2 @ 2015-06-02 16:02:56 +0000 processing dashboar...

verification - How to use org.openimaj.ml.gmm to construct speaker models. -

i know how can gmm speaker model using openimaj library. org.openimaj.ml.gmm.gaussianmixturemodelem. have tried following gaussianmixturemodelem gmm = new gaussianmixturemodelem (default_number_components,gaussianmixturemodelem.covariancetype.diagonal); mixtureofgaussians mixture = gmm.estimate(data); boolean convergerd = gmm.hasconverged(); i true gaussianmixturemodelem has converged, lost go here. guidance appreciated. given comment, mixture.estimatelogprobability(point) should want (see http://www.openimaj.org/apidocs/org/openimaj/math/statistics/distribution/mixtureofgaussians.html#estimatelogprobability(double[]) ).

c++ - Return using this pointer vs return by value -

what difference between returning pointer , return value. i try explain case example.. i have following code #include <iostream> using namespace std; class count { private: int count; public: //constructor count():count(0) { cout << "constructor called" << endl; } count(count& c):count(c.count) { cout << "copy constructor called" << endl; } //destructor ~count() { cout << "destructor called" << endl; } count operator ++ () { count++; count temp; temp.count = count; return temp; //return *this; } //display value. void display() { cout << "the value of count " << count << endl; } }; int main() { count c; count d; c.display(); d.display(); d=++c; c.display(); d...

c# - "Data at the Root Level is invalid" with LoadXml -

i have code snippet : xmldocument doc = new xmldocument(); try { doc.loadxml(xmlpath); } catch (exception ex) { string exmessage = ex.message; } the xml looks this <?xml version="1.0" encoding="utf-8"?> <mimetypes> <mimetype> <extension>.3dm</extension> <value>x-world/x-3dmf</value> </mimetype> </mimetypes> its producing error: data @ root level invalid. line 1, position 1. any idea what's wrong? use doc.load(xmlpath). loadxml loading xml string.

mysql - SQL Cannot add or update a child row: a foreign key constraint -

create table employee( -> emp_no int(4), -> emp_fname varchar(50), -> emp_lname varchar(50), -> job_class varchar(4), -> primary key (emp_no), -> foreign key (job_class) references job (job_class) -> ); query ok, 0 rows affected (0.09 sec) create table project( -> pro_no int(4), -> pro_name varchar(50), -> pro_leader varchar(50), -> emp_no int(4), -> primary key (pro_no), -> foreign key (emp_no) references employee (emp_no) -> ); query ok, 0 rows affected (0.23 sec) create table assign( -> pro_no int(4), -> emp_no int(4), -> job_class varchar(4), -> assign_hours decimal(6,2), -> total_charge decimal(6,2), -> primary key (pro_no, emp_no), -> foreign key (pro_no) references project (pro_no), -> foreign key (emp_no) references employee (emp_no) -> ); query ok, 0 rows affected (0.08 sec) ...