Posts

Showing posts from March, 2013

numpy - Ignore divide by 0 warning in python -

i have function statistic issues: import numpy np scipy.special import gamma gamma def foo(xdata): ... return x1 * ( ( #r numpy vector ( ((r - x2)/beta) ** (x3 -1) ) * ( np.exp( - ((r - x2) / x4) ) ) / ( x4 * gamma(x3)) ).real ) sometimes shell following warning: runtimewarning: divide 0 encountered in... i use numpy isinf function correct results of function in other files need do. not need warning. there way ignore message? in other words, not want shell print message. i not want disable python warning, one. you can disable warning numpy.seterr . put before possible division zero: np.seterr(divide='ignore') that'll disable 0 division warnings globally. if want disable them little bit, can use numpy.errstate in with clause: with np.errstate(divide='ignore'): # code here for 0 zero division (undetermined, results

excel - Build a pivot out of an array built and named in VBA -

i'm trying reference source data of pivot name. have following code: set rng1 = sheets("cala current credit usage").range("a1:l235") set rng2 = sheets("cala forecast credit usage").range("a2:l235") dim myarray() totalrows = rng1.rows.count + rng2.rows.count + 1 redim preserve myarray(1 totalrows, 1 rng1.columns.count) = 1 rng1.columns.count j = 1 rng1.rows.count myarray(j, i) = rng1.cells(j, i) next j next j = j - 1 '''''' h = 1 rng2.columns.count w = 1 rng2.rows.count myarray(w + j, h) = rng2.cells(w, h) next w next h activeworkbook.names.add name:="resultingrange", refersto:=myarray but when linked pivot resultingrange got: data source reference not valid. any ideas?

java - LatinIME dicttool for use with a V401 Binary Dictionary -

i’m trying convert version 401 binary dictionary -- directory called personalizationdictionary.en_us.dict -- human readable .xml. the command line utility dicttool_aosp in packages/inputmethods/latinime/tools/dicttool can so: dicttool_aosp makedict -s sourcedict.dict -x output.xml i’m unable compile android lollipop version of dicttool, since dicttool has native c++ dependencies don’t play nice mac. note line in nativelib.mk file of dictool: hack: temporarily disable host tool build on mac until build system ready c++11. i hoping compatible setup can compile utility me using “make dicttool_aosp” root of aosp source tree. i've spent past few days looking compiled versions of it, , while i’ve found many makedict.jar files online, old support newer v401 binary dictionary. main difference between v401 , older versions v401 split multiple files extensions .bigrams, .freq, .header, whereas older dicts contained in single file. thank you, please let me know if can clarify

iPhone WebApp Autoplaying Embeded Youtube -

this problem i've been noticing since youtube embed design change, @ least i've noticed. so what's happening web pages have been added homescreen have youtube video embedded autoplay first youtube video on screen in youtube app. doesn't happen when open same web page opened in safari. basically web pages have youtube video embedded inaccessible due automatically redirecting youtube app. how can stop this? or they've added can't fixed? update : found similar question proper workaround embedded youtube videos in html5 standalone app ios 8.3 opening youtube app unfortunately, workaround i've found far disallow web application runs in full-screen mode removing: <meta name="apple-mobile-web-app-capable" content="yes" /> neither postponed iframe injection dom, nor putting iframe in iframe helps. i hope not intended behaviour , resolved via ios update; though until have use server-side detect os 8_3 in useragen

c# - What is the code for update in LINQ Method in EF? -

usually use following code update using linq method: var original=context.division.where(c=>c.divisionid==adivision.divisionid).firstordefault(); context.division.applyoriginalvalues(original); context.division.applycurrentvalues(adivision); context.savechanges(); but way update in new version of ef? i tried following code , works update. context.division.attach(adivision); context.entry(adivision).state=entitystate.modified; context.savechanges();

twitter - Opening the iOS8 share menu without a share button -

i want show share button in unity ios game, , when user taps open sharing menu standard cocoatouch share button. reference i've found far says open share menu add standard share button. don't have option. i'm hoping there's simple objc call can pass image , have open sharing menu on top of unity game. that might not possible, given nature of opengl surfaces , cocoatouch. if that's case, i'd know if there's simple way share directly twitter, , documentation that. it sounds uiactivityviewcontroller class want, i'm not familiar enough how you'd wire unity give complete answer. you'll need present activity view controller view controller. i'm not sure how unity wraps stuff up, there's chance there's 1 attached main uiwindow (uiwindow has rootviewcontroller property). if can @ things somehow, present there. for example involve this: nsarray *itemstoshare = @[@"perhaps high score/brag string here?"]; uiwind

ServiceStack.Redis Cache Cleared when application restarted -

i using redis caching, using icacheclient in 1 of services write , read directly cache using , set etc. redis set persist values disk. if shut redis down , restart again, cached data there. however, if run servicestack services in debug mode , stop website , restart again, servicestack clear redis cache on first call made servicestack service. how can switch off, or bug. items in cache should not expire , when checking individual items in cache, set not expire, not expiring, servicestack seems flush database on first call after restart. public icacheclient cacheclient { get; set; } public object get(keyvalues request) { var value = cacheclient.get<object>(request.key); var response = new keyvaluesresponse { key = request.key, value = value }; return value; } public void put(keyvaluesrecord request) { if (request.key != null) { cacheclient

memory - Finding base address of DLL in VB.net -

so asked similar question 2 weeks how find base address of application im wondering on how find dll ? (not dll of application im building of application running on system) sub main() each _process process in process.getprocesses if (canaccessprocess(_process)) each _module processmodule in _process.modules console.writeline(_module.baseaddress) next end if next console.readline() end sub function canaccessprocess(_process process) try dim temp processmodule = _process.mainmodule temp = nothing catch ex system.componentmodel.win32exception ' 64 bit process return false end try return true end function this show baseaddresses of modules of processes can access. tries access process main module first see if exception raises. if raises know don't have access process.

javascript - jQuery Toggle doesn't work properly and mixes up animations -

Image
i want achieve following: when user click on link "a#showhideuser", several animations performed: .users shown (it class taking whole screen , darkens it) user1 #user2 , #user3 displayed (just showing profile picture , user-name) blending in changing height of classes. when link pressed again, should disappear again. it should more or less old tumblr-app "new entry"-menu the problem toggling works perfectly, doesn't. have observed these possibilities after clicking link: everything works fine (both slide in , slide out again) .users displayed fine, other 3 divs disappear instead of sliding in (mostly happens when clicked link several times already) when wait little, 3 divs appear again .users displayed fine, other 3 divs appear disappear again. here well: when wait little, 3 appear again that's code (all in same .js-file) (updated) $(document).ready(function () { $('.route').hide(); $('a#showh

c# - Excel COM Add-In, with Auto-Completion and Documentation -

i have develop " something " provides functions , ribbons excel. example there should function connects internet, , returns current temperature of place (which parameter). , there should button in ribbons, shows dialog settings (url etc.). i thought, best way accomplish this, excel-add-in. know there 2 ways of providing user defined functions: xll-add-in, , com-add-in. xll-add-in has ugly way of defining ribbons: have provide xml string. refactoring-unfriendly. that's why wanted use com-add-in. read here com-add-in has no auto-completion of udfs in excel. so wondering if there way, , cleanly create ribbons in code , windows in xaml, , still have auto-completion , documentation in excel. thread lets me think, these 2 requirements exclude each other. nevertheless hope there way this. many in advance.

php - CakePHP 2.5 Basic Search different controller -

i writing website application in cakephp, have requirement have search box on homepage (pages/home.ctp, pagescontroller) searches content events page (events/index.ctp, eventscontroller). i want search in fields of events table have 1 input box. when user clicks search or hits enter should taken events/index.ctp page events listed. is possible? if pointers? if not how can achieve similar? thanks steve your actual search should done in model, since that's layer use retrieve data. if you're searching events, you'll put search() method in event model. then, in controller, can access search() method. controller in depends on number of things can take account. if you're in events controller: $this->event->search($postdata); if you're in different (but associated) controller: $this->user->event->search($postdata); if you're in different (non-associated) controller: $this->loadmodel('event'); $this->

css shapes - How to wrap text around a path defined in svg (using css)? -

my goal wrap text around shape defined svg. the shape path looking rectangle 1/2 circular hole. <svg width="100px" height="200px" viewbox="0 0 50 100"> <path id="halfcircleleft" d="m 50 26 ... z" style="fill: lightgray;"></path> </svg> in html, define wrapping element <div> <div class="svgleftshape"></div> and set css this: .svgleftshape { shape-outside: url(#halfcircleleft); float: left; width: 100px; height: 200px; } should work, isn't it? well, not working expected! it sounds text wrapped around rectangle defined through css width , height. shape reference svg element ignored ... what doing wrong? in following fiddle , have added 'css' circle on right make sure not missing basics. warning : first, should know css shapes module level 1 actualy (april 2015) has status of "candidate recommenda

Limit to the number of results from a Dataflow input file pattern glob? -

update: we've seen these 400-class errors re: com.google.api.client.googleapis.json.googlejsonresponseexception: 400 bad request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "request payload exceeds allowable limit: 50000.", "reason" : "badrequest" } ], "message" : "request payload exceeds allowable limit: 50000.", "status" : "invalid_argument" } @ com.google.api.client.googleapis.json.googlejsonresponseexception.from(googlejsonresponseexception.java:145) at on glob resolves to: total: 60 objects, 8405391 bytes (8.02 mib) and have been experiencing increased variability of input globs hitting limit on past several days. -- recently we've had observations of job failure when filepattern specs derive large numbers of files passed input dataflow jobs. examples of messages produced in these scenarios are: apr 29, 2015, 9:22:

python - scitkit-learn query data dimension must match training data dimension -

i'm trying use code scikit learn site: http://scikit-learn.org/stable/auto_examples/classification/plot_classifier_comparison.html i'm using own data. problem is, have lot more 2 features. if want "expand" features 2 3 or 4.... i'm getting: "query data dimension must match training data dimension" def machine(): open("test.txt",'r') csvr: reader= csv.reader(csvr,delimiter='\t') i,row in enumerate(reader): if i==0: pass elif '' in row[2:]: pass else: liste.append(map(float,row[2:])) = np.array(liste) h = .02 names = ["nearest neighbors", "linear svm", "rbf svm", "decision tree", "random forest", "adaboost", "naive bayes", "lda", "qda"] classifiers = [ kneighborsclassifier(1), svc(kernel="linear", c=0.025), svc(gamma=2

assembly - How to view the value located in the DS segment via OllyDbg -

Image
i'm debugging 1 dll via ollydbg , found following command: lea ecx,dword ptr ds:[ecx+edx+8771f681] ecx 90c85fff , edx 13f5a9ce , final address 0x90c85fff + 0x13f5a9ce + 0x8771f681 = 0x12c30004e . unfortunately, don't know how view value located @ address. ctrl-g in fpu window says "no memory on specified address". thanks in advance. remember lea can used used calculation, not address (the actual result of calculation never accessed / dereferenced). also, segment override has no effect on calculation. ecx = 0x402000 ; ebx = 0x20 ; fs segment prefix override (fs base = 0x7ffdd000) mov ecx, [ecx+ebx-4] ; result = ecx = 0x40201c to check address mapped, in ollydbg, can stop @ instruction , check mini-window between cpu windows , dump window: the address=xxxx line indicates result of calculation (before executing instruction). if right click line, might see popup window: if address mapped in process address space, you'll see follow

Disallow only spaces after a string - Python 3.3 -

if name = 'steve ' how disallow this? allow 'steve 2' , 'steve' this because printing out keys dictionaries , don't want confusion between names displayed. thanks. if name != name.rstrip(): # disallow

c# - How to check connection is made into a server when using PrincipalContext? -

Image
i need change password of windows user in machine connected in same network. connecting machine using principalcontext method, specified user , change password. private bool changeuserpassword(string servername,string serverip,string adminusername, string adminuserpassword, string username, string newiispassword) { using (var context = new principalcontext(contexttype.machine, servername, adminusername, adminuserpassword)) using (var user = userprincipal.findbyidentity(context, identitytype.samaccountname, username)) { user.setpassword(newiispassword); user.save(); } } the problem won't connection server when providing 'servername' works 'serverip' , vice versa. if connected context.connectedserver show server name, if not showing unknown path or bad username error. if connection not made use serverip parameter using (

swift - Get keyboard size on iOS 8 not working with external keyboard -

been looking @ several post now, none seem me. want uitableview s bottom constraint set keyboard never on top of tableview. seems impossible in ios 8. work when using normal soft keyboard, when removing in simulator or using real hardware keyboard, still thinks there soft keyboard. the code: var currentkeyboardheight:cgfloat = 0.0 override public func viewdidload() { super.viewdidload() nsnotificationcenter.defaultcenter().addobserver(self, selector: "keyboardwillshow:", name: uikeyboardwillshownotification, object: nil) nsnotificationcenter.defaultcenter().addobserver(self, selector: "keyboardwillhide:", name: uikeyboardwillhidenotification, object: nil) } deinit { nsnotificationcenter.defaultcenter().removeobserver(self) } func keyboardwillshow(notification: nsnotification) { if let userinfo = notification.userinfo { var keyboardrect = userinfo[uikeyboardframeenduserinfokey]!.cgrectvalue() let windowrect = view.wind

java - Intellij working with hybrid projects (maven+gradle) -

i'm working on 2 java projects: gradle project , maven project snapshot dependency gradle project. when i'm changing gradle project need install m2 , refresh dependency in intellij. is there way make gradle project sources date @ time maven project without installing m2? you have in intelij : right click on maven project , context menu select open module settings (f4) in right panel select libraries in middle panel select green plus (add library) select java drop-down navigate main directory of gradle project , confirm selection voilà!

JAVA: Receiving multicast UDP datagrams in sockets with same port and different IP multicast, in IPv4, but not in IPv6 -

the problem have java program open multicastsocket same port, , later invokes joingroup(multicast address). each socket have differente multicast address. the machine has enabled ipv4 in interfaces. the behaviour receive multicast messages althoug ip destination different socket opened(the socket have same port). on other hand, if enable ipv6 in interfaces, message same port received in socket have ip destintation + port. example: intefaces ipv4: socket a: ip(224.0.0.3)+port(28200) socket b: ip(224.0.0.2)+port(28200) i send multicast message port(28200), , ip destination(224.0.0.3). result: receive message in both sockets. if change machine interface's ipv6, receive message in socket a.

c++ - dynamic_cast "this" to derived type: when is it legal? -

here code doesn't work, since downcasting "this" in constructor illegal: #include <cassert> class { protected: virtual ~a() {} public: a(); }; class b : public { }; a::a() { assert(dynamic_cast<b*>(this)); } int main(void) { b b; return 0; } as expected, when compiled g++, assertion fails. here code that, however, works (with g++ 4.7, @ least, haven't tried other compilers): #include <cassert> class { protected: virtual ~a() {} public: a() {} void f(); }; class b : public { public: b() { f(); } }; void a::f() { assert(dynamic_cast<b*>(this)); } int main(void) { b b; return 0; } my question is: second code "legal", i.e. can expect compiler work way? my intuition since f() called body of b's constructor, "b" formed instance of type b, makes code legal. yet, i'm still kind of dy

Where are my changes saved when I execute "jspm registry create myregistry jspm-git"? -

i have repository on bitbucket want manage jspm timeouts on lookup where-as coworker prompted username , pass. i'm trying locate registry jspm in order debug - unable , there doesn't seem documentation on it. the reason i'm trying because our steps include running "jspm registry create bitbucket jspm-git" when execute command, previous run throughs exists. want make sure it's using jspm-git package don't know how check either. any appreciated, i've been banging head on hours , going start pursuing different way of obtaining level of management. https://www.npmjs.com/package/jspm-git https://github.com/jspm/jspm-cli you can find jspm registry config here: ~/.jspm/config this json object witch contains registries used jspm, including ones created. need add custom registry first. wont jspm install. have add yourself.

PHP Regex get the last "/" or "\" -

this question has answer here: how last part of url string? 1 answer i have set of data following c://path/path/path/path/xyz.jpg or c://path/path/path/path\xyz.jpg using preg_replace('/(^.*\/)|(^.*\\)/gi', '', $path); i able run in online tester (eg http://www.regextester.com/ ) won't work in php code, please help. you need remove g modifier , double escape \ : $file = preg_replace('/(^.*\/)|(^.*\\\\)/', '', $path); or $file = preg_replace('~^.*[/\\\\]~', '', $path);

java - WildcardQuery Lucene does not work properly -

i trying use wildcardquery: indexsearcher indexsearcher = new indexsearcher(ireader); term term = new term("phrase", queryparser.escape(partofphrase) + "*"); wildcardquery wildcardquery = new wildcardquery(term); log.debug(partofphrase); sort sort = new sort(new sortfield("freq", sortfield.type.long,true)); scoredoc[] hits = indexsearcher.search(wildcardquery, null, 10, sort).scoredocs; but when insert "san " (without quotes), want like: "san diego", "san antonio" etc. getting not these results "sandals" (it must space after san), or juelz santana (i want find sentences start san). how can fix issue? edit also, if insert "san d", have no results. one possible way solve problem - use analyzer, not split query , text in document space. one of possible analyzer - keywordanalzer , use whole data single keyword essential part of test: directory dir = new ramdirec

mongodb - How do I pass a Mongod field selector to a JavaScript function -

i have basic question can't seem find answer to, hope can out! i trying create javascript function return specific result mongodb collection. function has 2 arguments, 1 selector within collection , other 1 field needs retrieved. returnorganisation = function (id, property){ return published.findone({_id:id}).property } the id parameter work return published.findone({_id:id}).name; but when trying add property parameter following error: update failed: mongoerror: '$set' empty. must specify field so: {$mod: {: ...}} so question is: how pass property return (for instance, .name of object in collection) function? i'm sure should not hard do, can't seem work. in advance. use bracket notation syntax access property this: returnorganisation = function (id, property_name){ var result = published.findone({_id:id}); return result[property_name]; }

python - Django - How to simply get domain name? -

this question has answer here: django: url of current page, including parameters, in template 6 answers firstly, want i'm beginner in django. i'm looking simple way retrieve domain name of django website. i want in settings.py. i've tried socket this: socket.gethostname() but doesn't work correctly. if have request object,do request.meta['http_host'] this return hostname

windows installer - Add all items in a subfolder in wix -

i'm trying add items in subfolder using wix , i'm having trouble getting work. folder i'm trying include sourcedir\cgis\plugins. i've tried following command: heat.exe dir "c:\builds\5\agile\enhancements\sources\cgis\plugins" -cg "plugins" -gg -dr "installdir" -out "c:\builds\5\agile\enhancements\sources\installer\installerfiles\pluginsautogenerated.wxs" but resulting wix file has paths set "sourcedir\plugins" , doesn't include "cgis" path. think it's "installdir" part that's screwing up. how fix this? here's generated wix file... <?xml version="1.0" encoding="utf-8"?> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <fragment> <directoryref id="installdir"> <directory id="dirfbc2981ad00f77a864b229d586a8ff4a" name="plugins" /> </directoryref> </frag

MySQL IF statement to check if table is empty -

how can create if statement insert default row if table found empty? i'm following logic wrong. if ((select * mytable)=0) insert mytable (mycolumn) values (myvalue) end if; #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near answer comments (mcadam331) http://sqlfiddle.com/#!9/42229/1 create table mytable( name varchar(100)); insert mytable (`name`) select 'namer' dual not exists (select * mytable); you can use this: /* insert query */ insert mytable ( /* place values in 'from' part of query */ select tbl.* ( select 1 id, 'username' username, 'password' password ) tbl 0 = (select count(*) mytable ) ); it starts insert part. after comes subquery select 'records' (which can give values in from ( select ... part. makes sure there inserts if no records exist.

sqlite3 - php-cgi not always terminating and locking sqlite -

so having occasional issue detrimental system. small embedded arm system serving web pages using busybox's httpd. pages written in php , there sqlite3 backend. what happens when accessing pages on system system start hanging. have found culprit seems php-cgi not terminating. happens , gets stuck open , causes sqlite3 database accessed locked causing every other process fail out trying access , slows crawl trying , failing access database. if continue browse pages build , pretty have this: cpu: 34.2% usr 24.5% sys 41.0% nic 0.0% idle 0.0% io 0.0% irq 0.1% sirq load average: 10.99 3.36 1.31 23/131 2172 pid ppid user stat vsz %vsz cpu %cpu command 1229 1208 root s 107m 21.3 0 39.8 router -t /tmp/volatiletables.d 1224 1208 root s 81852 15.9 0 14.4 messenger -t /tmp/volatiletable 2103 2102 root r n 16740 3.2 0 2.1 /usr/bin/php-cgi all_stream.php 2106 2105 root r n 16264 3.1 0 2.1 /usr/bin/php-cgi all_stream.php 2109 210

html - Javascript checkbox toggle div hide show -

i looking have checkbox (football) when unchecked: displays 1 div (footballchoice) containing label image checkbox changes mouseover checked: hides div (footballchoice) shows hidden div (footballchecked) contains alternate label image shows hidden div (footballteams). when unchecked again, needs return it's original state. alternatively if knows how change label image when checked same 1 specified in mouseover element here, usefull altetrnative? thank in advance. <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('input[type="checkbox"]').click(function(){ if($(this).attr("value")=="footballteams"){ $(".footballteams").toggle(); $(".footballchecked").toggle(); $(".footballchoice").toggle();

ruby - Net::HTTP extremely slow responses for HTTPS requests -

for reason, on development machine i'm getting very, slow responses https requests performed via net::http. i've tried restclient , httparty , both have same issue. seems have sprung nowhere. i've made these requests hundreds of times without issue, today unbearably slow. pry(main)> puts time.now; httparty.get('https://api.easypost.com/v2/addresses'); puts time.now; 2015-04-29 08:07:08 -0500 2015-04-29 08:09:39 -0500 as can see, response took 2.5 minutes. , it's not easypost api url. i've tried numerous ssl requests servers know can connect ( https://google.com , https://weather.com , etc.) , result in same behavior. also, noticed same thing happens requests redirected http https. now, check out non-ssl request: pry(main)> puts time.now; httparty.get('http://lookitsatravis.com'); puts time.now; 2015-04-29 08:12:22 -0500 2015-04-29 08:12:22 -0500 instantaneous. gives? guess configuration problem somewhere between ruby , openssl. i

c++ - How to synchronize timers of two programs -

i making application have client , server. client send coordinates server use move robot. want synchronize timers, used time stamping log data, can compare input vs output. communication done through tcp/ip, , client done in c++ while server in rapid (abb robotic programming language). problem timers not synched properly. right timers start when connection between 2 established: server side: listenforconnection; starttimer; client side: connecttoserver; starttimer; this not work. there technique ensure timers synchronized? nb: server can connected through lan. you need protocol between client , server pass timestamp. right now, presumably have protocol sending coordinates. need extend somehow allow 1 side send timer information other side. the easiest if have 2 way communication capability. in case, client does connect server keep asking until server there server says "yes i'm here, time 1:00" the client starts sending

Get OSVersion in Windows using C++ -

Image
i have osversion of windows8 system (version should nt 6.2 ) use in c++ application. tried using getversion function call. returned me raw value 602931718 . there way can versions listed here or how can convert raw value readable form? have looked @ getversionex() function , osversioninfoex structure? possible usage: void print_os_info() { osversioninfoex info; zeromemory(&info, sizeof(osversioninfoex)); info.dwosversioninfosize = sizeof(osversioninfoex); getversionex(&info); printf("windows version: %u.%u\n", info.dwmajorversion, info.dwminorversion); } i don't understand, mean nt . according msdn : since windows xp, versions implicitly nt versions. if want test against server versions, check value of info.wproducttype : if(info.dwmajorversion == 6) { if (info.dwminorversion == 0) { if (info.wproducttype == ver_nt_workstation) //windows vista; else //windows serv

java - JavaFX Controller not getting UI fields initialized -

i developing javafx project via scene builder. created quite long fxml file (i reporting snippet) , associated controller. furthermore, wrote application class: public class main extends application { @override public void start(stage stage) { parent root; try { root = fxmlloader.load(getclass().getresource("myfxml.fxml")); } catch (ioexception e) { e.printstacktrace(); return; } scene scene = new scene(root); stage.settitle("popolamento dati ambasciata"); stage.setscene(scene); stage.show(); } public static void main(string[] args) { launch(args); } } fxml: <?xml version="1.0" encoding="utf-8"?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <gridpane maxheight="-infinity" maxwidth="-inf

javafx - css: How to change row color of a table after its been selected and clicked away -

Image
i have .css when row selected fine. however when click off row changes row color grey black font, there way edit css? .table-view { -fx-base: transparent; -fx-control-inner-background: transparent; -fx-background-color: #507ca6; -fx-padding: 5; } .table-view .column-header-background { -fx-background-color: transparent; } .table-view .column-header, .table-view .filler { -fx-size: 35; -fx-border-width: 0 0 1 0; -fx-background-color: transparent; -fx-border-color: #b4d9fd; -fx-border-insets: 0 10 1 0; } .table-view .column-header .label { -fx-font-size: 14pt; -fx-font-family: "segoe ui light"; -fx-text-fill: white; -fx-alignment: center-left; -fx-opacity: 1; } .table-view:focused .table-row-cell:filled:focused:selected { -fx-background-color: #273d51; } any appreciated. try this: /* when control selected not focused */ .table-row-cell:filled:selected, .table-row-cell:filled > .tabl

android - Set margin to "standalone" view -

this might bad practice, android gui keeps frustrating me always. have standalone view called primary_button under res/layout: <?xml version="1.0" encoding="utf-8"?> <button xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/primary_button" android:textcolor="@color/light_warm_gray"/> and custom background "primary_button" shape under res/drawable: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/light_olive" /> <corners android:radius="10dp"/> <size android:height="40dp" android:width="40dp" /> </shape> now problem is, when se

mysql - python: query mongodb database to find a specific value under a unknown field -

i using python generate mongodb database collection , need find specific values database, document like: { "_id":objectid(215454541245), "category":food "venues":{"thai restaurant":251, "kfc":124, "chinese restaurant":21,.....} } my question that, want query database , find venues have value smaller 200, in example, "kfc" , "chinese restaurant" returned query. anyone knows how that? if can change schema easier issue queries against collection. is, having dynamic values keys considered bad design pattern mongodb extremely difficult query. a recommended approach follow embedded model this: { "_id": objectid("553799187174b8c402151d06"), "category": "food", "venues": [ { "name": "thai restaurant", "value": 251 }, { "name": "

oracle - ORA-00060 trace file explanation -

i have known deadlock in merging query. there no foreign keys, triggers, pl/sql. master table btree index composite primary key. helper table temporal session private (no primary key). multiple threads inserts entries temporal table , call merge. all stuff looks pretty typical cannot classify problem source. dug article doing application design reason for . case doesn't fit of mentioned patterns %100. lock types in deadlock graph looks "primary key overlap", trace has rows. though there 2 looping rows contingent case has no rows @ all. deadlock graph: ---------blocker(s)-------- ---------waiter(s)--------- resource name process session holds waits process session holds waits tx-0006000d-00010e04 24 1432 x 23 2918 s tx-00270002-00019175 23 2918 x 24 1432 s session 1432: did 0001-0017-015a7b2a session 2918: did 0001-0031-002724ee session 2918: did 0

lotus notes - In Domino Designer is there a way to open a MessageBox -

in domino designer there way open messagebox button enable user input something, paste users input field? since want user able input content should use lotusscript inputbox method .

javascript - Dynamically create element but use <a href> instead of a button onClick -

i intend re-use html dom's create element method described in w3schools form. function myfunction() { var btn = document.createelement("button"); var t = document.createtextnode("click me"); btn.appendchild(t); document.body.appendchild(btn); } <p>click button make button element text.</p> <button onclick="myfunction()">try it</button> in example above, button used create html element. how can change use href link (an <a> tag) instead of button's click event? change tag anchor, set href "javascript:void(0)" in order prevent browser perform navigation. <!doctype html> <html> <body> <p>click link make button element text.</p> <a href="javascript:void(0)" onclick= "myfunction()" > try it</a> <script> function myfunction() { var btn = document.createelement("button");

java - Reliance on default encoding -

i'm using findbugs , error keeps generating: reliance on default encoding: found call method perform byte string (or string byte) conversion, , assume default platform encoding suitable. this cause application behavior vary between platforms. use alternative api , specify charset name or charset object explicitly. i think has scanner here code: package mystack; import java.util.*; public class mystack { private int maxsize; private int[] stackarray; private int top; public mystack(int s) { maxsize = s; stackarray = new int[maxsize]; top = -1; } public void push(int j) { stackarray[++top] = j; } public int pop() { return stackarray[top--]; } public int peek() { return stackarray[top]; } public int min() { return stackarray[0]; } public boolean isempty() { return (top == -1); } public boolean isfull() { return (top == maxsize - 1);

.htaccess - disallow access of internal files in liferay -

in liferay have --tomcat   --webapps    -- myimages    -- my-portlet using code in my-portlet have given links given file in myimages folder specific user. link http://localhost:8080/myimages/user1.jpg problem statement: have restrict user (rather defined role in liferay) s/he should not able access of files in myimages folder s/he user hits on direct above link. what have tested: i have checked .htaccess file not useful since liferay has tomcat rather apache server. created filter class can intercept request made should process through. openldap can not use since having separate authentication mechanism. if has idea how deal security issue, please suggest me. urls resolved through individual webapps (like myimages ), not through liferay, not have idea of user accesses liferay: they'll shielded other (and in case totally unrelated) webapplication liferay. what can provide these files through portlet plugins , serve images throu

javascript - Cannot get angular.isString to work with ng-repeat -

i'm trying angular.isstring comparison ng-if inside ng-repeat. items in array returned. so tried output angular.isstring result doesn't output anything. here do: <li ng-repeat="item in data"> <div ng-if="angular.isstring(item)"> {{ item }} </div> </li> function myctrl($scope) { $scope.data = [ "hello", "-", 123 ]; } here's fiddle: http://jsfiddle.net/m6k13whh/2/ angular expressions evaluated against scope. can create function returns angular.isstring : <li ng-repeat="item in data"> <div ng-if="isstring(item)"> {{ item }} </div> </li> $scope.isstring = function(item) { return angular.isstring(item); } you can filter of items function: <li ng-repeat="item in data | filter:isstring"> <div> {{ item }} </div> </li>

rust - Mismatched types when implementing a trait -

to learn rust, i'm building own matrix class. implementation of add trait follows: impl<t: add> add matrix<t> { type output = matrix<t>; fn add(self, _rhs: matrix<t>) -> matrix<t> { assert!(self.rows == _rhs.rows && self.cols == _rhs.cols, "attempting add matrices of different sizes"); let mut res: matrix<t> = matrix::<t>{ rows: self.rows, cols: self.cols, data : vec::<t>::with_capacity(self.rows * self.cols), }; in 0..self.rows*self.cols{ res.data.push(self.data[i] + _rhs.data[i]); } res } } but following error compiling matrix v0.1.0 (file://~/soft/rust/projects/matrix) src/lib.rs:35:27: 35:54 error: mismatched types: expected `t`, found `<t core::ops::add>::output` (expected type parameter, found associated type) [e0308] src/lib.rs:35 res.d

java - javax.el.PropertyNotFoundException: The class 'com.springapp.mvc.Class' does not have the property 'Courses' -

this question has answer here: javax.el.propertynotfoundexception: property 'foo' not found on type com.example.bean 2 answers here's model: public class class { @manytomany(etc etc) @jointable(etc etc) public list<course> courses; here's view: <c:foreach items="${classes}" var="class"> <tr> <td>${class.classname}</td> <td> <c:foreach items="${courses}" var="course"> <input type="checkbox" <c:if test="${class.courses.contains(course)}"> checked</c:if>> ${course.coursename} </c:foreach> </td> </tr> </c:foreach> the view produces 500 error: javax.el.propertynotfoundexception: class 'com.springapp.mvc.class' not have property 'co

c# - List of distinct dates -

i have following code: list<datetime> dates = new list<datetime>(); //filling list somehow dates = dates.distinct().tolist(); the code working list of unique datetime. , want list of unique dates since don't need times @ here. there nice solution? my question differs c# linq select distinct date time days since not quering database actually. want filter list. how using transform select ? projects each element of sequence new form. something like dates = dates.select(x => x.date).distinct().tolist();

junit - Arquillian:Could not setup GlassFish Embedded Runtime -

i try make test arquillian in maven project in every execution of test gives me following exception: grave: exception in command execution : java.lang.noclassdeffounderror: javax/validation/parameternameprovider tests run: 1, failures: 0, errors: 1, skipped: 0, time elapsed: 0.855 sec <<< failure! tests in error: es.costa.service.test.magali.personafactortest: not setup glassfish embedded runtime caused by: org.glassfish.embeddable.glassfishexception: plaintextactionreporterfailurejava.lang.noclassdeffounderror: javax/validation/parameternameproviderjava.lang.noclassdeffounderror: javax/validation/parameternameprovider java.lang.runtimeexception: not setup glassfish embedded runtime this pom.xml: <dependencymanagement> <dependencies> <dependency> <groupid>org.jboss.arquillian</groupid> <artifactid>arquillian-bom</artifactid> <version>1.0.3.final</version>