Posts

Showing posts from March, 2014

yii2 - yii framework - implement routing by request params -

is there way implement routing based on request params? example, /v1/articles - action `serve_articles` /v1/articles?type=list - action `server_filtered_by_list` the simplest way form me you can add (eg: index) action param need purpose public function actionindex($type, $param2, $param3) { ... code inclus call action in controller or .... redirect or .... render return $this->render('index', [ 'searchmodel' => $searchmodel, 'dataprovider' => $dataprovider, ]); }

Variable shadowing in Java -

this question has answer here: slight confusion regarding overriding variables concerned 5 answers i having doubts java code. output gives "furry bray". questions: why output? how can access string object reference "name" in zookeeper class? if has variable shadowing, variable being shadowed? code: class mammal { string name = "furry "; string makenoise() { return "generic noise"; } } class zebra extends mammal { string name = "stripes "; string makenoise() { return "bray"; } } public class zookeeper { public static void main(string[] args) { new zookeeper().go(); } void go() { mammal m = new zebra(); system.out.println(m.name + m.makenoise()); //output comes "furry bray". please explain this. //and how can access name variable, 1 having "str

I want to create .exe file to create multiple folder at a same time -

i want create .exe setup or batch file create multiple folders @ same time. , folder name prompt give or take .txt file. if ok enter name of folder each time, can use md command of windows command line! syntax: md myfoldername

android - Read version.properties file laying in the root folder -

version.properties laying in root of folder. reading file gradle. want read same activity. how can read file. i getting file no fount exception on following code: file file = new file("/module/version.properties"); fileinputstream fis; string content = ""; try { fis = openfileinput(file); } catch (ioexception e) { e.printstacktrace(); } now want read same activity. how can read file. you put file somewhere else, such assets/ or res/raw/ . file not packaged in application. or, in gradle, use properties buildconfigfield put properties in buildconfig .

indexing - Custom index comparator in MongoDB -

i'm working dataset composed probabilistic encrypted elements indistinguishable random samples. way, sequential encryptions of same number results in different ciphertexts. however, these still comparable through special function applies algorithms sha256 compare 2 ciphertexts. i want add list of described ciphertexts mongodb database , index using tree-based structure (i.e.: avl). can't apply default indexing of database because, described, records must comparable using special function. an example: suppose have database db , collection c composed following document type: { "_id":objectid, "r":string } moreover, let f(int,string,string) following function: f(h,l,r) = ( sha256(l | r) + h ) % 3 where operator | standard concatenation function. i want execute following query in efficient way , such in collection suitable indexing: db.c.find( { f(h,l,r) :{ $eq: 0 } } ) for h , l chosen arbitrarily not constants. i.e.: suppose want fi

android - Cordova add multiple line in local notification -

in cordova project platform of ios, android using local notification plugin , working fine , want add full text content without truncate(... single row end of line). following :- https://github.com/katzer/cordova-plugin-local-notifications/pull/92 i want add view : - "username", it's time row 1 (product 1) productname row 2 (product 2) productname because gives note. please let me know if expert has do. thanks for need store data either on device or on database. if doing on device need call accordingly. inject proper plugin (local or session, local preferred). recommend not doing locally rather thank making doing in database. how collect gcm id , feed server user , whenever need send notification spun heroku , send it(automating easy in process) .

Android Spinner Initial Padding -

i creating android app consists of form. form needs have edittext , spinners side-by-side (for chose linearlayout ). my final goal have text in spinner align vertically text in edittext ; however, want have padding on options in expanded spinner . padding messes spinner alignment appears in form. here code custom spinner list item: <textview android:id="@+id/transportation_spinner_item_textview" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" android:textcolor="@android:color/black" android:textsize="18dp"/> here code main form: <linearlayout android:id="@+id/linearlayout6" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/divider3" android:orientation="horizontal"&g

How can I conjoin this parent and child class in python? -

class parent: def __init__(self, host, data, user, password): self.db = mysql_database(host, data, user, password) self.db.connect() def is_connected(self): return self.db.is_connected() def get_locations(self, query): if self.is_connected(): return self.db.execute(query) else: return none def close(self): self.db.close() class child(parent): def get_locations(self, query): cursor = super().grab_locations(query) results = [] if cursor != none: (name,lat,long) in cursor: locate = location(name,lat,long) results.append(locate) return results i'm grabbing code database. i'd convert code 1 class if possible, i'm confused on how. do mean want combine get_locations this: def get_locations(self, query): results = [] if self.is_connected(): cursor = self.db.execute(query) (na

File extension for html snippet -

my program generates html documents based on parameters, 1 part static , fetched local text file. what file extension appropriate such snippet have? htm(l): not proper html document, since has no <html> tag etc. txt: not plain text file either. something else?

ios - UISlider set thumb clear background -

Image
haw can in uislider set thumb clear background like in ios camera you have add thumb image has circular border , transparent possible option far know

Google cloud - Not able to delete VM machines -

i new google cloud. sometime managed deploy code on cloud. i created 2 vm instances. facing following problem, whenever deploy new build using cloud sdk(gcloud preview app deploy app.yaml --set-default), brings new machine. weird. tried delete vm instances in console ( https://cloud.google.com/compute/docs/instances/stopping-or-deleting-an-instance#delete_an_instance ), seems deleted few minutes , comes console again , again. can please how resolve issue?. since have not used version flag ( --version version ) gcloud command, deploys new version of application , consequently spin new vm instances. to fix this, take @ answer @ link .

java - Play Framework Hanging when hitting app in browser -

i running app in play using activator run , , maybe 3 out of 5 times, hang, when go http://localhost:9000/ , sits there spinning forever. i'm seeing lot of promise timed out errors also. where should issue? i turned logging loglevel := level.debug , see nothing amiss. while app spinning, see no logging @ all. if let sit , spin long time (~5 min) give error: [info] play.api.http.httperrorhandlerexceptions$$anon$1: execution exception[[privilegedactionexception: null]] [info] @ play.api.http.httperrorhandlerexceptions$.throwabletousefulexception(httperrorhandler.scala:265) ~[play_2.11-2.4.3.jar:2.4.3] [info] @ play.api.http.defaulthttperrorhandler.onservererror(httperrorhandler.scala:191) ~[play_2.11-2.4.3.jar:2.4.3] [info] @ play.core.server.server$class.logexceptionandgetresult$1(server.scala:50) [play-server_2.11-2.4.3.jar:2.4.3] [info] @ play.core.server.server$$anonfun$gethandlerfor$4.apply(server.scala:59) [play-server_2.11-2.4.3.jar:2.4.3] [info] @ play.

javascript - Get a list of all checked checkboxes -

i figure out checkboxes checked , tried code: $('.feature input[type="checkbox"').serialize(); this how html looks like: <div class="feature"> <h2>features</h2> <label><input class="custom_css" checked="" type="checkbox" name="feature[]"> custom css (style.css)</label> <label><input class="custom_js" checked="" type="checkbox" name="feature[]"> custom javascript (script.js)</label> <label><input class="modernizr" type="checkbox" name="feature[]"> modernizr</label> <label><input class="google_maps" type="checkbox" name="feature[]"> google maps</label> <label><input class="custom_api" type="checkbox" name="feature[]"> custom api</label> <label><input clas

history across sessions in ipython using python-mode.el in emacs -

how save history across sessions in ipython using python-mode.el in emacs. sure feature works when run ipython @ command prompt rather within emacs thanks. python-mode 6.2.1+ ipython 1.2.1 emacs 24.3.1 afaik it's broken currently. bug report resp. feature request welcome @ https://gitlab.com/python-mode-devs/python-mode/issues

How to work out average of scores from a text file Python -

i want find out how sort out averages of scores text file, text file this: matt 3 john 6 gucci 7 notice there 1 space inbetween name , score. from text file work out average of entire files content (scores). my current code following: print("write 'avg' work out average of scores") option = input ("\nenter option: ") list = [] option_class = input("\nwhich class wish preview: ") 1 = "1.txt" 2 = "2.txt" if option =='avg'.lower(): if option_class == "1": name = input("\nwhat name? - ") found = false open(one, 'r') f: data = f.readlines() line in data: if name in line: print("\n",line) list.append(int(line.split()[2]))

java - Adding a Single Column in a DataBase using Hibernate AutoDDL? -

i have 1 database having 10 schemas , in have 1 table name common in each schema. i have add single column in sql database using autoddl.but problem defining 10 hibernatecfg files , defining single mapping file having configuration of 10 schemas. can guide me how can make code generic , fast? generic mean can define more 1 hibernate cfg file single database. is standard way of doing things? i have done configuration this: hibernate.cfg.xml subscription.hbm.xml

c++ - Using a template function in a template class -

this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i have following (simplified) code: #include <iostream> class foo { public: template<class t> static size_t f() { return sizeof(t); } }; template<class a> class bar { public: template<class b> static void f(b const& b) { std::cout << a::f<b>() << std::endl; } }; int main() { bar<foo>::f(3.0); return 0; } it compiles fine in msvc, in gcc (5.2.1) gives following error: main.cpp:16:26: error: expected primary-expression before ‘>’ token std::cout << a::f<b>() << std::endl; ^ (followed few hundred lines of cout-related errors). suppose doesn't realize a::f can template function? breaking in standard? you need put keyword templ

c - NET-SNMP agent trap v3 configuration -

im trying implement agent trap v3 sender using net-snmp. currently status im able start snmpd , daemon sending coldstart trap host defined in snmpd.conf my snmpd.conf: createuser myuser sha "12345678" aes rouser myuser auth trapsess -v 3 -u myuser -n contextname -l authpriv -a sha -a 12345678 -x aes - x 12345678 host_ip:162 group groupv3 usm myuser ## incl/excl subtree mask view included .1 80 access groupv3 "" auth exact var/net-snmp/snmpd.conf contain hash user, if im using snmptrap command in linux can see trap recived host wireshark sniffer. but im unable send traps code (im restricted c, embedded system). im using send_v2trap() api, , when im defined vars list nothing sent out. im not sure need define, need open session or snmpd.conf file enough? need define send trap via code? i tried use examples pro

node.js - Running a JavaScript program requiring jsfeat -

i have downloaded jsfeat here , , unzipped downloaded file. inside directory, wrote following: require("./build/jsfeat.js"); var matrix = new jsfeat.matrix_t(2,2, jsfeat.u8_t | jsfeat.c1_t); matrix.data[1] = 4; console.log(matrix.data[1]); i ran program follows: $ node matrix.js but, got following error: /users/abc/desktop/javascript/inspirit-jsfeat-59cc928/matrix.js:2 var matrix = new jsfeat.matrix_t(2,2, jsfeat.u8_t | jsfeat.c1_t); ^ referenceerror: jsfeat not defined @ object.<anonymous> (/users/abc/desktop/javascript/inspirit-jsfeat-59cc928/matrix.js:2:19) @ module._compile (module.js:425:26) @ object.module._extensions..js (module.js:432:10) @ module.load (module.js:356:32) @ function.module._load (module.js:311:12) @ function.module.runmain (module.js:457:10) @ startup (node.js:136:18) @ node.js:972:3 why that? how can solve issue? thanks. you need assign imported module variab

Fibonacci sequence program in python working fine except for input 0 -

this program showing correct output except input n=0. def fib(n): f=list() i=0 while(i<=n): f.append(i) i+=1 f[0]=0 f[1]=1 in range(2,n+1): f[i]=f[i-1]+f[i-2] i+=1 return f[n] n=int(input()) print(fib(n)) when give input n=0, shows following error: traceback (most recent call last): file "fib.py", line 16, in <module> print(fib(n)) file "fib.py", line 10, in fib f[1]=1 indexerror: list assignment index out of range two lines in middle not necessary due initializing elements during while loop. , error comes fact, n=0 , adding 1 elemnt list. , after changing value of first , second element. there no second element. def fib(n): f=[] i=0 while(i<=n): f.append(i) i+=1 in range(2,n+1): f[i]=f[i-1]+f[i-2] i+=1 return f[n] n=int(input()) print(fib(n))

linux - Can mmap and O_DIRECT be used together? -

as understand it, when mmap file mapping pages page cache file directly process, , when use o_direct bypassing page cache. ever make sense use 2 together? if understanding right how work? mmap seems rely on file being in page cache , o_direct seems prevent going there (assuming nothing else on system has file open). found this question answerer seems think it's normal do.

apache spark - How to write a transformation function to transform RDD with reference to a Graphframe object? -

i have graphframe object: g , rdd object: candidate: g = graphframe(v,e) candidates_rdd.collect() # [row(source=u'a', target=u'b'), # row(source=u'a', target=u'c'), # row(source=u'e', target=u'a')] i want compute path "source" "target" in candidates_rdd , generate result rdd key, value pairs ((source, target), path_list) using graphframe's breadth first search, path_list list of paths source target. example outputs: (('a','b'),['a-c-b','a-d-e-b']), (('f','c'),[]), (('a',d'),['a-b-e-d'] i wrote below function: def bfs_(row): arg1 = "id = '" + row.source + "'" arg2 = "id = '" + row.target + "'" return ((row.source, row.target), g.bfs(arg1,arg2).rdd) results = candidates_rdd.map(bfs_) i got error: py4jerror: error occurred while calling o274.__

c# - Get localized list/site name from SharePoint 2013 on-premise with CSOM -

Image
i have multilingual sites on sharepoint 2013 server (on-premise) , retrieve localized sites , lists name via .net managed api (csom) in c#. i tried use "titleresource" property object web object , getvalueforuiculture() method : var web = spcontext.web; var webtitleres = web.titleresource; var webfrenchtitle = webtitleres.getvalueforuiculture("fr").value; spcontext.executequery(); but crashes @ last line saying field/property doesn't exist: i tried update web's "localeid" value showed in sample app office pnp project : check here but server throw exception, saying don't have enough permission : well, don't want update localeid on server, want locally retrieve localized titles seems wrong way. how can retrieve localized title's string sharepoint server? missing? update for reference, seems titleresource , descriptionresource attributes accessible "online" version of sharepoint, yet msdn doc doesn

typescript1.8 - Typescript Decorators state -

typescript version: 1.8 hello, we have case use typescript decorators in our project there next lines in https://www.typescriptlang.org/docs/handbook/decorators.html : decorators stage 1 proposal javascript , available experimental feature of typescript. note  decorators experimental feature may change in future releases. so have next questions: 1) decorators' syntax changed in future? 2) use decorators production? will decorators' syntax changed in future? it may. although seems unlikely @ stage due prevalence. could use decorators production? i use them third party libraries time (e.g. @connect in redux). weary create them myself (the burden on creator) 🌹

android - CountDownTimer strange behaviour -

hello , in advance!, i've got countdowntimer want make pause while show increasing count 1 given number, interval. thing that, code below, counter 29 28 , don't know why. can me?. public void countdown(view v) { int finishnumber = 30; final countdowntimer countdown = new countdowntimer(finishnumber * 100, 100) { int numbertoshow = 1; public void ontick(long millisuntilfinished) { copyrighttv.settext(string.valueof(numbertoshow++)); } public void onfinish() { copyrighttv.settext(string.valueof(numbertoshow)); this.cancel(); } } .start(); } it's not such strange behaviour - take consideration first ontick(long millisuntilfinished) invoked after 100ms (that interval you've set), , not when start countdowntimer. secondly countdowntimer not 100% precise timer, can expect "strange behaviour". edit if accuracy not ext

http - masking data in logstash using web service -

i receiving data using logstash (2.3) , want mask them or add additional field, using external web service source. i have web service available @ like: someserver:8080/webpage?id=1 i extract value using url, , inject data. my config file looks like: input { file { path => "/opt/logstash/test/*.csv" start_position => "beginning" sincedb_path => "/opt/logstash/test/output/test.db" } http { url => "http://localhost:8080/webpage" } } filter { csv { columns => ["col1", "col2", "col3" ] separator => "," skip_empty_columns => true } } output { stdout { codec => rubydebug } csv { fields => ["col1","col2","col3" ] path => "/opt/logstash/test/output/test.csv" } }

rspec - Why does vim "cancel out" the last two characters when running `%:8` in an external command? -

a simple work flow use when running rspec test have been working on, in vim , follows: 15: "my example test" 16: expect(1 == 1).to true 17: end and run test, can do: !rspec %:15 this runs rspec external command . % expands current filename, , :15 tells rspec run test line 15 , rather tests in file. this technique works fine under normal circumstances. however, if try run test on lines 80-89 strange happens: 84: "my other test" 85: expect(4 > 3).to false 86: end !rspec %:84 this runs command rspec [filename]4 - i.e. :8 characters disappear! (and "file not found" error.) a workaround avoid problem press tab after entering % , expands % full path name. however, what's reason behind strange vim behaviour? bug, or feature? a different, related question led me finding answer this. you can find answer, along more detail, running :help filename-modifiers in vim . here summary of key point:

Access: Combine 2 Fields in 1 with SQL Code -

i'm trying combine 2 field in 1 in table. shall excecuted clicking on button. thought work this: private sub button_click() dim strsql string strsql = "select table.field1 & "" & table.field2 table.field12" currentdb.execute strsql end sub clearly isn't working @ all. any ideas how solve problem? if wish update, must use action query, like: strsql = "update table set field12 = field1 & field2" if wish select, must valid select query: strsql = "select *, field1 & field2 field12 table" but cannot "execute". however, can open recordset.

fetchedResultsController.fetchedObjects crashes on iOS 10 beta 1 and Swift 2.3 -

summary: when try access fetchedresultscontroller.fetchedobjects app crashes , printed error as: fatal error: nsarray element failed match swift array element type steps reproduce: call fetchedresultscontroller.fetchedobjects after fetchedresultscontroller.performfetch. try convert fetchedresultscontroller.fetchedobjects nsmanagedobjects . app crashes. expected results: fetchedresultscontroller.fetchedobjects should accessible in swift. ios version: ios 10 beta 1 xcode version : 8.0 beta swift : 2.3 thanks! this issue has been resolved once upgraded swift code swift 3.0 . thanks!

math - Equal probability in Java -

how can math.random() call have absolute equal probability 4 cases? (ie 0.25 case 1, 0.25 case 2, 0.25 case 3, 0.25 case 4)? i 0.05 case 1, 0.075 case 2, 0.45 case 3 , 0.425 case 4. been trying work out why hours not success. int direction = 0; // select random number randno = (int) math.round(math.random() * 3); // convert direction while (direction == 0) { if (randno == 0 && !iswall(robot, robot.left)) direction = robot.left; else if (randno == 1 && !iswall(robot, robot.right)) direction = robot.right; else if (randno == 2 && !iswall(robot, robot.behind)) direction = robot.behind; else if (!iswall(robot, robot.ahead)) direction = robot.ahead; else randno = (int) math.round(math.random() * 3); } math.random() * 3 results in values in range [0, 3) . appplying math.round means: [0, 0.5) becomes 0. - 0.5 out of 3 means 1/6th probability

c++ - Preventing library internal stuff from beeing visible in .h -

first things first: know thats it's quite probable question based on general missunderstanding, hope can make point clear you. i know when putting code diffrent files in c++ have create .h (for definitions) , .cpp (for implementations). when writing class-library example have put definitioj of both, private , public members in header. if - reason - want hide private things user? thanks! you use pimpl idiom. pimpl stands "pointer implementation". basically, don't store implementation details in class. instead store opaque pointer implementation such: class myclass { public: //public functions here private: class impl; //no definition, opaque impl* pimpl; }; and go on define myclass::impl class in .cpp file only, because function definitions need it. the pimpl idiom has additional benefit long interface of class not change, changes made implementation not require recompilation of class clients.

three.js - Threejs Adding a shader to a 3d object -

i'm trying create shader 3d object generated maya. i can 3d object load, when try apply shader i'm getting error: gl error :gl_invalid_operation : gldrawelements: attempt access out of range vertices in attribute 1 from have read, understand need define vertices, have no idea on how this. here code: <html xmlns="http://www.w3.org/1999/xhtml"><head> <title>3d render</title> <script src="js/three.min.js"></script> <script src="js/objloader.js"></script> </head> <body onload="start()" > <script> var gl; var camera, cubecamera, scene, renderer; var intervalprogress; var fov = 70, lon = 0, lat = 70, phi = 0, theta = 0; init(); animate(); function init() { camera = new three.perspectivecamera( fov, window.innerwidth / window.innerheight, 1, 1000 ); scene = new three.scene()

ios - Project-Swift.h file failed to compile due to "Elaborated type refers to a typedef" error -

summary: have added streamdelegate method public func stream(_ astream: stream, handle eventcode: stream.event) swift class , compiled project. while generating project-swift.h , complier failed compile , show error elaborated type refers typedef . steps reproduce: 1. add streamdelegate swift class. 2. add public func stream(_ astream: stream, handle eventcode: stream.event) class. 3. compile project. expected results: project-swift.h file should compiled properly. actual results: error on project-swift.h file @ line : - (void)stream:(nsstream * _nonnull)astream handleevent:(enum nsstreamevent)eventcode; temporary fix: if remove enum keyword on project-swift.h @ of - (void)stream:(nsstream * _nonnull)astream handleevent:(enum nsstreamevent)eventcode; , project compiled , build succeeded. ios version: ios 10 beta 1 xcode version: xcode 8 beta swift version: 2.3 or 3.0 i found work around avoid above error adding @nonobjc keyword in front of func stream(_

vba - Rename Field Name to Illegal Name & Output to .fac file -

good day i have table of following format: heading1 heading2 heading3 data1 data2 data3 current vba code used output table comma delimited text file: docmd.transfertext acexportdelim, , "table", "c:\output.txt", true i require table output comma delimited ".fac" file file type unique application called "prophet". unable using current code. if change ".txt" ".fac", access produces following error: "cannot update. database or object read-only." i require "heading1" changed "!2". cannot change "heading1" "!2" in datasheet view since special characters not allowed in headings of tables within access. any help/guidance appreciated. regards josh

apache spark - integrating scikit-learn with pyspark -

i'm exploring pyspark , possibilities of integrating scikit-learn pyspark. i'd train model on each partition using scikit-learn. means, when rdd is defined , gets distributed among different worker nodes, i'd use scikit-learn , train model (let's simple k-means) on each partition exists on each worker node. scikit-learn algorithms takes pandas dataframe, initial idea call topandas each partition , train model. however, topandas function collects dataframe driver , not i'm looking for. there other way achieve such goal? scikit-learn can't integrated spark now, , reason scikit-learn algorithms aren't implemented distributed work on single machine. nevertheless, can find ready use spark - scikit integration tools in spark-sklearn supports (for moments) executing gridsearch on spark cross validation.

playframework - Play framework return error: no suitable method found for ok(ArrayList<String[]>)] -

i want play framework send arraylist android application. can view list on android app. play framework cannot return arraylist) how can solve this? thank you. public static result get_latestlist() throws classnotfoundexception, sqlexception { string latestlist = ""; arraylist<string[]> etlist = new arraylist<string[]>(); multipartformdata body = request().body().asmultipartformdata(); string pagenumber = body.asformurlencoded().get("pagenumber")[0]; connection conn = null; statement stmt = null; resultset rs = null; class.forname("com.mysql.jdbc.driver"); conn = drivermanager.getconnection("jdbc:mysql://localhost/iea_db", "rt", "yt"); stmt = conn.createstatement(); rs = stmt.executequery("select * list_table;"); while (rs.next()) { string[] oneset = new string[4]; oneset[0] = rs.getstring("username");

ocaml - Having trouble creating arbitrary new Object, parametrized for function call -

i wanted kind of expression in ocaml let wrapper obj f = fun raw -> f (new obj raw) but compiler error of unbound class obj what, why isn't compiler satisfied creating function says call function on object happens take 1 init arg. pass function constructs object. one-argument class foo can use new foo function. let wrapper make_obj f raw = f (make_obj raw) class foo (x) = object method y = x + 1 end let answer = wrapper (new foo) (fun o -> o#y) 2 here, wrapper has general type doesn't mention objects @ all. if want make clear object constructor expected argument, can restrict type annotation: let wrapper (make_obj: (_ -> < .. >)) f raw = f (make_obj raw)

richfaces - <h:outputText> not showing JTiday parsed data in <rich:popupPanel> -

i using jsf 2.2 , richfaces 4.5.1. in 1 of rich:popuppanel using h:outputtext tag show html data parsed jtidy. data response 1 of web services using. jtidy adds cdata tag in parsed html seems primary reason why data not showing on screen. if remove cdata working fine , if put h:outputtext tag out of rich popup panel working fine cdata. can 1 tell me reason why cdata cause of h:outputtext not showing data when part of rich:popuppanel ? here's popup: <rich:popuppanel modal="true" width="600" id="responsepanel" autosized="true" style="positon: relative;"> <f:facet name="header"> <s:span id="responsepanelheader"> <h:outputtext style="text-decoration:underline" value="#{armreportfile.armreport.providertype}" /> </s:span> </f:facet> <f:facet name="controls"> <

qt - Drawing extra item in QGraphicsItem during hover event -

i create coordinate points on qgraphicsview . when mouse hovers on point, coordinate shown. i draw coordinates qgraphicsellipseitem . in order enable hover event, need re-implement qgraphicsellipseitem . however, because size of qgraphicsellipseitem fixed when constructed, hover text not shown properly. how can deal this? here code: the mainwindow: mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) { view = new qgraphicsview(this); view->setrenderhint(qpainter::antialiasing); scene = new qgraphicsscene(this); view->fitinview(scene->scenerect(), qt::keepaspectratio); view->setscene(scene); setcentralwidget(view); (int y = 0; y < 900; y += 100) for(int x = 0; x < 1400; x += 100) drawpoint(x, y); } void mainwindow::drawpoint(int x, int y) { coordinatepoint* point = new coordinatepoint(); point->setrect(qrect(x, y, 3, 3)); point->setpen(qpen(qt::red, 3, qt::solidline)); po

asp.net mvc - Firebase 3: creating a custom authentication token using .net and c# -

i'm trying implement firebase 3 authentication mechanism using custom tokens (as described @ https:// firebase.google.com/docs/auth/server/create-custom-tokens). my server asp.net mvc application. so according instructions ( https://firebase.google.com/docs/server/setup ) i've created service account firebase application , generated key in '.p12' format. after according instructions here ( https://firebase.google.com/docs/auth/server/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library ) tried generate custom token , sign using key received on previous step. token generation used systemidentitymodel.tokens.jwt library microsoft, code looks following: var = datetime.utcnow; var tokenhandler = new jwtsecuritytokenhandler(); var key = new x509asymmetricsecuritykey(new x509certificate2(p12path, p12pwd)); var signincredentials = new signingcredentials(key, "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "http://www.w3.org

ios - How to use inheritance with Swift and ObjectMapper? -

i'm new swift , have serialize object structure json string in ios( ios >= 8) project. decided use objectmapper library (i integrated cocoapod). but problem structure following. objecta can have list of children objects array stored in instance variable. objects can stored in instance array can of multiple types, objectb , objectc. so, in java gson have created interfaced , made both of classes implement , made array in objecta store interfaced types, can't figure how swift object model results in empty {} json objects. the resulting json should this. {"children":[ {"type":"objectb", "value1":"foo"}, {"type":"objectc", "value1":"bar", "value2":"baz"} ]} and {"children":[ {}, {} ]} notice 2 entries have serialized objecta , objectc should have different structures. i tried multiple things each times i'm stuck in dead end. tr

jquery - Form validity constantly returns true regardless of validator in the model -

Image
i'm using jquery hide , disable submit button until form has been validated paperclip's validates_attachment_file_name it showing button form clicked on , continued show button regardless of file selected. i called .checkvalidity() on form , found out returning true. once when form clicked on , again when (any) file selected. ruby model: has_attached_file :file validates_attachment_file_name :file, matches: [/string\z/] jquery: $('#form').bind('change click', function() { if ($(this).valid()) { $('#submit').attr('disabled', false); $('#submit').show(); } else { $('#submit').attr('disabled', true); $('#submit').hide(); } }); what missing? where's ajax? you're calling javascript function validate ruby value. as should aware, javascript client-side, ruby server-side. js can read what's literally printed in "dom" (document o

html - How do I unhover on a link using CSS/JavaScript? -

i'm using css set links red when hover on them. clicking on them open new tab, links remain hovered(red). possible unhover on button click? looks bad, on mobile. css: a:hover { color: red; } html: <a href="www.example.com" target="_blank">open site in new tab, remains red</a> the state of link i.e. a tag focus after have clicked on , have not clicked anywhere else. so, want change style :focus state of anchor tag. css: a:hover { color: red; } a, a:focus { color: green; /* or whichever default color */ } /* can add same or different style a:visited state, applies anchor tags have been visited */ html: <a href="www.example.com" target="_blank">open site in new tab, remains red</a>

java - getResourceAsStream returns NullpointerException -

this question has answer here: getresourceasstream() returning null [duplicate] 7 answers in spring, want image display on browser. image located in main project i.e. > myproject - src - target - img.png this means img.png in root dont supply path returns nullpointerexception . tried adding image in src , changed path src\img.png still gave npe. please note, project using maven. stack trace: java.lang.nullpointerexception: null @ org.apache.commons.io.ioutils.copylarge(ioutils.java:1792) ~[commons-io-2.4.jar:2.4] @ org.apache.commons.io.ioutils.copylarge(ioutils.java:1769) ~[commons-io-2.4.jar:2.4] @ org.apache.commons.io.ioutils.copy(ioutils.java:1744) ~[commons-io-2.4.jar:2.4] @ org.apache.commons.io.ioutils.tobytearray(ioutils.java:462) ~[commons-io-2.4.jar:2.4] here code use: inputstream in = dataservice.class.getresour

android - Is there an ADB command to toggle Allow Mock Locations? -

i've searched through topics haven't found answer. need not specify lat/long turn switch of allowing mock locations. in marshmallow (and above) after have installed app, run: adb shell appops set com.example.my.package android:mock_location allow hope helps! some internals: string android:mock_location resolved appopsmanager actual int , executed.

html - Table with 3 headers but two columns -

is there way type of table using html / css? header1 | header2 | header 3 --------+---------+---------- 0 | 1 asdasdasdasd 7 2 | 5 asdasdasdasd 3 9 | 7 asdasdasdasd 2 if have <table> markup <td colspan=2> you. if want <div> s , pure css need called grid systems

java - Track score in an android quiz app -

i want register correctanswers every question that's answered, moves next question after 1 of alternatives clicked. want display amount of correct answers on xml file contains textview that's going hold score right after last question answered i have picture of flag , textview question 4 buttons beneath alternatives. i think have gone through entire internet, have been stuck days. appreciate help.:) if there unclear, please feel free ask. this question class holds question, pictureid (for country flags in quiz), option a, b, c , correct answer. holds score. public class question { private int bildid; private string question; private string opta; private string optb; private string optc; private string answer; private string score; //constructor public question(int bildid, string question, string opta, string optb, string optc, string answer) { this.bildid = bildid; this.question = question; this.opta