Posts

Showing posts from January, 2010

node.js - How do I access sails.services.*? -

i using sails.js in node app. sails of course globally available default. however, want services , models non-global peace of mind. set default booleans in globals.js false , trying access specific services per sails.js documentation (sails.services.*) should work since sails still global, keeps throwing reference error. ideas why is? have experience mucking around global.js in sails , can confirm of documentation of sails.js innacurate? starting lean towards conclusion. note: using sails.js version 11 if accesss service trough sails.services.xxx make sure letters lower case, example if have myservice.js @ services folder, can call myservice or sails.service.myservice .

Basic Java and Eclipse -

make util class 3 methods. first method's name add, returns result adding 2 numbers. second method's name multiply, returns result multiplying 2 numbers. third's method name division returns result dividing first parameter second parameter. then call method class called main , print results 6 times each method call? i'm having trouble part. this i've got far: public class util { public static int add(int a, int b) { int result = + b; system.out.println("result = " + result); return result; } public static int multiply(int a, int b) { int result = * b; system.out.println("result = " + result); return result; } public static int divide(int a, int b) { int result = / b; system.out.println("result = " + result); return result; } public static void main(string[] args) { int res = multiply(5, 2); system.out.p...

Confused about how can I handle several "Possible" exceptions in C++ -

i'm going in c++, such creating file. in function creates file, have set several exceptions possible failure. instance if file exists, if disk full, if access allowed, if file creation ends happily etc...now, when want catch them all, confused. int file_create(std::string file_name) {...} // includes several exceptions @ various points try{ file_create("/var/simple.txt"); } catch(...){ // should here have specific control on exception throw? } i know ... catch-all, not if lets deeper investigation of exception thrown? i compile based on c++011. you either like: try { //your code } catch(firstexception &e){} catch(secondexception &e){} ... or if want catch exceptions defined you, can create custom baseexception , define others subclasses of one.

amazon web services - Unable to Access Owin Self hosted RestApi - Deployed to AWS EC2 - Windows 2012 R2 -

Image
following sample self hosting restapi code, have created owin. working in local machine. i have hosted in aws-ec2, , started administrator. i able access restapi inside instance (using chrome/ie) giving localhost url. but getting bad request invalid hostname, when replace localhost public dns of instance (running within instance's browser). when tried access restapi outside instance browser local machine (browser/postman), returning status 0. copied code below. class program { static void main(string[] args) { const string baseuri = "http://localhost:65435"; console.writeline("starting web server..."); webapp.start<startup>(baseuri); ... } } public class startup { public void configuration(iappbuilder app) { var webapiconfiguration = configurewebapi(); app.usewebapi(webapiconfiguration); } private httpconfiguration configurewebapi() { var config = new httpco...

javascript - Copying the js objects value into the html as string -

i want create html elements using values of javascript objects not global. if run following code, take error: "params not defined". want copying value argument in html code. if (params.data.allowedoperations.indexof('put') != -1) { return "<a onclick=\"ahey('put',params.data.allowedoperations)\" href=\"#\"> put </a>"; } you use: if (params.data.allowedoperations.indexof('put') != -1) { return "<a onclick=\"ahey('put','"+params.data.allowedoperations+"')\" href=\"#\"> put </a>"; } alternatively create anchor node , add eventlistener or store operations in different attribute e.g.: if (params.data.allowedoperations.indexof('put') != -1) { return "<a onclick=\"ahey('put', this.dataset.allowedoperations)\" data-allowed-operations=\""+params.data.allowedoperations+"\...

node.js - Node Net refuses connection no matter what on learnyounode -

i continuously following error: ✗ error connecting localhost:20496: connect econnrefused note: local host number changing. on cloud9.ide error happens before timeout, , on my computer error happens after timeout. (it happens in both areas think it's local host problem) the code i'm using follows: var net = require('net'); function zero(i) { return (i < 10 ? '0' : '') + i; } function () { var d = new date(); return d.getfullyear() + '-' + zero(d.getmonth()) + '-' + zero(d.getdate()) + ' ' + zero(d.gethours()) + ':' + zero(d.getminutes()); } var server = net.createserver(function (socket) { socket.error(function(){ console.log("error"); }); socket.end("found:"+now() + '\n'); }).listen(8000); i don't understand why net module doesn't work , http module did. feel has port being listened to, changed 3306 , there no differences in...

android - How to use RecyclerView to implement the HorizontalScrollView? -

i want make screen grid of items able scroll horizontally . items combination of images , text . should possible recyclerview unable it. does have solution problem ? in advance. set gridlayoutmanager recycle view follows. gridlayoutmanager manager = new gridlayoutmanager(this, 3, linearlayoutmanager.horizontal, false); recyleview.setlayoutmanager(manager);

Sonarqube Javascript Coverage doesn't show source files -

Image
i tried display coverage javascript project sonarqube. value of code coverage correct can't see source files. currently have following project structure: angular-playground +- app | +- scripts | | +- app.js +- build | +- coverage | | +- lcov.info¨ this sonar-project.properties -file: # metadata sonar.projectkey=angular-playground sonar.projectname=angular-playground sonar.projectversion=1.0.0 # source folders sonar.language=js sonar.sourceencoding=utf-8 sonar.sources=app sonar.tests=test # coverage reporting sonar.javascript.lcov.reportpath=build/coverage/lcov.info sonar.surefire.reportspath=build/reports/ sonar.dynamicanalysis=reusereports this lcov.info -file: tn: sf:app/scripts/app.js fnf:0 fnh:0 da:11,1 lf:1 lh:1 brf:0 brh:0 end_of_record and debug log: sonarqube runner 2.4 java 1.8.0_40 oracle corporation (64-bit) windows 8.1 6.3 amd64 info: error stacktraces turned on. info: default locale: "de_ch", source code encoding: "utf...

How to give titles on X-Axis and Y-Axis in android graph using achartengine library? -

i'm working on android eclipse project in have show teachers feedback report in graph, have made graph static values have give titles on x-axis , y-axis. on x-axis there q1,q2,q3,q4 upto q15 15 blocks existing in graph, on y-axis have give single title 'performance' , show question numbers on x-axis,i have show values on y-axis 1,2,3,4 , 5(the highest value of graph). here code have used make graph using achartengine library. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.barchart); //define buttons btn1=(button)findviewbyid(r.id.button5); btn2=(button)findviewbyid(r.id.button1); btn3=(button)findviewbyid(r.id.button2); btn4=(button)findviewbyid(r.id.button3); btn5=(button)findviewbyid(r.id.button4); qdetail=(button)findviewbyid(r.id.button6); //define textviews tv1=(textview)findviewbyid(r.id.textview04); tv2=(textview)findviewbyid(r.id.textv...

bash - command line argument from file content with quote -

i have file containing command line arguments pass script. but file contain element such "param 1" param2 param3 . let's call file arguments test.tmp , script file script.sh . if do: script.sh -p `cat test.tmp` -other_params 1 2 3 the script.sh receives after p : "param 1" param2 param3 but like: param 1 param2 param3 any idea? small precision: assume script.sh not modifiable. solution must take place in shell. assumption: test.tmp needs contain parameter per line approach . you may use xargs linefeed delimiter: cat test.tmp | xargs -d '\n' script.sh -p

gruntjs - Launch grunt task passing params on git commit -

i starting grunt, have defined task , work charm: module.exports = function(grunt) { grunt.initconfig({ jshint: { force: false, options: { evil: true, regexdash: true, browser: true, wsh: true, trailing: true, multistr: true, sub: true, loopfunc: true, expr: true, jquery: true, newcap: true, plusplus: false, curly: true, eqeqeq: true, globals: { jquery: true } }, src: ['workspace/**/*.js'] } }); grunt.loadnpmtasks('grunt-contrib-jshint'); grunt.registertask('default', ['jshint:src']); }; now, launch task passing src param (with git commited files). i have tried pre-commit script in .git folder, does´t work: var exec = require('child_process').exec; exec('grunt jshint', { ...

performance - How to speed-up python curve_fit over a 2D array? -

i have use curve_fit numpy function on large set of data (5 000 000). i've created 2d array. first dimension number of fittings perform, second dimension number of points used fitting. t = np.array([0 1 2 3 4]) d in np.ndindex(data.shape[0]): try: popt, pcov = curve_fit(func, t, np.squeeze(data[d,:]), p0=[1000,100]) except runtimeerror: print("error - curve_fit failed") multiprocessing can used speed full process, still quite slow. there way use curve_fit in "vectorized" manner? one way speed adding in prior knowledge curve_fit. if know range expect parameters be, , if don't need precision 100th significant number, can speed computations massively. here example, in you'd fitting param1 , param2 : t = np.array([0 1 2 3 4]) def func(t, param1, param2): return param1*t + param2*np.exp(t) d in np.ndindex(data.shape[0]): try: popt, pcov = curve_fit(func, t, np.squeeze(data[d,:]), p0=[1000,100], ...

How to get the access token from Google Sign-In Javascript SDK? -

i have simple single-page javascript webapp uses "google sign-in websites": https://developers.google.com/identity/sign-in/web/sign-in how can access token user? need verifiable assertion of user's identity on server. don't want offline access; want know when web client sends ajax request server, can trust identity of logged-in user. for verification purposes better use id_token part of auth response, , can retrieved @ point this: gapi.auth2.getauthinstance().currentuser.get().getauthresponse().id_token the google api client libraries offer functions verify id_token , give associated user information on server side: https://developers.google.com/api-client-library/

c# - How to redirect from controller using RedirectToAction method -

i trying redirect controller action controller action below: public class logincontroller : controller { public actionresult index() { return view(); } public actionresult redirecttoregister() { return redirecttoaction("index", "register"); } } public class registercontroller : controller { public actionresult index() { return view(); } } i have url in cshtml page below: <script type="text/javascript"> var loginredirecttoregisterurl = '@url.action("redirecttoregister", "login")'; </script> and calling js below: function callredirecttoregister() { window.location = loginredirecttoregisterurl; } but not redirecting me register page. routing below: public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "default", ...

How to convert the U+XXXXX sequence to character in perl? -

this perl -co -e 'say "\n{u+00e1}"' prints á how achieve same á following: echo "u+00e1" | perl -co -lne 'say what_here($_)' use charnames : echo "u+00e1" | perl -mcharnames=short -co -lne 'say charnames::vianame($_)' you can use eval , if can control comes in input: echo "u+00e1" | perl -co -lne 'say eval qq("\\n{$_}")'

Spark broadcasted variable returns NullPointerException when run in Amazon EMR cluster -

the variables share via broadcast null in cluster. my application quite complex, have written small example works flawlessly when run locally, fails in cluster: package com.gonzalopezzi.bigdata.bicing import org.apache.spark.broadcast.broadcast import org.apache.spark.rdd.rdd import org.apache.spark.{sparkcontext, sparkconf} object pruebabroadcast2 extends app { val conf = new sparkconf().setappname("pruebabroadcast2") val sc = new sparkcontext(conf) val arr : array[int] = (6 9).toarray val broadcasted = sc.broadcast(arr) val rdd : rdd[int] = sc.parallelize((1 4).toseq, 2) // small integer array [1, 2, 3, 4] paralellized in 2 machines rdd.flatmap((a : int) => list((a, broadcasted.value(0)))).reducebykey(_+_).collect().foreach(println) // nullpointerexception in flatmap. broadcasted null } i don't know if problem coding error or configuration issue. this stacktrace get: 15/07/07 20:55:13 info scheduler.dagscheduler: job 0 failed: collect ...

java - Send Data From Servlet To another ServerSocket -

in java project have server class(using serversocket) , client class(using socket). in addition implemented servlet application running on tomacat 8 servlet acts input source(in other words client). i'd send data filled servlet web page server socket. got data web form using request.getparametermap() command i use json in order wrap data before sending between client , server. i'd same servlet cant find right way that. thanks! as have client class need use effectively. make client code generic simple interface can called anywhere. servlets java classes, can call other class additional work. in case, can use data received in servlet , pass on client send server. make sure client code should not block servlet long decrease responsiveness. if can client logic in separate thread servlet can respond quickly.

vb.net - Sending an array of string to a WSDL Endpoint? -

i'm trying connect webservice. documentation (or lack of) here: http://portal.smartertools.com/services2/ http://portal.smartertools.com/services2/svctickets.asmx i'm attempting call getticketsbysearch. args searchcriteria string() , says "a list of 'key=value' pairs indicate search parameters. search custom fields, pass in id of field key , search term value (ie: 1 = 'value') my code: dim args new st.arrayofstring args.add("isopen='true'") dim callwebservice new st.svcticketssoapclient dim sgetvalue st.ticketinfoarrayresult = callwebservice.getticketsbysearch(username, password, args) i can't results return. ive tried passing in string many different ways. ie: 'isopen='true; 'isopen'='true' etc... hopefully else runs specific problem. the user account accessing smartertools endpoint must have role of 'agent' assigned. if assigned administrator ...

r - eval.parent using incorrect environment -

in r, noticed odd behavior regarding eval.parent , environment searches when evaluating variable names. following example: > f = function() {i = 1; g()} > g = function() {eval.parent(substitute(i))} > f() [1] 1 this works expected. expression i evaluated in environment called g , body of f , , 1 result. however, if define i in body of g well, value used instead despite expression being evaluated in parent frame. > g = function() {i = 2; eval.parent(substitute(i))} > f() [1] 2 why result 2 in case? definition of i = 2 should ignored eval.parent because expression evaluated in parent frame. having examined environments more closely, call eval eval.parent passed environment corresponding frame of f checked sys.frames .

Parsing Json Array in PHP with keys -

i wanted parse data array given path ($path), each 1 key in json array. $data['system']['local']['version'] = 1; $path = "system.local.version"; $key_array = explode(".", $path); foreach ( $key_array $keys) { if( !array_key_exists($keys,$data)) { return -1; } $data = $data[$keys]; } print_r($data); ps : need complete path after traversing json array givenn path (keys). ex : - want after traversing array ( expected output above code). array ( [system] => array ( [local] => array ( [version] => 1 ) ) )

python - QPixmap Line Being Skipped -

i have following piece of code: def run(self): filename = qtgui.qfiledialog.getsavefilename(self, "save file", "", ".inp") if filename == "": pass elif filename != "": nfile = open(filename, 'w') self.pixmap1 = qtgui.qpixmap('yellow.jpg') self.canvas1.setpixmap(self.pixmap1) self.cursor.moveposition(self.cursor.start, self.cursor.moveanchor) self.cursor.moveposition(self.cursor.end, self.cursor.keepanchor) text = self.cursor.selection() text1 = text.toplaintext() nfile.write(text1) nfile.close() fileinfo = qtcore.qfileinfo(filename) name = fileinfo.basename() import os os.system("rungms {}.inp 13-64 {} {} {}.out".format(name, self.cores_val, self.clusters_val, name)) itertools import islice ...

javascript - jquery giving "invalid property value" error in Internet Explorer11 -

//jquery 2.1.0 code line no 7026 onward if ( value !== undefined ) { return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? ret : ( elem[ name ] = value ); //here getting invalid property value error } else { return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? ret : elem[ name ]; } and when made changes in jquery code this if ( value !== undefined ) { if ( value === null ) { jquery.removeattr( elem, name ); } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { ...

jquery - How to call the javascript function one after the other with delay? -

here have javascript function iterates through array , appends image div.when last element in array reached, function invokes flip function scales div, , after 3 seconds function repeats. i.e 3 seconds can see flipped content, after 3 seconds continues again array iteration.... i have 6 set of same functions given below...for example flip-1, flip-2, flip-3 , on till flip-6. want is, want call flip-5 flip-1 completes 3 seconds of flip.... how can this? function startslidecat1(started) { (var = 0; < footwear.length; i++) { var image = footwear[i][0]; imgslidercat1(image, / initial_del * 8000, == footwear.length - 1); } }; function imgslidercat1(image, timeout, last) { window.settimeout(function() { document.getelementbyid('flip-1').style.display = 'none'; document.getelementbyid('category-1').style.display = 'block'; document.getelementbyid('category-1').innerhtml = ""; var product = document.gete...

Regex to Match URL with a Specific Query Param (Javascript) -

i need match set of urls , must contain specific query param (type=vcl) so far have /http:\/\/myhost:8080\/organization\/(\d*)\/mediaresource?.*$/ which matches urls formed http://myhost:8080/organizaton/5/mediaresource?anyparam(s) need matches if the url contains query param type=vcl like: http://myhost:8080/organization/5/mediaresource?someparam=foo&type=vcl can last part of regex urls contain query param care about? you can use following regex: http:\/\/myhost:8080\/organization\/(\d*)\/mediaresource\?\s*\btype=vcl\b\s* see demo i added slash before ? matched literally, added \s* matching 0 or more non-whitespace symbols, , \btype=vcl\b urls have param matched.

android - How to give custom text colour for a single menu item in a NavigationView? -

hi using android navigationview . want give seperate text colour items in navigationview, not items. or want change text colour single item dynamically when select item in navigationview( only items ). how can this? yes can i have done it . first fetch menuitem want change color menu m = navview.getmenu(); menuitem menuitem = m.finditem(your_menu_id); then apply spannable color spannablestring s = new spannablestring(menuitem.gettitle()); s.setspan(new foregroundcolorspan(color.your_color), 0, s.length(), 0); menuitem.settitle(s); thats it.. now below code 2nd solution changing text color dynamically on menu click.. navview.setnavigationitemselectedlistener(new navigationview.onnavigationitemselectedlistener() { @override public boolean onnavigationitemselected(menuitem menuitem) { spannablestring s = new spannablestring(menuitem.gettitle()); s.setspan(new foregroundcolorspan(color.red), 0, s.length(), 0); ...

sql - Mysql subquery in a view very slow -

i'm trying last result table using data_coleta (date) , servico_id base. query working slow. how can optimize? select t1.* amostra_ensaio_full t1 t1.cliente_id = 6 , t1.tipo_id <> 1 , t1.data_coleta = (select max(s1.data_coleta) amostra_ensaio_full s1 t1.cliente_id = s1.cliente_id , s1.tipo_id <> 1 , s1.tipo_id = t1.tipo_id) , t1.servico_id = (select max(s2.servico_id) amostra_ensaio_full s2 t1.cliente_id = s2.cliente_id , s2.tipo_id <> 1 , s2.tipo_id = t1.tipo_id) group t1.cliente_id , t1.tipo_id you can speed query using indexes. the query is: select t1.* amostra_ensaio_full t1 t1.cliente_id = 6 , t1.tipo_id <> 1 , t1.data_coleta = (select max(s1.data_coleta) amostra_ensaio_full s1 t1.cliente_id = s1.cliente_id , s1.tipo_id <> 1 , s1.tipo_id = t1.tipo_id ) , t1.servico_id = (select max(s2.s...

python - Wrong aware-datetime with pytz and 'America/Chicago' -

this question has answer here: how add timezone naive datetime instance in python [duplicate] 2 answers in [57]: datetime.datetime(2015,7,7,15,30,tzinfo=pytz.timezone('america/chicago')) out[57]: datetime.datetime(2015, 7, 7, 15, 30, tzinfo=<dsttzinfo 'america/chicago' cst-1 day, 18:00:00 std>) notice offset, saying utc-6 (e.g -(24-18) ) while correct offset chicago on 2015-7-7 utc-5. am missing here? there issues timezones , pytz using localise fix: import pytz d = datetime(2015,7,7,15,30) dt = pytz.timezone('america/chicago').localize(d) print(dt) 2015-07-07 15:30:00-05:00 unfortunately using tzinfo argument of standard datetime constructors ‘’does not work’’ pytz many timezones.

php - MySQL Download counter for .DEB files on repository -

i had mysql download counter "working" few months ago , of sudden has stopped working, recording (individual cydia downloads) database posting main webpage stats. i've gone through code , files, on , on again. on 24hours digging , has still not been solved. if link files or post text "on here" please me. connect.php <?php $server = "localhost"; $user = "root"; $password = "password"; $database = mysql_connect ($server, $user, $password); mysql_select_db("database_name", $database); ` ?> counter.php <?php include("connect.php"); $filename = mysql_real_escape_string($_get['file']); $path = $_server['document_root']."/"; $fullpath = $path.$filename; $filetypes = array("deb", "zip"); if (!in_array(substr($filename, -3), $filetypes)) { echo "invalid download type."; exit; } if ($fd = fopen ($fullpath, ...

mysql - SQL Query Update field depending on subquery -

i need sql query. table users has 3 fields: name, iduser, idgroup. one user can appear many times on same table same iduser , different idgroups. field name should update new value if has changed. if there no exists row given iduser , idgroup has inserted new row. if exists(select 1 users iduser=3 , idgroup=4) begin update users set name='new name' iduser=3 , idgroup=4 end else insert users values('name',5,3) end my sql query sintax wrong can't use it, how achieve need? i'm using mysql database (managed phpmyadmin) , doing insert lua script. you need make sure have right unique keys in place. alter table users add unique `unique_index`(`iduser`, `idgroup`); then, should able run insert/update: insert users (name, iduser, idgroup) values ('name value',5,3) on duplicate key update name = values(name) name <> values(name)

python - how to check if pandas dataframe cell contains zeros -

i doing loop go thorugh series in dataframe. want if both cells zero, skip. have skip because want plot output when 2 cells 'cost' , 'new_cost' zero, give me error: data: cost new_cost 100.00 25.00 0.00 0.00 3.00 10.00 typeerror: empty 'series': no numeric data plot this mycode: if df.cost.isempty , df.new_cost.isempty: continue else: . this didnt work: if df[df.cost==0.00] , df[df.new_cost==0.00]: continue else: but getting valueerror: truth value of dataframe ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all(). i think want filter dataframe before performing loop (note have enclose boolean conditions in brackets inside indexer): df_filtered = df[(df.cost != 0) & (df.new_cost != 0)]

php - Contact Form Security and Functions Don't Work -

i working on contact form , code doesn't seem work. don't verifications when submitted, don't see user submitted, , form has no security @ all. here produced far, has of things complete, can't work way want. can me this: edit: making contact form collect inputs childcare website (i need name of parent, email, phone number, , information child). expect to, when submitted visitor/parent, send me verification form submitted , copy of submitted me. parent submitted form should verification form submitted. when form inputted, page resets , don't copy of inputs nor parent verification.. – suppahman 4 mins ago edit i expecting send me verification of form being submitted, copy of inputs can contact them later, parent gets verification got it, , form should secured nobody can spam me. @ moment, form basically... well... dead. guys able me chance? don't know if answered questions correctly, think should do? php $contactname = $_post["contact-na...

vba - Range in Excel to go from a specific cell to the end of the column -

i wondering how define range in order define c5 until last value of column. c5 constant end of list isn't. sub merge() worksheets("sub").range("c5").end(xltoleft).select.copy worksheets("master worksheet").range("a1:a23").pastespecial paste:=xlpastevalues end sub i getting subscript out of range error. guidance nice. you don't have copy , paste special, values. transfer values on directly , avoid using clipboard. this use 1 or 2 variable assignments clean code. with worksheets("sub") worksheets("master worksheet").range("a1") _ .resize(.range(.cells(5, 3), .cells(5, columns.count).end(xltoleft)).columns.count, 1) = _ application.transpose(.range(.cells(5, 3), .cells(5, columns.count).end(xltoleft)).value) end the code little long because need resize destination in order receive values. mentioned, 1 or more vars clean tidily. when creating range(cells, cells.end) ...

vertica - R function Failure in UDx RPC call InvokeGetUdxType() Issue -

i tring create r function in vertica , getting error. or clue highly apreaciated dbadmin=> create transform function pred language 'r' name 'pred' library predlb; rollback 3399: failure in udx rpc call invokegetudxtype(): error calling getudxtype() in user defined object [predict] @ [/scratch_a/release/16125/vbuild/vertica/oss/udxfence/vertica-udx-r.cpp:209], error code: 0, message: error happened in getudxtype : exception in processing required attribute udxtype in factory function : no applicable method 'predict' applied object of class "null" #dblog error starting udxsideprocess language r command line: /opt/vertica/bin/vertica-udx-r 3 node-32420:0x61c5 debug-log-off /home/dbadmin/stream/v_stream_node0001_catalog/udxlogs #error udx log /home/dbadmin/stream/v_stream_node0001_catalog/udxlogs/udxfencedprocesses.log 2015-06-24 11:15:55.922 [r-node-32420:0x61c5-2308] 0x7f3c460457a0 udx side process started 11:15:55.922 [r-node-3242...

Openstack release name -

i not able determine openstack release running on machine. tried match output of nova package version release naming site. nova version not have match. stack@selm:~$ nova-manage --version 12.0.0 this package not listed on following release site: https://wiki.openstack.org/wiki/releases could please tell me how can determine release name running on machine? thanks, manish well, you're not on kilo, because looks kilo nova-manage --version returns more useful: # nova-manage --version 2015.1.0 and in fact looks true juno , icehouse well. if installed openstack using system's package manager better information querying packaging system. example, on rpm based system such red hat or fedora run: # rpm -q openstack-nova which might return: openstack-nova-common-2015.1.0-3.el7.noarch which tells using 2015.1.0 release, aka "kilo" . you similar on ubuntu (or debian) system using dpkg-query -w nova-common , might give you: 1:2014.1.5-0...

java - Strange Text Placement on Android 5.0 Lollipop due to android.graphics.Paint.getTextSize() -

here few images reference in post: http://imgur.com/a/rsd57 . right now, following "android game programming dummies" book develop simple 'whack mole' android app, , encountered strange error. when run app on emulator running android 2.1, text indicates number of moles "whacked" , number of moles "missed" placed correctly (first image). however, when run app on phone (a samsung galaxy s5 active running android 5.0), bottommost pixel of text appears @ top of screen (second image). i think root of problem here: private void draw (canvas canvas) { try { canvas.drawbitmap(backgroundimg, 0, 0, null); if(!ontitle) { canvas.drawtext("whacked: " + integer.tostring(moleswhacked), 10, blackpaint.gettextsize()+10, blackpaint); canvas.drawtext("missed: " + integer.tostring(molesmissed), screenw - (int)(200*drawscalew), ...

How can Android use the app compat components automatically? -

recently i'm studying usage of appcompat support library , design support library. , met strange question(at least me) can't understand. in appcompat support library, there're several appcompat* components, such appcompatbutton, appcompatcheckbox... there's 1 same thing among these components - in official doc these components have such illustration, this automatically used when use button in layouts. should need manually use class when writing custom views. or this. here come's question. since button isn't appcompatbutton, how can consider appcompatbutton when use button during xml or created in code? how work? forgive cantonese english. short brief on how appcomp decided class init - when using support library (appcompat) using support library widgets (e.g. android,support.v4.widget.button) ,the library use appropriate implementation based on android os. example ,if os support button use native implementation ,else use appcompat ...

javascript - ReactJS with React Router - strange routing behaviour on Chrome -

Image
this bit weird , bottom of it. i have page users type in email address , click button , show "you're signed up!" message - simple. for that, have 2 routes. main route , "signed-up" route. <route name="app" path="/" handler={main}> <route name="signed-up" path="signed-up" handler={signedup} /> <defaultroute handler={signup} /> </route> on first page, when users type in email address , click button, fire post ajax save email address on backend db (using axios package) , when it's completed, go "signed-up" route. handlesubmit() { var router = this.context.router; var email = this.refs.email.getdomnode().value; this.refs.email.getdomnode().value = ''; helpers.postsignupemail(email).then((response) => { // display signed page router.transitionto("signed-up"); }); } now when first type in url of page htt...

c# - How to dynamically generate Includes in entity framework -

well not sure if questions asked before have no idea how search it. not entity framework specified question gonna give example using it. so in ef need use .include("related object") include related data. want write method takes list of strings , returns entity or entity list related objects. in example public list<entity> getall(list<string> includes>) { list<entity> entites = context.entites; foreach(string s in includes) { entites.include(s); } return entites; } obviously above example won't work since called out entites when declared list. think demonstrates point. declare local variable dbquery<entity> , reassign result of include call , call tolist on after loop: public list<entity> getall(list<string> includes>) { dbquery<entity> entites = context.entites; foreach(string s in includes) { entities = entites.include(s); } retu...

android - Using Cordova 5.0.0 Google Maps with Content Security Policy -

i m building cordova application android using cordova 5.0.0. , m using google maps without plugin , must without plugin. include script , meta tag .also cordova using whitelist plugin. <!-- meta tag --> <meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> <!-- google maps--> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script> it's give me error: refused load script 'https://maps.googleapis.com/maps/api/js?sensor=true' because violates following content security policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval'". try block error away <meta http-equiv="content-security-policy" content=" default-src ...

R foreach loop - package load fails -

i'm unable load packages parallel processes in foreach %dopar% loop. i create 4 sock clusters using foreach , dosnow packages, try run trivial parallel process. works %dopar% without using packages, loading arbitrary package throws error. sample code below, followed session info showing packages in use. i have used type of code before without issues. recent network changes @ company meant had change settings (default library path, etc), may related change. not sure start in troubleshooting issue - appreciated! #load foreach , dosnow packages, setup 4 clusters# > require(foreach) > require(dosnow) > registerdosnow(makecluster(4, type = "sock")) > getdoparworkers() [1] 4 > getdoparname() [1] "dosnow" # %dopar% loop without loading packages -- works ok # > foreach(i=1:2) %dopar% { i+1 } [[1]] [1] 2 [[2]] [1] 3 # %dopar% loop loading package -- not work # > foreach(i=1:2,.packages="forecast") %dopar% { ...

xml - Why XmlInputFormat is not provided by hadoop? -

i working hadoop map-reduce. have process data .xml file, parse , store output database. while working on when need pass xml mapper, found xmlinputformat.class not provided hadoop default , have use mahout's xmlinputformat it. i wonder when xml being use vastly, why hadoop haven't provided xmlinputformat rather explicitly creating custom xmlinputformat bye extending textinputformat it? well though xml vastly used, providing framework special features towards technology, might not idea. may endorsement. @ high level, mapreduce designed accept different formats. infact these days json being used vastly due size features compared xml. had similar issue. but user decide input of map reduce , can use, different parsers(jackson or gson json , jaxb xml) if in single line or above using recordreader implementation

r - ggvis graphic with group selection -

Image
i want use ggvis data exploration (because familiar ggplot2), , of great help, due many groups in data sets, able select , unselect groups make different specific (data) comparisons. set.seed(10) dat <- data.frame(x=c(1:3,1:3),y=rnorm(6),groups=factor(rep(1:2,each=3))) library(ggvis) dat %>% ggvis(~x, ~y) %>% layer_points(fill=~groups) # know example not work - possible somehow? dat %>% ggvis(~x, ~y) %>% layer_points(fill=input_checkbox(~groups)) what want @ end, graphic can select subset of groups using radio buttons (for example). there way that? thank you! from documentation limitations currently, interactive inputs can used in 2 places: as arguments transforms: layer_smooths(span = input_slider(0, 1)) as properties: props(size = input_slider(10, 1000)) this means interactive inputs can modify data, not underlying plot specification . in other words, with basic interactivity there’s no way add or remove layers , ...

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i have 4 pages on jsp web project student showing details db.. have used tomcat web server. index.html <body> <h1> student search page</h1> <form action="second.jsp"> <h2> enter id search details</h2> <input type=text name=id1 /> <br/> <input type=submit value=search /> </form> </body> second.jsp <body> <% string id =(request.getparameter("id1")); studentdao std=new studentdao(); student s=std.searchinfo("id"); %> <h1> <%=s.showstudent()%></h1> </body> student.java import java.io.*; public class student implements serializable { string name; string id1,phone,clas; ...