Posts

Showing posts from March, 2013

mapreduce - Can I use HCatInputFormat with MultipleInputs in Hadoop? -

i'm attempting join between 2 datasets, 1 stored in hive table, other 1 not. see according people not normal, in, either define hive table or don't. now there's multipleinputs class, addinputpath method takes configuration, path , inputformat, mapper i use input format there , try put table name disguised path sounds wild guess @ best. there's patch newer version of hive (i'm on cdh4 means hive 0.10 , hcat 0.5 sadly). found patch not quite straight forward translate current version , seems work multiple tables , not mix of them. https://issues.apache.org/jira/browse/hive-4997 is possible or have recommendations? the thing can think of reading raw data without using table, implies logic on hive specific formats i'd rather avoid. hcatmultipleinputs can used reading multiple hive tables. here patch (for 0.13) can @ installing multiple table support. has hcatmultipleinputs support multiple hive tables. https://issues.apache.org/jira/i#b...

algorithm - Java implementation of quickselect-median -

there implementation at http://www.java-tips.org/java-se-tips/java.lang/quickselect-implementation-with-median-of-three-partitioning-and-cutoff.html using scala syntax val arr = array[comparable[_]](1, 7, 10, 11, 3, 6, 0, 2, 9, 4, 8, 5) quickselect(arr, 6) println(s"${arr.mkstring(" ")} | ${arr(6)}") and output: 1 4 2 0 3 5 11 10 9 7 8 6 | 11 . so, median 11 instead of 6. know bug in implementation? link provided says that * quick selection algorithm. * places kth smallest item in a[k-1]. 6th element in zero-based array a[5]

android - startActivity in Thread -

this code : package gal.doron.ballinthehole; import android.content.intent; public class ballmover extends thread { private ball[] balls; private paddle paddle; private gamelevels levels; private gameview gameview; private enum directions {top, right, bottom, left, none}; public ballmover(ball[] b, paddle p, gamelevels levels, gameview view) { this.balls = b; this.paddle = p; this.levels = levels; this.gameview = view; } @override public void run() { while(true) { if(levels.isfinishlevel()) { levels.setcurrentlevel(levels.getcurrentlevel()+1); for(int i=1;i<balls.length;i++) { balls[i].setvisible(false); ...

c# - AccessViolationException while adding item to a list -

i developing windows phone 8.0 app in vs2010 and in point , decided make 2 classes (player,game) game.cs public class game { public string name { get; set; } public bool[] levelsunlocked { get; set; } public bool firsttimeplaying { get; set; } public game(int numoflevels) { this.firsttimeplaying = true; this.levelsunlocked = new bool[numoflevels]; } } player.cs public class player { public int id { get; set; } public string firstname{ get; set; } public string lastname { get; set; } public int age { get; set; } public int rank { get; set; } public int points { get; set; } public string rankdescreption { get; set; } public uri avatar { get; set; } public list<game> games; public player() { game hourglass = new game(6); game commonnumbers = new game(11); games.add(hourglass); games.add(commonnumbers); } } whe...

IOS Location Update with NSTimer -

this question has answer here: iphone cllocationmanager updates every 0.5 seconds 2 answers i want location updates once per second. interval important animation want create keep true-to-life speed on ground. understand [mylocationmanager startupdatinglocation] automatically poll "didupdatetolocations", not quite once per second. is there way use nstimer location once per second? thank -jj - (void)startupdatinglocation self.locationmanager = [cllocationmanager new]; self.locationmanager.desiredaccuracy = kcllocationaccuracybestfornavigation; self.locationmanager.delegate = self; [self.locationmanager startupdatinglocation]; nstimer *timer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(updatelocation) userinfo:nil repeats:yes]; } - (void)updatelocation { cllocation location = self.locatio...

sql server - SQL output modification: NULL to String -

i using sql retrieve 2 dates. formatted first date convert(varchar(10), date, 110). changes output 12-08-2013 (for example). now, want second date formatted same way unless = null, in case should come out 00-00-0000. select convert(varchar(10), date_opened, 110) opened, --if date_closed = 'null' return '00-00-0000' closed --else return convert(varchar(10), date_closed, 110) closed, is there way apply specific formatting output? cannot modify underlying database. select isnull(convert(varchar(10), date_closed, 110), '00-00-0000') [closed] or select coalesce(convert(varchar(10), date_closed, 110), '00-00-0000') [closed]

CloudStack interaction with Public Cloud -

i'm setting new cloudstack infrastructure , haven't found resources regarding 1 of requirement: i'm looking possibility have cloudstack environment, interacting public-cloud. i'd example, able replicate, migrate or clone 1 vm/instance, private cloud, public cloud. i'd able create new vm public cloud should infrastructure grow quickly, , bring them environment whenever possible. this easy perform scvmm , azure. haven't found similar info cloudstack. citrix’ cloudplatform , both based on cloudstack , xen server, there possibility build them? or public cloud provider? would glad hear info on topic, in advance!

Optaplanner input files -

i trying use optaplanner business case have, vrp problem. not expert programmer, deal problem of imputing information software. files in example .vrp files not manage find out how can change them. have files in txt format cannot find way how use them. hope there easy way maybe convert txt files vrp. thank in advance. michail no, there no magic program takes arbitrary formatted txt file , turns vrp format used example in optaplanner. example meant starting point programmers, can customize business needs , put in business ui. note: optaplanner has no input/output formats. optaplanner example vehiclerouting can load file in format vrp (or xstream xml) in it's vrp domain objects, possible write code load database or else.

java - spring.tld tag library attributes differences -

in many tags of spring.tld there attributes: htmlescape javascriptescape the question may seem trivial, difference html escape , javascript escape in context? well htmlescape use escape literal within html document. example, if html document contains special characters, escaped follows: original : < > " & escaped : &lt; &gt; &quot; &amp; javascript escape apply across javascript literal. suppose have literal: <script> function helloworld(){ alert('<html:message javascriptescape="true" code="hello" />') } <script> applying javascript escape single , double quotes, newline chars, tabs, etc.

ios - Does it take 24 hours for custom events to be recorded in Parse Analytics -

i'm new parse , i've tried adding basic event data so: nsdictionary *dimensions = @{ // type of news this? @"category": @"politics", // weekday or weekend? @"daytype": @"weekday", }; [pfanalytics trackevent:@"read" dimensions:dimensions]; from dashboard can see api request event recorded can't seem access specific event or data. take 24 hours register or using dashboard incorrectly? ok, think i've found issue. won't see in dashboard unless click on "custom breakdown" , select options visualize custom event, use filters see dimensions "category" , "daytype" filters inside of it. if want keep report future use click "save breakdown" , can come (although can't edit filters) hope helps.

python - Replace leading digits with regex -

i have following string: s= '<file_name>857173423paramount_funeral_in_berlin_audio.mov' how want remove leading digits (if there 4 or more consecutive digits) occur after string file_name> . so far have: >>> re.sub('\d+','', s) '<file_name>paramount_funeral_in_berlin_audio.mov' but of course not general enough cover such cases as: s = '<file_name>12897878lionsgate_t2.mov' either use lookbehind : (?<=<file_name>)\d+ or use capture group , reference in substitution : (<file_name>)\d+ \1 i saw "4 or more digits", can replace + {4,} . match 4+ digits, , default regex "greedy" , continue on , match of leading digits: (?<=<file_name>)\d{4,}

java - My code receives the error "The specified child already has a parent. You must call removeView() on the child's parent first." -

as title reads, getting error in logcat when run app. code written after error occured: public void coinanim1() { relativelayout rl = (relativelayout) findviewbyid(r.id.mainlayoutid); imageview coin1 = new imageview(this); relativelayout.layoutparams params = new relativelayout.layoutparams(30, 40); params.leftmargin = 50; coin1 = (imageview) findviewbyid(r.id.coinid); animation coinfall1 = animationutils.loadanimation(this, r.anim.coinanimation); coin1.startanimation(coinfall1); rl.addview(coin1, params); } public void coinanim2() { relativelayout rl2 = (relativelayout) findviewbyid(r.id.mainlayoutid); imageview coin2 = new imageview(this); relativelayout.layoutparams params2 = new relativelayout.layoutparams(30, 40); params2.leftmargin = 50; coin2 = (imageview) findviewbyid(r.id.coin2id); animation coinfall1 = animationutils.loadanimation(this, r.anim.coinanimation); coin2.startanimat...

apache - How to create a friendly url in Tomcat? -

i want modify application url //localhost:8080/monitor/index.html monitor , on putting monitor on browser, application should open. there way achieve this, can suggest configuration changes required this. can map short url existing 1 may somewhere in web.xml. not sure approach suggestions great. thanks , regards deb you're mixing several different protocol layers in question. if enter nothing "monitor" in browser url bar browser going first lookup "monitor" in dns , finding nothing send query google or configured search engine. in past browsers have taken other steps, such appending ".com" , prepending "www." don't think modern browsers more. so far, server not remotely involved. if you're large isp user (timewarner, comcast) , use dns it's possible isp intercept failed dns lookup , route request "helpful" search page (i.e. spam) of own. at point request still near server. i suppose mess /et...

php - Wordpress add_meta_box not re-positioning -

i have function in wordpress-php file this: add_meta_box('wp_function', 'event', 'wp_function', 'event', 'normal', 'default'); previously, this: add_meta_box('wp_function', 'event', 'wp_function', 'event', 'side', 'default'); however, when changed fifth parameter ($context) 'side' 'normal' doesn't re-position main wrapper. knows why? two possibilities: change "advanced" , see if moves it. if not... have ever dragged meta box around? if so, dragging customization override setting , wordpress remember wanted it. still change "advanced" , drag want it. (for new users or hasn't moved it, should appear in proper place.) let me know if helps.

codeigniter - jQuery table header plugin misbehaves sometimes -

i @ wit's end attempting troubleshoot bug , hope can provide idea next. situation. i programming dynamic site in php using codeigniter framework. have modified appearance of page heavily , incorporated jquery features. part of work-flow static version of page created can parse it, rather wrestle if php , mark-up both present. have validated, error-free page in static html works perfectly. however, when modify php page, jquery plugin keeping table header in static position not work. appearances, page should work. here checklist have gone through dozen times: jquery being called once. part of workflow static version streamlines code may come using work of others , different versions of jquery might have been available when plug-in created. jquery utilized non-working plug-in recent , 1 have elected run other jquery code have added. of other plugins called on older versions , running updated jquery source. jquery being called google api , loading other functions ...

javascript - Ajax Upload File: $_FILES is empty but files exists in request header -

i using formdata upload file when user drops files on page. works fine in client side , file details exist in request header when print_r($_files), returns empty array. no server side limit set. did test uploading file manually. request details : https://www.dropbox.com/s/tfta4ulqlxsaism/csz.png js code : $('html').live('drop', function(e) { try { e.stoppropagation(); e.preventdefault(); var files = e.originalevent.datatransfer.files || e.target.file || e.datatransfer.files; var file; var len = files.length; var =0; var formdata = new formdata(); ( ; < len; i++ ) { file = files[i]; if ( window.filereader ) { reader = new filereader(); reader.onloadend = function (e) { $('html').removeclass('hover'); }; ...

javascript - Meteor: Add class to one MongoDB element retrieved -

i have <ul> renders each element retrieved <li> want set 1 random result <li class="active"> when user enters site, render @ least 1 element, user must interact website render next or previous elements... no renders <li> said... if want add class "active" random list-item (and one), easiest solution me use jquery that. meteor.template.rendered = function() { var random = math.floor(math.random() * 1000); var $li = $("#mylist li"); $li.eq(random % $li.length).addclass("active"); }

c# - ServiceStack multiple implementations of same interface in Funq.Container -

in servicestack application, have funq configured inject session per request this: container.register<nhibernate.isessionfactory>(sessionfactoryfordb1); container.register<nhibernate.isession>(c => c.resolve<nhibernate.isessionfactory>() .opensession()) .reusedwithin(funq.reusescope.request); my service looks this, , works fine: public class mynhawareservice : service { public isession session { get; set; } public object any(dosomething request) { ... } } now, problem comes in when want add second nhibernate database mix own session factory: container.register<nhibernate.isessionfactory>(sessionfactoryfordb1); container.register<nhibernate.isession>(c => c.resolve<nhibernate.isessionfactory>() .opensession()) .reusedwithin(funq.reusescope.request); // add different session factory container.register<nhibernate.isessionfactory>(sessionfactoryfordb2); i've been experimenting variety of ways fun...

mysql - Why is PHP updating the data not selected? -

hi i'm trying update column in table. i've selected range within column, , used foreach loop through them. however, noticed not updated range selected, outside selection. advice appreciated! code: $this->db->where('weekday', 5); $this->db->where('source', 'site'); $record = $this->db->get('user', 200); $print_r($record->num_rows()); foreach ($record->result() $row) : $data = array( 'weekday' => 1, ); $this->db->where('user_id', $row->user_id); //added based on answer provided below $this->db->update('user', $data); endforeach; this indeed straightforward, , did print_r selected 200 rows.but code updated 3000 rows within table did not select in $record variable. how happen? thanks, update: many people tried , still failed track problem. pls think of way job done without using foreach? thanks, <?php // select * 'user' ...

osx - Python: first test program -

i have copied , pasted below code textwrangler file called "ex1.py" have saved desktop (mac) , directory called mystuff etc compiler can't seem find file..i've tried maybe 50 times... print "hello world!" print "hello again" print "i typing this." print "this fun." print 'yay! printing.' print "i'd rather 'not'." print 'i "said" not touch this.' i receive error 'no such file directory' when run "python ex1.py" (ex1.py name of test program). or when type "python" in terminal first current version info, type "python ex1.py" syntax error: invalid syntax. should create new directory 'mystuff' , navigate first when compiling terminal? (i thought didn't have compile python anyhow) please thanks. here specific error >>> python ex1.py file "<stdin>", line 1 python ex1.py ^ syntaxerror: invalid s...

iOS: Make the PDF view same size as the device width height -

Image
there grey colour in background , cannot make full size of pdf. there way make full screen of pdf? have detected orientation , made pdf size accordingly. edited: nsstring *path = [[nsbundle mainbundle] pathforresource:@"pdf2" oftype:@"pdf"]; nsurl *pdfurl = [nsurl fileurlwithpath:path]; pdfdocument = cgpdfdocumentcreatewithurl((__bridge cfurlref)pdfurl); totalpages = (int)cgpdfdocumentgetnumberofpages(pdfdocument); //modelarray holds page numbers modelarray = [[nsmutablearray alloc] init]; (int index = 1; index <= totalpages; index++) { [modelarray addobject:[nsstring stringwithformat:@"%i", index]]; } thepageviewcontroller = [[uipageviewcontroller alloc] initwithtransitionstyle:uipageviewcontrollertransitionstylepagecurl navigationorientation:uipageviewcontrollernavigationorientationhorizontal options:nil]; thepageviewcontroller.delegate = self...

Include xhtml page with ajax request in multi-level page template (JSF, Primefaces) -

i trying create application using jsf , primefaces. unfortunately, have issue page templates , not manage work out properly. i have page template this . want load left menu , content ajax request without loading whole page. however, when click page2 link, gets broken this . i tried different combinations of how place form, include, composition tags but, it's still same. change server response according place of form tag. when checked response seems alright. not try load whole page , nothing seems wrong me: <?xml version='1.0' encoding='utf-8'?> <partial-response id="j_id1"><changes><update id="javax.faces.viewroot"><![cdata[<script id="innerlayout_s" type="text/javascript">$(function(){primefaces.cw( "layout","widget_innerlayout",{id:"innerlayout",widgetvar:"widget_innerlayout",west:{paneselector:'#left',size:"200",resizable:f...

c - Can't use lseek to add a space at the end of a file -

i trying append text opened file. i'd append pid number @ end of file. example: lorem ipsum dolor sit amet orci aliquam. 14872 . code works fine except failing @ making program print space between last character of file , first digit of pid. i've tried use lseek() adding 1 offset end of file and, said, failed miseably. don't understand what's wrong, because apparently getting expected results: buffer size: 5. buffer content: 14872. current position: 41. and output: lorem ipsum dolor sit amet orci aliquam.14872 which makes no sense me. here code: void writeintheend(const int fd, const int pid, const int base) { char *buffer; int buffer_size = getcharsfromint(pid, base); printf("buffer size: %d.\n", buffer_size); buffer = (char *) malloc (sizeof(char) * buffer_size); sprintf(buffer, "%d", pid); printf("buffer content: %s.\n", buffer); //it should add space , write pid lseek(fd, 1, seek_end); ...

python - Passing args to nose.runmodule() -

i switched unittest nose able specify concurrent processing , xunit report generation. python file contains several test functions , nontest function test functions call during testing. know tests should automated point no arguments need passed in, when testing. however, want user able change defaults, if wishes. so, use argparse parse arguments. following sample of test script. haven't included several other test functions present in original file. from selenium import webdriver nose.tools import nottest nose.tools import assert_equals import nose import unittest import argparse import sys @nottest def open_browser(): browser = eval('webdriver.%s()'%browsertype) return browser def test_google_title(): browser = open_browser() browser.get("http://www.google.com") assert_equals("google", browser.title) browser.quit() def test_yahoo_title(): browser = open_browser() browser.get("http://www.yahoo.com") ...

android - java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation -

right app reports crash every single day , it's resulting in lot of uninstallers, don't like, i've looked everywhere , know it's wide spread problem , problem on google's side haven't been able real answers or solutions! pretty last chance because said, happens every single day! here's logcat: java.lang.runtimeexception: unable start activity componentinfo{com.simplistic.floating_equalizer/com.simplistic.floating_equalizer.mainactivity}: java.lang.unsupportedoperationexception: audioeffect: invalid parameter operation @ android.app.activitythread.performlaunchactivity(activitythread.java:2463) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2520) @ android.app.activitythread.access$600(activitythread.java:162) @ android.app.activitythread$h.handlemessage(activitythread.java:1366) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:158) @ android.app.activitythread.main(activitythread.java:5...

javascript - How to connect charts timeline with mysql and to show other info in a DIV -

here code: <?php $host="localhost"; //replace hostname $username="******"; //replace username $password="******"; //replace password $db_name="******"; //replace database $con=mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); $sql = "select ac,flt,start,end schedule"; //replace emp_info table name $result = mysql_query($sql) or die(mysql_error()); ?> <html> <head> <title>graphical display - skai</title> <!-- mobile devices android , iphone --> <meta content="true" name="handheldfriendly" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> <script type="text/javascript" src="http://www.google.com/jsapi"></script...

Pygame - smpeg does not find Python headers -

i've been trying install pygame days now, , dependency missing smpeg . following output: brew install --head smpeg ==> installing dependencies smpeg: gobject-introspection, gdk-pixbuf, ==> installing smpeg dependency: gobject-introspection ==> building source; bottle blocked python requirement ==> downloading http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/1.4 downloaded: /library/caches/homebrew/gobject-introspection-1.40.0.tar.xz ==> ./configure --prefix=/usr/local/cellar/gobject-introspection/1.40.0 checking python script directory... ${prefix}/lib/python2.7/site-packages checking python extension module directory... ${exec_prefix}/lib/python2.7/sitepackages checking headers required compile python extensions... ./configure: line 14647: /library/frameworks/python.framework/versions/2.7/resources/python.app/contents/macos/pytho n-config: no such file or directory not found configure: error: python headers not found i've tried brew...

JPA support for Java 8 new date and time API -

i'm using java 8 new project. i'm trying use new date , time api in java 8 don't know if jpa 2.1 supports new date , time api or not. please share experience/opinion in jpa`s supports new date , time api in java 8. can use new date , time api in java 8 safely jpa 2.1? update: i'm using hibernate (4.3.5.final) jpa implementation. jpa 2.1 spec came out before java 1.8, doesn't mandate support it. implementations may support java 1.8 features. have problems java 1.8 bytecode (e.g eclipselink). know datanucleus supports java.time , java 1.8 since that's 1 use. you'd have check implementation support level is. it has been requested jpa 2.2 support java.time types, see issue https://java.net/jira/browse/jpa_spec-63

cocos2d x - Errors during compilation libcocos2dcpp.so -

i working cocos2dx v2.2.2. while compiling library using "./build_native.sh" android. encountered following errors: ../android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/classes/wsnode.o: in function wsnode::connect(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):jni/../../classes/wsnode.cpp:106: error: undefined reference 'socketio::connect(socketio::siodelegate&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/classes/wsnode.o: in function wsnode::disconnect():jni/../../classes/wsnode.cpp:119: e...

objective c - How to set multiple Image Well? -

i new cocoa , wish set multiple image image well. here code snippet: //--------------show rank 1 image-------------// int rank1 = rank_fst5[0]; nsstring *rank1_path = [nsstring stringwithformat:@"/users/desktop/gallery/%d.png",rank1]; nsimage *image1 = [[nsimage alloc] initwithcontentsoffile:rank1_path]; [imagerank1 setimage:image1]; //--------------show rank 2 image-------------// int rank2 = rank_fst5[1]; nsstring *rank2_path = [nsstring stringwithformat:@"/users/desktop/gallery/%d.png",rank2]; nsimage *image2 = [[nsimage alloc] initwithcontentsoffile:rank2_path]; [imagerank2 setimage:image2]; the result shows first image in "imagerank1" . , if comment first show image code, can second 1 on show. 2 images cannot show concurrently. could me? thanks.

metaprogramming - Io's method scope -

how io's method scope work? when define: method(x, x + 1) what object slot x belong to? tried self , call , object without luck? for example in repl: slotnames is same as lobby slotnames in method: method(slotnames) is same as? what? thanks x stored in arguments list of message not slots. you can access arguments of current message via m := method(x, y, call message arguments) .

c# - LDAP Pass authentication to PrincipalContext when looking up groups -

i have following code works fine when machine member of domain , logged in, doesn't work when i'm using pc isn't on domain. know users username , password authenticate using pc.validatecredentials before hand. however, code doesn't work when pc they're using isn't member of domain. how pass in user credentials code? public list<string> getgroupnames(string username) { var pc = new principalcontext(contexttype.machine, "dcserver01"); var src = userprincipal.findbyidentity(pc, username).getgroups(pc); var result = new list<string>(); src.tolist().foreach(sr => result.add(sr.samaccountname)); return result; } the above code falls on over access denied on principal context thanks principalcontext provides constructor specifying username , password. msdn public list<string> getgroupnames(string username) { using (var pc = new principalcontext(contexttype.domain, "dcserver01", aut...

ruby on rails - Difference between "Redmine on Heroku" and "Installing Redmine" documentation -

my intention install redmine on heroku. on redmine.org, there 2 docs came across: http://www.redmine.org/projects/redmine/wiki/redmineinstall http://www.redmine.org/projects/redmine/wiki/howto_install_redmine_on_heroku . i know second doc self-explanatory in title want know if follow first doc's instructions, able still deploy redmine heroku. or better follow second doc's instructions? a noob @ this, feedback appreciated. in advance. ============== following heroku specific instructions (step 5), tried run rake generate_secret_token using ruby's cmd 'please configure config/database.yml first'. there 2 related files in 2 different locations. c:\users\\redmine\config , c:\users\\desktop\\redmine-2.5.1\config. database.yml use? config file on second path has database.yml.example. make change there , save 'database.yml'? or make change in first location, cd first location , run rake generate_secret_token? follow heroku-specific instruc...

scala - reproduce task dependencies in actual practise -

the sbt task documentation shows example of usage dependencies. simple, artificial works! reproduced in project/scala.build without problem. note choose global scope make tasks available project , configuration import sbt._ import keys._ object testbuild extends build { lazy val sampletask = taskkey[int]("a sample task") lazy val inttask = taskkey[int]("an int task") override lazy val settings = super.settings ++ seq( inttask := 1 + 2 , sampletask := inttask.value + 1 ) } now i'm trying useful , enrich existing sbt key definitions task collects compiled class names import sbt._ import keys._ import sbt.inc.analysis import xsbti.api.classlike import xsbt.api.discovery.{isconcrete, ispublic} object testbuild extends build { lazy val debugapis = taskkey[list[string]]("list of top-level definitions") override lazy val settings = super.settings ++ seq( debugapis := getalltop( compile.value ) ) private def geta...

php - MySql Select Result Having Combined Multiple Queries From Both the Same Table and Others -

i have table ('names') includes data related other data in other tables relying on ids. example: *names table id | name | predecessor | successor | house | birthplace ----------------------------------------------------------------- 10 bayezid ii 9 11 4 null 11 selim 10 12 4 5 12 suleiman 11 13 4 61 *houses table id | house -------------- 4 house of osman *places table id | place -------------- 5 amasya 61 trabzon what i'm trying accomplish construct query results in returning whole information depending on id, like: {"result":[{ "id":"11", "name":"selim i", "predecessor": "bayezid ii", "successor": "suleiman", "house":"house of osman", "birthplace":"amasya" }]} so, name...

ios - Speed up summing components in a vector -

i create array array summing components in blocks of four, e.g.: float invector[256]; float outvector[64]; for(int i=0; i<64; i++){ for(int j=0; j<4; j++){ int k = 4*i + j; outvector[i] += invector[k]; } } i accelerate this. have looked in available libraries in ios vdsp , vforce, haven't found fits. closest candidate has been vdsp_vswsum, doesn't want. have tip how speed up? you're trying decimate vector. vdsp_sve n=4 speed inner loop. if want average of 4 values, vdsp_mean.

file - Ordered os.listdir() in python -

this question has answer here: does python have built in function string natural sort? 12 answers how add files list order in directory have following files: slide1.xml, slide2.xml, slide3.xml ... slide13.xml os.listdir(path) doesn't return me list order i've tried way files_list = [x x in sorted(os.listdir(path+"/slides/")) if os.path.isfile(path+"/slides/"+x)] output: ['slide1.xml', 'slide10.xml', 'slide11.xml', 'slide12.xml', 'slide13.xml', 'slide2.xml', 'slide3.xml', 'slide3_copy.xml', 'slide4.xml', 'slide5.xml', 'slide6.xml', 'slide7.xml', 'slide8.xml', 'slide9.xml'] sort key: import re files = ['slide1.xml', 'slide10.xml', 'slide11.xml', 'slide12.xml', 'slide13.xml...

Java - Freeze Mouse -

is there way lock mouse in 1 position in java amount of time? i've tried this: while(timer == true){ robot bot = new robot(); bot.mousemove(x, y); } but when user moves mouse jumps unpleasantly , forth (from position user dragging position it's supposed locked). any ideas if there better way this? or can disable user input mouse? in advance! this far can go (at least standard libraries). mouse "jumps" system dependent, on "sampling rate" of listener. i'm not aware of jvm parameter affecting it, wouldn't surprised if there in spirit. jumps in opposite relation mouse acceleration (the mouse can move "long" distance between samples). public class stop extends jframe { static robot robot = null; static rectangle bounds = new rectangle(300, 300, 300, 300); static int lastx = 450; static int lasty = 450; stop() { try { robot = new robot(); } catch (awtexception e) { ...

atlassian - How to delete a specific Status type in JIRA -

i created new status type in jira status. let's call new status "merged." in addition standard status jira provides, "to do", "in progress", "done" etc. however, we've decided not use it. items tagged "merged" have since been moved "done". how delete "merged" status option in jira nobody accidentally tags items , not appear in jql queries? this explained in defining status field values , see deleting status : the view statuses page can used edit , delete statuses. please note statuses (i.e. statuses not used in workflow ) can deleted. a delete link deleting status appear next edit link of inactive status as outlined, need ensure no workflow using status want delete, can see statuses in workflow designer how achieve this: remove status – via properties panel. removes status workflow, not jira instance. once removed status in question workflows, can remove jir...

android - In JUnit, test Activity if it did received the Extra from Intent -

someactivity below: intent intent = new intent(someactivity.this, anotheractivity.class); intent.putextra("id", someid); startactivity(intent); in junit test anotheractivity if did received intent. how do this? have tried using setactivityintent though? try below code figure out. intent intent = new intent(); intent.setclassname("com.app", "com.app.hello"); intent.putextra("id", "1234"); setactivityintent(addevent);

how to automate a mouse click in python -

i know how write program click on button on website page have not created. i keen noob python can program extent in lb need know native python commands getting to/opening web page , locating buttons on page , automatically left clicking them. in python 2 or 3 version please use webbrowser.open() open website: >>> import webbrowser >>> webbrowser.open('www.google.com') #opens www.google.com true >>> then use following code click: (this works on python2.6 on osx) import time quartz.coregraphics import cgeventcreatemouseevent quartz.coregraphics import cgeventpost quartz.coregraphics import kcgeventmousemoved quartz.coregraphics import kcgeventleftmousedown quartz.coregraphics import kcgeventleftmousedown quartz.coregraphics import kcgeventleftmouseup quartz.coregraphics import kcgmousebuttonleft quartz.coregraphics import kcghideventtap def mouseevent(type, posx, posy): theevent = cgeventcreatemouseevent(none, type, (po...

c# - Send post data with file upload AJAX -

i sending file via ajax this: var fd = new formdata(); //do stuff adds files var xhr = new xmlhttprequest(); xhr.open('post', '/upload/' + id); xhr.send(fd); and using file in contoller like: httppostedfilebase file = request.files[i]; this works fine want send more information. how can post more variables along file? use variable name in xhr.send() . xhr.send(var1=fd&var2=anotherdata) . @ server side create 2 post data handlers, namely var1 & var2 . 1 hold fd , other hold data.

oop - How to import database connection class in another class in php -

i going import databaseconnector class in controller class. databaseconnector class contains database connection queries. both classes different php file. here code. databaseconnector: class databaseconnector { public $con; //function getting connected database public function getconnection() { $con=mysqli_connect("localhost","root","","abcd"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } return $con; } public function closeconnection() { mysqli_close($con); } } controller: include "database_connector.php"; $dc = new databaseconnector(); $con = $dc->getconnection(); class controller { public function __construct(){ } public function insertdata() { $name = "abcde"; $sql = "insert user_details values(...

javascript - Which part of this websocket result is the binary protobuf data? -

Image
i receiving protobuf data remote host on websocket. know how decode protobuf in js using protobuf.js cannot determine part of result coming through websocket in fact protobuf data need decode. attempting decode entire result gives me js error: cannot wrap null or non-object if log console object returned websocket, looks this: i've tried decoding various things e.data (where e total result returned) not sure if i'm going right way. what part of holds actual protobuf content? yes, data in .data , , appears represented blob . working blobs in javascript not trivial. object that, need javascript protobuf implementation accepts blob , returns deserialized object.

php - linking and sending form values to mysql database? -

my html code: <form action="send_post.php" method="post"> <input type="submit" value="login" /> </form> php code: <?php $con = mysqli_connect("","",""); if (!$con) { die('could not connect: ' . mysql_error()); } else { // echo('connected mysql'); } @mysql_select_db("a", $con);// connect database db_name if (isset($_post['submit'])) { $email=$_post['email']; $pass=$_post['pass']; $sql_query="insert formdata (email, pass) values('$email', '$pass')";} ?> database name: mysql table name: formdata why not working? in second line used 'local host' first receiving error removed it. you use mysqli_ api connect database , test errors , try select database mysql_ api. pick 1 , stick it. (don't pick mysql_ deprecated). you run form handling code if there submit data item in submit...

vba - Hyperlinked text in Word footers to a selected bookmark -

i wanted custom footer in documents hyperlinked text bookmark in same document. i.e. 'top of document' kind of link in footers. had collect information on places achieve much. , wanted share here others not have fight thing @ once. so far question & suggestions stackoverflow , other sites, have achieved much- created macro create bookmark automatically, of selected text in document. bookmark re-created (delete , create) if present macro add new footer page number , text delimiter (i.e. / hit overview). now want create text in footer hyperlink bookmark. code simple. guess doing wrong, tried creating hyperlink object. not working. please suggest something. here macro function- sub insertfootnote() const wdalignpagenumbercenter = 1 dim varnumberpages variant varnumberpages = activedocument.content.information(wdactiveendadjustedpagenumber) ' delete bookmark if name if activedocument.bookmarks.exists("h...