Posts

Showing posts from February, 2010

c# - Use DataTable.Load() without creating all column properties -

i'm loading data sql server database this: sqlcommand cmd = new sqlcommand("select * x", conn); cmd.commandtype = commandtype.text; datatable dt = new datatable(); sqldatareader rd = cmd.executereader(); dt.load(rd, loadoption.preservechanges); issue: the load() function initializes table columns columnname , datatype , looks deeper database, , adds constraints allowdbnull , autoincrement , maxlength , etc. however, leads problems in application, because want further process data internally. so, possible load() setting basic properties (which come directly select statement), without setting allowdbnull , maxlength , , on? or need clean these values after load() ? or there alternative calling load() ? if don't want behaviour don't use datatable.load dbdataadapter.fill(datatable) : datatable dt = new datatable(); using(var da = new sqldataadapter("select * x", conn)) da.fill(dt); the fill operation adds rows des

javascript - How to change text in this case using ng-if or other expression? -

i'm trying change text in title tag based on tag 's direction value: <li ng-repeat="t in tags"> <div class="tag" ng-class="{'green-up': t.direction == 'positive', 'red-down': t.direction == 'negative', '' : t.direction == 'stagnant'}" title="percentage increase" ng-if="">{{t.name}}</div> </li> the direction either positive , negative or stagnant , should correspond title="percentage increase" title="percentage decrease" or title="percentage" what angular syntax best used in case? why not set tag settings object $scope.taginfo = { positive:{ class:"green-up", title:"percentage increase" }, negative:{ class:"red-down", title:"percentage decrease" } } and call

html5 - Javascript Object print object value -

i'm trying value object , prit on screen no success... http://jsfiddle.net/lbascg4v/5/ app.js // funĂ§Ă£o construtora function keydown(e) { this.faq = e.keycode; alert(e.keycode) } // prototype com os mĂ©todos keydown.prototype = { printr: function() { alert(this.faq); } } window.addeventlistener('keydown', keydown, true); index.html <canvas id="canvas" width="300" height="300" style="border: 1px solid red"></canvas> <script> teste = new keydown(); teste.print(); </script> when push key on canvas, want value of key , put in object, want print object , value. the real answer question you don't need prototyping : function keydown(){ // initialize properties this.faq = 0; this.update = function(e){ // set faq this.faq = e.keycode; } this.print = function(){ // alert faq alert(this.faq); } } and then: window. test = ne

why do we use 'pass' in error handling of python? -

it conventional use pass statement in python following piece of code. try: os.makedirs(dir) except oserror: pass so, 'pass' bascially not here. in case, why still put few codes in program? confused. many time , attention. it's parser. if wrote this: try: # code except error: and put nothing in except spot, parser signal error because incorrectly identify next indentation level. imagine code: def f(x): try: # except error: def g(x): # more code the parser expecting statement greater indentation except statement got new top-level definition. pass filler satisfy parser.

javascript - Web Worker - How to reference worker file when packaged with Bower -

i'm writing small javascript text expansion library. library use web worker , packaged bower. when installed via bower parser script not found (i 404) because browser looking relative root of consuming site , not relative bower script being consumed (both scripts contained in same folder). appears correct behavior . my question: how should workers used in combination bower such required scripts can loaded without hard-coding bower_components/ path? function expander(args) { ... this.parser = 'parser.js'; this.worker = new worker(this.parser); ... } i use grunt. gulp might bit easier starting out since can debugged missing key component needs. there set of libraries wiredep, build-file , watch enable wanting do. wiredep watches bower directory , automatically add js files dependencies in bower.json html , watch can configured watch type of file in directory change. build-file enables configure template , pass variables use dynamically build j

How to configure RESTEasy to use the Jackson afterburner module -

with large payloads, seeing when json converted pojo, taking lot of time. internally uses jackson. wondering if there way can configure resteasy use afterburner module seems better performace. you can configure objectmapper used. 1 way can done through contextresolver , see here . register module objectmapper (as seen in documentation ).

mysql - Can Sphinx match against terms or phrases that are similar to the provided search params? -

i've got mysql free-text search , running in rails app. if search 'regular guitar cable' 'guitar' , 'cable', want. now i've installed sphinx , thinking-sphinx gem, , i've found search 'regular guitar cable' doesn't return results @ all. what's worse if search 'guitars' nothing! instead i'm finding have search 'guitar' instead i.e. need enter exact term. this problematic because few of users search 'guitar' , instead it's more search 'red guitar' or 'cheap guitar' , need sphinx bit smarter. how can make want without having add every single adjective in english dictionary stop-word file the following resolved problem! product.search "\"#{search_text}\"/1" the /1 @ end makes work, , it's called quorum operator .

menu - Go to line in python? -

i typing python menu , wondering if there way make program return place. instance: print 'choose: ' = raw_input (' apple[a], grape[g], quit[q] ') if a=='a': print 'apple' elif a=='g': print 'grape' elif a=='q': print 'quit' print 'are sure?' print 'yes[y], no[n]' b=raw_input ('choose: ') if b=='y': quit() elif b=='n': print 'returning menu' in part is: `b=raw_input ('choose: ') if b=='y': quit() elif b=='n': print 'returning menu'` how return first apple\grape menu? there way user doesn't have quit , instead return main menu? i either use function recursively or while loop. since there while loop solutions, recursive solution be: from sys import exit def menu(): = raw_input("choose: apple[a], grape[g], quit[q] ") if == 'a'

Pretty print Python Lists -

Image
i have written cli utility in python , have list 1:m list-items of paths like: i want display list in more readable manner like: [ (1, '/path/here'), ('path/here/again'), (2, 'a/different/path/here'), ('another/path/here') ] or in table-like format (e.g.): 1 /path/here path/here/again 2 a/different/path/here another/path/here note, list have 20 or more list-items. thanks! to start: >>> mylist = [ ... (1, '/path/here', 'path/here/again'), ... (2, 'a/different/path/here', 'another/path/here') ... ] play join() , map() , , str() , along python 3's nice print() function: >>> print(*('\t'.join(map(str, item)) item in mylist), sep='\n') 1 /path/here path/here/again 2 a/different/path/here another/path/here or try string formatting instead of join() , map() : >>> print(*(str(col) + '\t' + (len

R ggvis font and parameters of interactive text in scatter plot (hover) -

Image
i know if there way modify characteristics of text shown on "hover" using ggvis . i have created scatter plot based on template found on internet , modified needs. the script follows: library(shiny) library(ggvis) mydata <- data mydata$id <- 1:nrow(mydata) # add id column use ask key all_values <- function(x) { if(is.null(x)) return(null) row <- mydata[mydata$id == x$id, ] paste0( names(row), ": ", format(row), collapse = "\n" ) } # factor location mydata %>% ggvis(~a, ~b, key := ~id) %>% layer_points(fill = ~factor(location)) %>% scale_numeric("x", trans = "log", expand=0) %>% scale_numeric("y", trans = "log", expand=0) %>% add_axis("x", title = "blabla1") %>% add_axis("y", title = "blabla2") %>% add_tooltip(all_values, "hover") what know how format text shown interactively on scatte

jquery - Passing/Accessing values from separate thread in javascript -

i trying use following code had found/edited in post. use function "isvalidimageurl()" instantly return result on fly. since function runs in separate thread, had trouble getting value, example, if had "return true;" in place of "isvalid=true;" "undefined" in return. tried use global variable "isvalid", seem 1 step behind, meaning need call function twice, result first call. what fundamentally missing? or able suggest method can it? thank you! <script> var isvalid; function isvalidimageurl(url) { $("<img>", { src: url, error: function() { isvalid=false; }, load: function() { isvalid=true; } }); } isvalidimageurl("https://www.google.com/logos/2012/hertz-2011-hp.gif"); alert(isvalid); isvalidimageurl("http://google.com"); alert(isvalid); </script> the

php - How to set expected exception in PHPUnit for incorrect file path in fopen()? -

i know how set expected exception while unit testing using phpunit's setexpectedexception() method and/or equivalent annotation. but reason i'm not able same while testing logic around fopen() here example: class abstractfilereadertest extends \phpunit_framework_testcase { public function test_invalidfileexception() { $filepath = 'incorrect/file/path.csv'; $this->setexpectedexception(\exception::class); fopen($filepath, "r"); } } for unit test on file system it's better use vfsstream vfsstream stream wrapper virtual file system , tests it's cleaner solution write there real file system.

delphi - query execution : warn user if multiple records are to be deleted -

how warn user (with confirmation dialog) query execute delete more 1 record ? 'delete from...where...' can encompass 1 or more records wondering how warn user going delete more 1 record. it sounds you're asking how prompt user... case messagedlg('are sure wish delete multiple records?', mtwarning, [mbyes, mbno], 0) of mryes: begin //continue dowhatneedstobedonetodeletemultiplerecords; end; mrno: begin //don't continue end; end; for example, may do... if adoquery1.recordcount > 1 begin prompttodeletemultiplerecords; end; so sum up, code might like... if adoquery1.recordcount > 1 begin case messagedlg('are sure wish delete multiple records?', mtwarning, [mbyes, mbno], 0) of mryes: begin //continue dowhateverneedstobedonetodeletemultiplerecords; end; mrno: begin //don't continue end; end; end;

Mule AMQP connector: Value is not facet-valid with respect to enumeration -

i'm trying read property configuration file (.properties) in mule seems not take value it. these configuration , properties files: dev.properties file amqp.host=localhost amqp.port=5672 amqp.username=guest amqp.password=guest amqp.ackmode=manual amqp.prefetchcount=1 xml configuration file <context:property-placeholder location="dev.properties"/> <amqp:connector name="amqplocalhostconnector" host="${amqp.host}" port="${amqp.port}" username="${amqp.username}" password="${amqp.password}" ackmode="${amqp.ackmode}" prefetchcount="${amqp.prefetchcount}" /> when execute application, throws following error: error 2015-06-29 12:04:33,540 [main] org.mule.module.launcher.application.defaultmuleapplication: null org.xml.sax.saxparseexception: cvc-enumeration-valid: value '${amqp.ackmode}' not facet-valid respect enumeration '[amqp_auto, mule_au

actionscript 3 - AS3 Access MovieClip on Stage? -

i have movie clip added timeline frame 1 , trying figure out how can access it, have button when press want restart movie clip frame 1 , play. i exposed actionscript class of mymovie. i can create new instance of going var mymovie:movieclip = new mymovie(); but want access 1 added timeline frame, not create new one. can run .gotoandplay(1) on movie clip restart it. just create variable reference object when creating code, in example: var mymovie:movieclip = new mymovie(); you need same thing movieclip dragged on time line during authoring time. this select mc open properties panel/properties inspector panel (whatever it's called nowadays) specify instance name that's pretty equivalent creating variable on timeline. that's because flash automatically declares instance names of objects variables on timeline place them on. can disabled in actionscript settings, enabled default. when specified instance name in properties, can work if variable (

How to incorporate WordPress automatic updates with Git as version control? -

i trying find solution difficult task: properly version controlling wordpress , when working automatic updates. wordpress allows lot of simplicity allowing users update wordpress core files, themes , plugins clicking button. happens when have website under version control git? click "update now" button, our git repo out of sync , therefore defeats purpose of creating git repo in first place. i have been looking ways around issue , able find different ways structure wordpress installation breaking components git submodules. 1 of popular example wordpress-skeleton template. although works version control each module / component of wordpress, still not allow user able use automatic updates button within wordpress, update files in production not commit changes git repo. in ideal world, should able version control files in 1 repository , when click "update now" button, should update our git repo modifications automatically. know how can accomplished? one o

java - How could I do this better to maximise performance and efficiency (for loop) -

i have these nested loops, there way make more efficient? i want every combination of numbers. e.g. 2, 290, 29091993..etc combinations string arraylist. int[] combo = new int[]{2, 9, 0, 9, 1, 9, 9, 3}; (int = 0; < combo.length; i++) { combinations.add(combo[i] + ""); (int x = 0; x < combo.length; x++) { combinations.add(combo[i] + "" + combo[x]); (int y = 0; y < combo.length; y++) { combinations.add(combo[i] + "" + combo[x] + "" + combo[y]); (int z = 0; z < combo.length; z++) { combinations.add(combo[i] + "" + combo[x] + "" + combo[y] + "" + combo[z]); (int z1 = 0; z1 < combo.length; z1++) { combinations.add(combo[i] + "" + combo[x] + "" + combo[y] + "" + combo[z] + "" + combo[z1]); (int z2 = 0; z2 < combo.length; z2++) {

javascript - How to make a AJAX request to a Desktop version of a site via the Mobile version -

the mobile site i'm working on different desktop version. need make ajax call via mobile site bring in data desktop version. seems ajax call make request on calling version of site. this code returns mobile site data when called on mobile site: $.ajax({ type: "get", url: window.location.href, success: function(data) { var response = $(data); //returns mobile site data } }); is there way force request use desktop version? you're making ajax request the current url : url: window.location.href this highly unconventional. more point, browser doesn't know or care difference between "desktop" , "mobile". makes requests , displays responses. if current url doesn't handle ajax request you'll need make request url does: url: 'somespecificurl' to make easier , consistent through diff

sencha touch: real time chart -

i using sencha touch show chart , add data store of chart dynamically.but when add data store, chart not update result. code of chart: ext.define('myapp.view.mylinechart1', { extend: 'ext.chart.cartesianchart', requires: [ 'ext.chart.axis.category', 'ext.chart.axis.numeric', 'ext.chart.series.line' ], config: { itemid: 'xy', store: 'mystore', colors: [ '#115fa6', '#94ae0a', '#a61120', '#ff8809', '#ffd13e', '#a61187', '#24ad9a', '#7c7474', '#a66111' ], axes: [ { type: 'category', fields: [ 'x' ], maximum: 5, minimum: 0 }, { type: 'numeric', fields: [ 'y' ], g

java - error: bad operand types for binary operator '&&' -

not sure wrong here line wrong. if((board[z][i] = 1) && (board[z][i++] = 1) && (board[z++][i] = 1)){ here whole code not finished: public class solution { static void nextmove(int player, int [][] board){ } public static void main(string[] args) { scanner in = new scanner(system.in); int player; int board[][] = new int[8][8]; //if player 1, i'm first player. //if player 2, i'm second player. player = in.nextint(); //read board now. board 8x8 array filled 1 or 0. for(int z = 0; z < 8; z++){ for(int = 0; < 8; i++) { board[(z)][(i)] = in.nextint(); } }for(int z = 0; z < 8; z++){ for(int = 0; < 8; i++) { if((board[z][i] = 1) && (board[z][i++] = 1) && (board[z++][i] = 1)){ system.out.print(z + " " + i); } } } nextmove(player,board); } } you need use relational operator == instead of =. each of

How to view the roles and permissions granted to any database user in Azure SQL server instance? -

could guide me on how view current roles/permissions granted database user in azure sql database or in general mssql server instance? i have below query: select r.name role_principal_name, m.name member_principal_name sys.database_role_members rm join sys.database_principals r on rm.role_principal_id = r.principal_id join sys.database_principals m on rm.member_principal_id = m.principal_id r.name in ('loginmanager', 'dbmanager'); i further need know permissions granted these roles "loginmanager" , "dbmanager"? could me on this? thank sk per msdn documentation sys.database_permissions , query lists permissions explicitly granted or denied principals in database you're connected to: select pr.principal_id, pr.name, pr.type_desc, pr.authentication_type_desc, pe.state_desc, pe.permission_name sys.database_principals pr join sys.database_permissions pe on pe.grantee_principal_id = pr.principal_id; per ma

c# - Mapping Error In Linq to Lucene.Net -

i have following document specs use in linq lucene public class doc1 { public doc1() { docs = new list<doc2>(); } private ilist<doc2> docs{get;set;} } public class doc2 { //whatever } the problem when try use this var provider = new lucenedataprovider(directory, version.lucene_30); using (var session = provider.opensession<doc1>()) { var m = new doc1(); session.add(m); } the problem when execute code, following error property event of type system.collections.generic.ilist`1[doc1] cannot converted system.string please there way of doing this thanks in advance here goes full stack trace [notsupportedexception: property event of type system.collections.generic.ilist`1[doc2] cannot converted system.string] lucene.net.linq.mapping.fieldmappinginfobuilder.getconverter(propertyinfo p, type type, fieldattribute metadata) +487 lucene.net.linq.mapping.fieldmappinginfobuilder.buildprimitive(propertyinfo p, ty

html - Getting error while trying to load HDFS with tweeter data -

i getting below error though have given correct keys , token. trying load data tweeter hdfs.... have entered correct key , tokens(i canot share key , token here,but assure correct). please me in understanding: 15/06/29 21:39:53 info twitter4j.twitterstreamimpl:401:authentication credentials ( https://dev.twitter.com/docs/auth ) missing or incorrect. ensure have set valid consumer key/secret, access token/secret, , system clock in sync. <html>\n<head>\n<meta http-equiv="content-type" content="text/html; charset=utf-8"/>\n<title>error 401 unauthorized</title> </head> <h2>http error: 401</h2> <p>problem accessing '/1/statuses/filter.json'. reason: <pre> unauthorized</pre> it happening due clock out of sync: solved when ran below command: sudo ntpdate ntp.ubuntu.com

android - Swipe view with different actionbars -

Image
currently have action bars each fragment, when swipe fragment new actionbar appears in place of old one. want when swipe, want swipe away actionbar , place new one. each fragment should have own actionbar. i'm not sure if making complete sense drew quick demonstration of i'm trying do. in viewpager container (activity or fragment), add next line in page change listener: invalidateoptionsmenu(); supportinvalidateoptionsmenu();//if using actionbar support library getactivity().invalidateoptionsmenu();//if viewpager container fragment then in oncreateoptionsmenu() , @override public void oncreateoptionsmenu(menu menu, menuinflater inflater) { super.oncreateoptionsmenu(menu, inflater); inflater.inflate(r.menu.your_menu_layout, menu); } the onprepareoptionsmenu() callback method called before menu shown, , going use make menu items visible depending on current fragment: @override public boolean onprepareoptionsmenu(menu menu) { super.onprepare

c# - How to dynamically fill a row in a DataTable? -

datatable exporttable = new datatable(); exporttable.columns.add("place", typeof(string)); exporttable.columns.add("day", typeof(string)); foreach (var time in timelist) { exporttable.columns.add(time, typeof(string)); } exporttable.rows.add("new york", 1/1/2015, ?, ?, ?, ...); how can dynamically fill row in datatable? here's 1 way: datatable itemtable = new datatable("mytable"); itemtable.columns.add("id" , typeof(int )); itemtable.columns.add("parentid", typeof(int )); itemtable.columns.add("name" , typeof(string)); // add test data itemtable.rows.add(new object[] { 0,-1, "bill gates" }); itemtable.rows.add(new object[] { 1, 0, "steve ballmer" }); itemtable.rows.add(new object[] { 3, 1, "mary smith" }); itemtable.rows.add(new object[] { 2, 0, "paul allen" }); itemtable.rows.add(new ob

php - Mod_Rewrite not rewriting URLs -

i've got following url structure: /page.php?file=about /page.php?file=contact etc .htaccess file has following code: rewriteengine on rewriterule ^([^/]*)\.html$ /page.php?file=$1 [l] does not try rewrite urls @ all. i'm looking /about.html, /contact.html is .htaccess code or kind of settings on server? you can use: rewriteengine on rewritecond %{the_request} /page\.php\?file=([^\s&]+) [nc] rewriterule ^ /%1.html? [r=302,l,ne] rewriterule ^([^/]+)\.html$ page.php?file=$1 [l,qsa,nc]

jquery clone cannot create duplicate element -

i using shapeshift plugin in order create user interface allows images dropped container another. child container allows images dropped parent container. when images being dragged parent container child container want create duplicate ( dragclone set true) in parent container because not want lose information on container. way can drag same image parent container child container multiple times , generate copies. however, issue these images have hover listener attached them. not want lose hover listener when shapeshift clone created. therefore, analyzed shapeshift code , found this: if (drag_clone) { $clone = $selected.clone(false, false).insertbefore($selected).addclass(clone_class); } and changed following: if (drag_clone) { //changed clone type add data , events $clone = $selected.clone(true, false).insertbefore($selected).addclass(clone_class); } this works fine, clone created , hover listener works both on clone (which kept on parent container) , origina

javascript - Random Generator to create custom URL variables -

i trying generate custom url appended variables randomly generated. example: http://example.com/page1234.jsp?id=location_id&user=user_name&pass=password i'm fine of variable data being numeric, , have been trying use generate random numbers: <p>click button join.</p> <button onclick="genid5()">join</button> <p id="generateid1"></p><p id="generateid2"></p><p id="generateid3"></p> <script> function genida() { var x = math.floor((math.random() * 1000000000000) + 101); document.getelementbyid("generateid1").innerhtml = x; console.log(x); } function genidb() { var y = math.floor((math.random() * 1000000000000) + 101); document.getelementbyid("generateid2").innerhtml = y; console.log(y); } function genidc() { var z = math.floor((math.random() * 1000000000000) + 101); document.getelementbyid("gene

php - json_encode(): Invalid UTF-8 sequence in argument -

i cannot of following code work statements array working with. if (!$allowed) { $output = array('success'=>false, 'message'=>'insufficient user access', 'args'=>$_post); } else { $output = isset($_post['data']) ? $output = call_user_func(array($controller, $_post['request']), $_post['data']) : call_user_func(array($controller, $_post['request'])); } echo $output = $output ? json_encode($output) : json_encode(false); this last statement generating error. have tried mb_chekc_encloding , iconv. cannot either of these statements work making $output show.

ios - how to give Page View Controller a "Cover Vertical" transition style -

with navigation view controller, can give "cover vertical" transition style animation. however, having trouble replicating page view controller. options given in story board "scroll" , "page curl". there way programmatically? it looks little bit tricky should work : create uiviewcontroller container controller. add uipagecontrol ever want. programmatically add uinavigationviewcontroller child of container , add view view hierarchy. can use instantiateviewcontrollerwithidentifier: of main storyboard , don't forget set constraints if you're using autolayout. use delegate between container , uinavigationviewcontroller or parentviewcontroller property of uinavigationviewcontroller change uipagecontrol when user navigates in uinavigationviewcontroller. uipageviewcontroller 1 single thing. of time prefer using custom container controller rather using it.

java - input a number on scanner -

i trying create simple java program user should input age. if user entered example letter instead of number, message. in addition message user should asked input , input checked again see if number. can know how can achieve that? system.out.println("2 - set age"); scanner b = new scanner(system.in); if (b.hasnextdouble()) { double lage = b.nextdouble(); setage(lage); addemployeemenu(); } else { system.out.println("you should type numbers!"); } you can use while loop scanner b = new scanner(system.in); double lage; while (true) { system.out.println("2 - set age"); if(b.hasnextdouble()){ lage = b.nextdouble(); break; }else b.nextline(); } the point is, number , check inside while loop, repeat long input not correct

vb.net - Google Drive Rest: convert does not work -

i using g drive rest endpoints (not .net client) upload docx files through vb .net. problem if declare query parameter "convert" true, files getting uploaded never auto-convert. first thing create new file post , after upload content put in upload uri in separate request. it not work when use google playground upload docx files. public shared function uploadstream(filestream io.stream, filename string, mimetype string, target string, accesstoken string, optional converttogdoc boolean = false) string try dim subject string = "" dim doc new aspose.words.document dim docformat = aspose.words.fileformatutil.detectfileformat(filestream) ' detect format of file 'check if file doc or docx if docformat.loadformat = aspose.words.loadformat.doc or docformat.loadformat = aspose.words.loadformat.docx 'check if file word document doc = new aspose.words.document(filestream) subject = doc.built

xml - How to use XSL 1.0 to Group Elements by Content -

so need group content using xsl 1.0. in specific use case, need convert following: <elementfoo name='1'> <bar>groupa</bar> </elementfoo> <elementfoo name='2'> <bar>groupb</bar> </elementfoo> <elementfoo name='3'> <bar>groupc></bar> </elementfoo> <elementfoo name='4'> <bar>groupa</bar> </elementfoo> <elementfoo name='5'> <bar>groupa</bar> </elementfoo> <elementfoo name='6'> <bar>groupc></bar> </elementfoo> and need output this: group a: foo 1 foo 4 foo 5 group b: foo 2 group c: foo 3 foo 6 basically, need order things according content in specific child element, i'm not entirely sure how without bunch of if statements. there can large number of groups, , number of groups not known. the following xsl should group foo's requ

Error creating a custom cartridge application in OpenShift -

i'm trying create custom cartridge application on openshift using command rhc -d create-app liferay htt.... . error raised don't know find more specific information. error mean , how fix it? creating application 'liferay' ... debug: creating application 'liferay' these options - {:cartridges=>[#<rhc::rest::cartridge:0x007ff8f9354e00 @attributes={"url"=>"http...", "messages"=>[]}, @client=nil>]} debug: adding application liferay domain 546b3528ecb8d480bb000012 debug: using token authentication debug: request post https:...openshift.redhat.com/broker/rest/domain/catapp/applications debug: code 500 267521 ms unable complete requested operation due to: invalid exit code (1) returned server ex-std-node192.prod.rhcloud.com. indicates unexpected problem during execution of request. reference id: 4f4141b703879dd93b88b271f553ec1b try enabling http_debug : http_debug=1 rhc -d create-app liferay htt....

java - How to use external Jars in javafxports-Application -

i write javafx andoid application in netbeans javafxports , gradle. added dependencies gradel, dont know how add jars project or use in app-code. . . do know how can it? tried searching www hours ... ok tried dont ... i did said netbeans still says: package io.netty.bootstrap not exist i created folder unter src/android/ called libs , add jar there ... here dependencies: dependencies { compile filetree(dir: 'src/android/libs', include: ['*.jar']) compile files('src/android/libs/netty-all-4.0.29.final.jar') } final solution: you have add: compile 'io.netty:netty-all:4.0.24.final' build.gradle file. (example netty jar-libary) i copy libary (netty) folder called "libs" in main folder not in sry , on. create folder if not exist write code , see, import works. thank josé pereda time , final solution! based on edited question, these few suggestions working dependencies on javafxports project. dependenci

How to use Facebook Login in a Meteor App -

i'm trying create custom login using facebook , looking 2 endpoints: "name" , "avatar". for starters don't know if "avatar" real endpoint name that's i'm trying access. i have created test app on fb, have installed of meteor packages need groundwork done. i've create following template: <template name="login"> <h2>login</h2> {{#if currentuser}} {{currentuser.services.facebook.name}} {{currentuser.services.facebook.avatar}} <button id="logout">logout</button> {{else}} <button id="facebook-login" class="btn btn-default">login facebook</button> {{/if}} </template> and in servers directory have create .js file store api keys. my questions: my first question find names of these endpoints i've been going entire documentation on fb , nothing references "name" or "avatar"

php - The app forced to close when trying to upload picture to server -

i have copied example website , dont know why not working. my intended flow is: picking picture gallery, showing inside imageview , uploading server. the first 2 step -picking picture , showing it- working fine when click on upload button app forcing close i.e runtime error. think there may problem php file, way use not sure. you may ask more info if required solve problem. package com.example.imagepickanduplaod; public class mainactivity extends activity { private imageview image; private button uploadbutton; private bitmap bitmap; private button selectimagebutton; // number of images select private static final int pick_image = 1; /** * called when activity first created */ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // find views image = (imageview) findviewbyid(r.id.uploadimage); uploadb

print statements in dart-polymer UI not seen in webstorm console -

i have print statements in dart ui app. depending on ui selection strings printed console. used work expected with dart eclipse plugin. cannot see print output console in dart-polymer app. any possible appreciated. edit 1 .dart import 'dart:html'; import 'package:paper_elements/paper_input.dart'; import 'package:polymer/polymer.dart'; /// polymer `<main-app>` element. @customtag('main-app') class mainapp extends polymerelement { @observable string reversed = ''; /// constructor used create instance of mainapp. mainapp.created() : super.created(); void reversetext(event event, object object, paperinput target) { reversed = target.value.split('').reversed.join(''); print(reversed); // nothing shown in console } .html <!-- import polymer-element's definition --> <link rel="import" href="../../packages/polymer/polymer.html"> <link rel="import"

java - Android loaders vs Handlers -

the loaders in asynchronously getting data data source. can achieve same effect using handlers , can kick off thread or execute executor , can fetch data in thread. once data fetched, can update ui using ui handler message mechanism. why go coding complex loaders when can achieve same using handlers . loaders introduced make easier in implementing correct data loading on android platform. means: doing heavy stuff on background thread safely introducing loaded data in ui caching of data, means improving speed loaders can live outside activity lifecycle, if have config change data not destroyed loaders reloaded once data store changes using handlers,executors, or asynctasks not take account above points. have manage yourself, , work android developers put loaders implementation. ie. using asynctask loading data requires watch out screen rotations, ie. must somehow retain reference asynctask might still in background once activity recreated due screen rotation.

mathcad coeffs command, find coefficient of each variable at one shot -

i have simple function: w(x) := c1*cos(x)+c2*sin(x)+c3*cosh(x)+c4*sinh(x) i evaluate @ x=l , get: c1*cos(l)+c2*sin(l)+c3*cosh(l)+c4*sinh(l) sometimes equations long , complicated. want find coefficient of each c's such as: coeffs c1: cos(l) coeffs c2: sin(l) coeffs c3: cosh(l) coeffs c4: sinh(l) however, coefficient of 1 variable @ time. find coefficients of variable. when add multiple coeffs, not show coefficients shows different such as: ({2,1},{1,1}) is there way find coefficients @ 1 shot? it if post little more expect get? can attach worksheet example? the ({2,1},{1,1}) expression seeing mathcad's default display nested array (that is, array contains other arrays). show array in full: in mathcad 15 (or lower), double click on result (ie, ({2,1},{1,1}) ) , should see results dialog box. select display options tab, select matrix 'matrix display style' drop-down menu, tick 'expand nested arrays' , click ok. should show

javascript - Why would XML be an issue with a MEAN stack application, and what is this error about? -

i working on socket.io "hello world" via mean stack application, , right away chrome tossing funky errors way. honest, in debugging effort, i'm not sure begin. initial questions were: why xml being used instead of json? what no 'access-control-allow-origin' header present on requested resource. mean? the entire error message below, , in advance advice y'all able give. cheers, peter xmlhttprequest cannot load http://localhost/socket.io/?eio=3&transport=polling&t=1435600202687-6. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:9000' therefore not allowed access. response had http status code 404. try including socket.io lib directly socket server: <script src="http://localhost:9000/socket.io/socket.io.js"></script> the error "no 'access-control-allow-origin' header present on requested resource." means server doesn't

c# - Cast fails from ICollection<TestCastChild> to ICollection<ICastBase> -

this question has answer here: c# variance problem: assigning list<derived> list<base> 4 answers i'm using reflection property icollection<testcastchild> , cast icollection<icastbase> . testcastchild implement's icastbase. when try cast collection, cast fails. i'm sure i'm missing simple. can't see why fails. public interface icastbase { int id { get; set; } } public interface icastchild : icastbase { string name { get; set; } } public abstract class testcastbase : icastbase { public int id { get; set; } } public class testcastchild : testcastbase, icastchild { public string name { get; set; } } public class testcastparent : testcastbase { public virtual icollection<testcastchild> children { get; set; } } then test: [testmethod] public void testcast() { var parent = new testcastp

python - XML: 'remove_blank_text' is an invalid keyword argument for this function -

okay, i'm doing basic xml tutorial , trying put code in: parser = etree.xmlparser(remove_blank_text=true) root = etree.xml("<root> <a/> <b> </b> </root>", parser) etree.tostring(root) and i'm getting error pointing parser line saying 'remove_blank_text' invalid keyword argument function i have sneaking suspicion lxml somehow not installed or imported or whatever. have eyes cross @ "installation" instructions; in very, plain english, how install/reinstall lxml? (edit: double checking, yes, this: import sys lxml import etree does indeed yield "no module named lxml". okay, how install lxml? installing lxml on windows surprisingly tricky business. wasn't ever able work until found wonderful resource: unofficial windows binaries python projects .

java - Finding best match by minMaxLoc returned values OpenCV with a specific level of thershold -

i want find best match level of threshold. here did values staying @ 0. cvmatchtemplate(src, tmp, result, cv_tm_ccorr_normed); cvpoint minloc = new cvpoint(); cvpoint maxloc = new cvpoint(); doublepointer min_val = new doublepointer(); doublepointer max_val = new doublepointer(); cvminmaxloc(result,min_val, max_val, minloc, maxloc, null); i don't double pointers required mothode. min_value , max_value staying @ 0 cant find best matches. thanks in advanced.using javacv. in example here used primitive doubles, not double type , defined arrays, not objects. so, why don't give shot , let know if make difference. cvmatchtemplate(src, tmp, result, cv_tm_ccorr_normed); double[] min_val = new double[2]; double[] max_val = new double[2]; cvpoint minloc = new cvpoint(); cvpoint maxloc = new cvpoint(); cvminmaxloc(result, min_val, max_val, minloc, maxloc,null); __update__ i found following code here // match template function opencv cvmatchtemplate(src, tm

opendata - cannot delete resource from CKAN data store -

i testing datastore functionality on ckan 2.3. running basic tests on ckan datastore page: http://docs.ckan.org/en/ckan-2.3/maintaining/datastore.html#the-datastore-api i able create, view , delete dataset using these commands: curl -x post http://127.0.0.1:5000/api/3/action/datastore_create -h "authorization: {your-api-key}" -d '{"resource": {"package_id": "{package-id}"}, "fields": [ {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2, "b": "zzz"} ]}' curl http://127.0.0.1:5000/api/3/action/datastore_search?resource_id= {resource_id} curl -x post http://127.0.0.1:5000/api/3/action/datastore_delete -h "authorization: {your-api-key}" -d '{"resource_id": "{resource-id}"}' however, if after creating datastore resource after first step, delete usin

android - app:theme now is deprecated -

i using android fine yesterday today when ran app through intellijidea gives me : i/appcompatviewinflater﹕ app:theme deprecated. please move using android:theme instead. my styles : <resources> <style name="apptheme" parent="theme.base"> </style> <style name="theme.base" parent="theme.appcompat.light.noactionbar"> <item name="android:windownotitle">true</item> <item name="windowactionbar">false</item> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent">@color/coloraccent</item> </style> </resources> what problem , how can solve it? thanks in advance, update :my toolbar.xml file is: <?xml version="1.0" encoding="utf-8&

MatLab latex title doesn't work for powers (^) -

in matlab (r2015a), want style title of plots using latex. this working fine functions, not if there's power in equation. the below code works, , shows formatted title right, , unformatted title left. it shows warning: warning: error updating text. string must have valid interpreter syntax: y = x^2 syms x y eq = y == x^2; subplot(1,2,1) ezplot(eq) title(latex(eq),'interpreter','latex') eq = y == x+2; subplot(1,2,2) ezplot(eq) title(latex(eq),'interpreter','latex') edit: i found out can work appending $ on both sides. seems weird have this. so works: title(strcat('$',latex(eq),'$'),'interpreter','latex') solution the problem can solved adding $ -signs before , after generated latex-expression. can change « title -lines» to: title(['$',latex(eq),'$'],'interpreter','latex') an alternative use strcat proposed in question. explanation si

c# - Get specific data from a webpage -

i have page , , page need value other different page. i want retrieve 6 numbers "nĂºmeros sorteados" box. so far succeeded in whole web page this: webrequest request = webrequest.create("http://www1.caixa.gov.br/loterias/loterias/ultimos_resultados.asp"); webresponse response = request.getresponse(); stream data = response.getresponsestream(); string html = string.empty; using (streamreader sr = new streamreader(data)) { html = sr.readtoend(); } after that, can't select these number html. here's quick way numbers using htmlagilitypack : public async task<list<string>> getnumbers() { // getting number of microseconds since jan 1st, 1970 var microseconds = (long)(datetime.utcnow - (new datetime(1970, 1, 1, 0, 0, 0))).totalmilliseconds; // creating webrequest , passing parameter var request = webrequest.createhttp( string.format( "http://www1.caixa.gov.br/loterias/lot

Python find similiar files in given folder -

i'm trying write function find similiar files name (song.mp3, song1.mp3, (1)song.mp3) in specified folder. have now: def print_duplicates(source): files_list = [] new_list = [] dirpath, dirnames, filenames in os.walk(source): fname in filenames: if ('\w*' + fname + '\w*') in files_list: new_list.append(os.path.join(dirpath, fname)) else: files_list.append(fname) in new_list: print(a) if filename wasn't before in files_list added, if added new_list path. way have list of 'duplicate' files. it's not working, new_list remains empty. correct mistakes? part of code wrong? if want use regex in code, need use re module. so change line, if ('\w*' + fname + '\w*') in files_list: to, if re.search(r'\w*' + fname + r'\w*', files_list): which same as, if fname in file_list: because \w* means 0 or more word char