Posts

Showing posts from January, 2015

c# - What Should a domain Model return when using an interface? -

Image
i have got mvc application in domain model (data model + business model) resides in different class library. using interface exposing methods must return data not entire representation of domain objects. my question how should return data? should create kind of view models on business model layer , match them real view models on main application ( views-controllers-viewmodels )? should return data dynamic objects? should return entire domain object event need couple of properties only? best approach follow? this example give better idea situation: //domain class public class user { public string username { get; set; } public int userid { get; set; } public string userpassword{ get; set; } public string firstname{ get; set; } public virtual icollection<applicationuserteam> applicationuserteams { { return _applicationuserteams; } set { _applicationuserteams = value; } } } public interface itrackattendance { dynamic ge

Sitecore MongoDB not creating all database/collections -

we working on sitecore deployment in azure. sitecore experience platform 8.0 rev. 160115 mongodb - 3.0.4 we installed mongodb, , can connect localhost using robomongo. can see “analytics” database/collections. our connection strings setup are: connectionstring.config but other 3 databases , collections not created. tracking.live tracking.history tracking.contact in sitecore.analytics.config file – setting “analytics.enabled” set true. sitecore.analytics.config in log found references xdb cloud initialization failed issues, therefore disabled it. are missing configurations? or suggestions appreciated. thank keep in mind mongodb schemaless. of course, in production environment have create these databases manually - ensure access rights assigned correctly. in development environment, database can created on fly. the reason analytics database created because sitecore creates indexes interactions collection. otherwise, wouldn't see database un

spring - Logging entry, exit and exceptions for methods in java using aspects -

i using below code log entry, exit , exceptions using aspects. way have define bean every class in application in applicationcontext , becomes cumbersome maintain such length of bean definitions , properties. can me simplify this? don't think appropriate design define bean everytime create class. appreciated, in advance. <bean id="logentrybean" class="com.example.logging.logentry" /> <bean id="logexitbean" class="com.example.logging.logreturn" /> <bean id="logexceptionbean" class ="com.example.logging.exceptionlogger"/> <bean id="simpleserviceproxy" class="org.springframework.aop.framework.proxyfactorybean"> <property name="target" ref="simpleservicebean" /> <property name="interceptornames"> <list> <value>logentrybean</value> <value>logexitbean</value>

android - What is wrong with my layout file? Text overlaps -

my texts in layouts overlapping or , text cut off i'm not sure why, please i'm making app , i'm relatively new xml need same other text being cut off. put screenshot of layout can see text being cutoff. here xml file: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingleft="0dp" android:paddingright="0dp" android:paddingtop="0dp" android:paddingbottom="0dp" tools:context=".mainmenu" android:background="#ffcf688f"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview" android:src="@drawable

javascript - GAS Spreadsheet avoid getting duplicates by marking as "SENT", not working? -

i have script in google spreadsheet , fetches rows marked "ready" fine, sets value in column "w"(23) "sent", , trying avoid fetching duplicates, marking column "sent" when run code again, ignores "sent" pasted? wrong here? var ss = spreadsheetapp.openbyid("12y85gmj94s6k3213j2ngk8rfr0gofd_emfk8whu_muq"); var stitchsheet = ss.getsheetbyname("sheet8"); var ordersheet = ss.getsheetbyname("sheet1"); var sent = "sent"; function getorders() { var range = ordersheet.getdatarange(); var orders = range.getvalues(); (var = 1; < orders.length; i++) { var row = orders[i]; var status = row[1]; var order = row[4]; var name = row[5]; var system = row[22]; if(system != sent){ if(status.tostring() === 'ready'){ ordersheet.getrange(i,23).setvalue(sent); stitchsheet.appendrow([order,na

javascript - Highlight selenium clicks using AOP -

i trying plug in js element highlighting selenium framework. have code: @aspect public class highlightaspect { @pointcut("execution(* *.click())") private void allclickmethods(){} @before("allclickmethods()") public void proxyclick(proceedingjoinpoint joinpoint){ webelement element = (webelement)joinpoint.gettarget(); highlight(element, "green"); } private void highlight(webelement element, string color) { browser.getbrowser().executescript("arguments[0].style.backgroundcolor = '"+color+"'", element); } } i initialize spring context in 'main' class like: private static configurableapplicationcontext ctx = new classpathxmlapplicationcontext("spring_config.xml"); and src/main/resources/spring_config.xml looks like: <aop:aspectj-autoproxy /> ... <bean id="highlightaspect" class="com.<my_name_space>.highlightaspect">

Python 2.7 Tkinter Code -

my tkinter code showing no problems when run nothing shows up. wrong? i'm using python 2.7. it's supposed pizzeria game way here code: import tkinter tk tkinter import stringvar import ttk random import randint , choice ,uniform class window(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) container = tk.frame(self) container.pack(side="top", fill="both", expand = true) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} f in (startpage, easy, hard): frame = f(container, self) self.frames[f] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame(startpage) def show_frame(self, cont): frame = self.frames[cont] frame.tkraise() class startpage(): tk.label(text = "welcome!" , font = ("verdana", 12))

Find index of xml attributes using mule dataweave -

i have requirement print index of xml attribute <item> <headercharges> <headercharge chargecategory="shippingcharge" chargename="shippingcharge1" chargeamount="10.0" reference="free delivery"> <extn basechargeamount="10.0" deliverycode="" deliverysequenceno="1" consignmentno="0000164182" itemid="1452778282"/> </headercharge> <headercharge chargecategory="shippingdiscount" chargename="shippingdiscount1" chargeamount="6.0" reference="discount"> <extn basechargeamount="6.0" deliverycode="" deliverysequenceno="1" consignmentno="0000164182" itemid="1452778282" posdepartmentid="1097" promotionid="100819" description="" reasonclass="promovch" reasoncode="1230" reasondescriptio

c++ - Dealing with MFC form 'text' as char type or regular string type -

while modifying mfc form written others, visual studio 2012, encountered problem. in form, there input box takes entire path of file. ex) c:\folder1\test_file.wav , in code, this->tb_path->text contains this. first problem cannot find method deal this->tb_path->text char* or char type array use methods in string.h in status quo, code uses system:: string ^filename = this->tb_path->text + "_re"; to modify text, hampers various modifications of file path. how can solve problem? try system::string ^filename = gcnew system::string(this->tb_path->text + "_re"); or may be system::string ^filename = gcnew system::string(this->tb_path->text + _t("_re")); it seems me not doing required allocation in memory gcnew, garbage inside string uninitialized memory.

elixir - How to enforce JSON encoding for Phoenix Request? -

there's api made phoenix, api works json. but, when test , sent json curl fail because phoenix doesn't parse request json. need explicitly add application/json header curl . i'd make more robust , tell phoenix parse requests json. is there way force phoenix treat requests json , parse json? update i tried use plug set request headers @abm suggested, following code in router: def set_format conn, format plug.conn.put_private conn, :phoenix_format, format end def put_req_header conn, {key, value} plug.conn.put_req_header conn, key, value end pipeline :api plug :put_req_header, {"accept", "application/json"} plug :put_req_header, {"content-type", "application/json"} plug :set_format, "json" plug :accepts, ["json"] end the request has been made curl curl -x post http://localhost:4000/api/upload -d '{"key": "value"}' the connection looks lik

matplotlib - how to align axis label to the right -

by default matplotlib plots axis label @ center of axis. move label in such way aligned end of axis, both horizontal , vertical axis. example horizontal axis see: +--------------------+ | | | | | | | | | | +--------------------+ label is possibile global setting of matplotlib? ok, i'll leave alone other answer(1), one ... plt.xlabel('x_description', horizontalalignment='right', x=1.0) plt.ylabel('y_description', horizontalalignment='right', y=1.0) ... as can see, no more magic numbers, , works both xlabel , ylabel . note in both cases going change horizontal alignment, reasons clear me when first changed vertical alignment in ylabel ... (1) because idea of getting object, modifying object , setting idea on own, isn't it?

github - git: create tag and push to remote: why tag is behind master on remote? -

i did fork bower package on github since need enhancement , mantainers not react pull requests. i changed bit bower.json (to change name, version , add myself among authors), applied enhancements, added new tag, , pushed (i need new tag since bower repository publish new packages versions on new tags only). have registered forked package on bower repo, modified name. i not use branches, avoid complications: on master branch (i'm developer, , user of package...). so far, under sun. now, problem (for sure due limited knowledge of git): when have make change on forked bower package, do: apply changes sources mark changes tag: git tag -a v1.2.3 -m "my latest enhancement" commit , push: git add -a && git commit -m "committing latest enhancement" && git push --tags origin master then, if check repository in github, see master branch updated (with latest enhanements), if switch latest tag (say, "1.2.3"), not up-to-date..

What's the best approach for data validation between forms and models on Laravel 5? -

i'm used have model , form validation together, in framework. i'm migrating laravel , trying understand mindset. what's best approach data validation? i've seen classes out on creating forms , validating requests, isn't unsafe have models saving data without validating before? how integrate form (frontend), request (backend) , model validation play nicely together? or not done in laravel world @ all? as starter in laravel myself, can tell mind of learner. the first thing understand laravel very very very abstract. offers thousands of solutions single problem. since you're starting out, i'm going assume you're using laravel 5 (5.1 more specific). the $this->validate() controllers you can use $this->validate() in controllers . class somecontroller extends controller { public function store(request $request){ $this->validate($request, [ 'title' => 'required|unique:posts|max:255&

sikuli - Integrating RFT with RQM -

i using sikuli- ide.jar in eclipse ide automating applications using ibm rational functional tester tool. executing test cases integrating rational functional tester rational quality manager. when using sikuli jar file, not able execute test cases rational quality manager using rational functional tester script. please can me know whether whether using sikuli rational functional tester , running rational quality manager possible case or not!

php - Codeigniter ignoring 'default_controller' route -

i've got codeigniter 3 site routes work except home page route, so: <?php $route['default_controller'] = "front/homepage"; ?> if create new route below can access "/home" nothing works index. error in log 404 page not found: /index , in config have index set blank. <?php $route['home'] = "front/homepage"; ?> any ideas? thanks this no-longer supported in codeigniter since v2 due being bug in routing logic. http://www.codeigniter.com/userguide3/installation/upgrade_300.html#directories-and-default-controller-404-override

wordpress - $wpdb query not working in plugin -

i'm trying reviews plugin in wordpress, , 1 of thing client asked me user should able rate 1 product every 24 horas, have establish limit between rates. and made function check if limit reached: function isallowedtorate(){ global $wpdb; $currentdate = date('y-m-d'); $userid = get_current_user_id(); $table_name = $wpdb->prefix .'esvn_reviews'; $isallowed = $wpdb->get_results( " select user_id, fecha_calificacion {$table_name} user_id = {$userid} , review_date = {$currentdate} " ); if( count( $isallowed > 0 ) ){ return false; }else{ return true; } } but every time try run it, returns false, error i'm getting wordpress this: <div id='error'> <p class='wpdberror'><strong>wordpress

c - I can't read the second string, no matter how many getchar i insert -

this program need read 2 strings, 2 strings passed "confirm" function, read , the function have find word in common. but in main cant read "string2" string! no matter how many getchar insert. #include <stdio.h> #include <string.h> void confirm(char string1[],char string2[]){ char word[20]; char w_aux[20]; int i, j, k, l, m; int len1, len2; int find; = 0; len1 = strlen(string1); len2 = strlen(string2); while (i < len1){ j = 0; while ((string1[i] != ' ') && (i < len1)){ word[j] = string1[i]; i++; j++; } word[j] = '\0'; k = 0; find = 0; while((k < len2) && (find == 0)){ l = 0; while ((string2[k] != ' ') && (k < len2)){ w_aux[l] = string2[k]; k++; l++; } w_aux[l]

jquery - Bootstrap 3 Collapse Glitch -

site in question: http://www.cqwebdesign.co.uk/wine-site/france.html basically in left sidebar if click heading collapse. when notice list of check boxes glitch there margin or padding being added somewhere. i can't seem find problem or causing else see what's going? issue <script src="https://code.jquery.com/jquery-2.2.4.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" /> <h3 data-toggle="collapse" data-target="#colour"><i class="fa fa-angle-down"></i> colour</h3> <div id="colour" class="filter-group collapse in"> <u

How can I find the minimum supported platform for a given Android NDK? -

i sorry ask may elementary question. i'm working code library written in c. i've been building , running using ndk version 8e. using sdk 22, , minimum execution platform 8 (froyo, believe). now i've introduced use of timerfd_create. looks earliest ndk includes sys/timerfd.h v20. (or doesn't) imply minimum execution platform? thank you. if use ndk platform android-21 , library guaranteed load on devices run lollipop , higher. though android-3/arch-arm/usr/include/asm/unistd.h defines __nr_timerfd_create , functionality unavailable on lower platforms.

Understanding Haskell's stack program and the resolver and LTS version -

i trying understand how use stack , stackage.org . when first installed , used it, stackage.org @ lts-3.8 (the "resolver"). since then, stackage.org has lts-3.11. first, i'd confirm means. stackage repository of packages in which, specific lts version (say 3.8), packages have been verified work together. packages of lts-3.8 work together, , packages of lts-3.11 work together. moving on ... when run stack new projectname , stack tells me: checking against build plan lts-3.8 selected resolver: lts-3.8 does mean project has been set use packages , versions verified under lts-3.8? if want start new project , want use latest lts version new project, how tell stack default? what if want "upgrade" older project use new lts version? does mean project has been set use packages , versions verified under lts-3.8? exactly. (and if ever need packages not included in lts 3.8 set can specify them through extra-deps section of stack.yaml . stack

actionscript 3 - Convert ttf to swf -

i using online flash app , users can upload own fonts create text of own , have tried lot of libraries convert register font in application , hopeless , any appreciated you should try library: fontreader . seems in-memory font parser that's supplied bytearray , parsed according ttf specification. usage instructions not provided, still it's start on how fonts embedded. note uses swf compiler font swf, should available receive ttf file, process , receive font object used swf.

android - How update a view without refresh all view? -

example: using listview, 10 items database , show on view. when user scroll down , click in button, wanna bring database , show 10 more items. don't wanna refresh whole view, add 10 more. i using cursor , adapter listview, so, when swap cursor new data, adapter fill listview refreshing items. i'm looking tutorial, class or idea make that. listview old class added way @ start in api level 1. adapters use listview have notifydatasetchanged() refreshing data displayed. google aware of limitation , on year ago released recyclerview , more advanced , flexible replacement listview . recyclerview.adapter class has many more methods such as; notifyitemrangeinserted(int positionstart, int itemcount) ideal method situation here. using support library recyclerview give compatibility right api 7 (android 2.1 eclair).

MySQL where value NOT in SET datatype field -

i should start saying know how check existence of set datatype, however, i'm trying negate lookup, doesn't seem work, i'm assuming i'm doing stupid. i've got field: | billing_payment_prefs | set('allow_admin','allow_trans','allow_supress','requires_nag') | yes | | null | | and records null said field. have 3000+ records in table, , running following query: mysql> select count(id) customers billing_payment_prefs not '%allow_trans%'; +-----------+ | count(id) | +-----------+ | 0 | +-----------+ 1 row in set (0.00 sec) ... 0 instead of 3000 plus (which i'd expect, they're null). now, i'm unsure of how not like against set field, had assumed (incorrectly, looks of things) work, though mysql dev doesn't mention it. any help, appreciated. thanks. the reason getting no records because mysql (as rdbms) treat null special val

How to change an enum at runtime (Java) -

this question has answer here: can add , remove elements of enumeration @ runtime in java 6 answers basically, writing addon minecraft mod called aura cascade. aura cascade adds aura (as name suggests), comes in different colors. wanted add colors of aura, valid colors defined in enum this: public enum enumaura{white,black,red,orange,yellow,green,blue,purple} how add values enumaura @ runtime? to clarify, of code must run after aura cascade initialized. if understand question correctly, can't that. please take java documentation enums : https://docs.oracle.com/javase/tutorial/java/javaoo/enum.html enum types an enum type special data type enables variable set of predefined constants. variable must equal 1 of values have been predefined it. common examples include compass directions (values of north, south, east, , west) , days

excel - 'ClearContents' and 'PasteSpecial' performance -

in excel vba need clear large named range of content (but not formats) , paste part of formulas taken different named range. issue performance of clear , paste operations. quite slow. same operations performed manually on sheet faster. sheet in manual calculation mode. below code have written this: sub loadformuals_(nm_rng_formula string, nm_rng_control string, nm_rng_paste string, nm_rng_clear string) dim rabs integer dim rrel integer dim rng_formula range: set rng_formula = range(nm_rng_formula) dim rng_control range: set rng_control = range(nm_rng_control) dim rng_paste range: set rng_paste = range(nm_rng_paste) dim rng_clear range: set rng_clear = range(nm_rng_clear) application.screenupdating = false application.enableevents = false dim ws worksheet set ws = worksheets(rng_paste.worksheet.name) ws.enablecalculation = false rng_clear.clearcontents if not (isempty(rng_control.cells(1, 1))) application.screenupdating = false rabs = rng_control.end(xldown).row

ios - Xcode 6 not showing any simulators -

Image
downloaded xcode 6 , don't have option archive. click on project name (right run button). 3 options appear. edit scheme new scheme manage scheme can click on "new scheme" , click on "ok" in popup window. you have simulators list back. second option open xcode go menu xcode > open developer tool > ios simulator if error dialog shows up, still have access ios simulator's menu select hardware > device > manage devices add (if missing) devices want, or delete , recreate ones malfunctioning. (you can check devices @ ~/library/developer/coresimulator/devices).

objective c - I'm getting an Incompatible pointer types warning -

i'm trying create extension air application , have been following documentation on adobe's website , other examples , looks correct don't know enough objective c know why i'm getting warning. #import "flashruntimeextensions.h" @import contacts; @import uikit; cnauthorizationstatus contactstatus; cncontactstore * contactstore; cncontactfetchrequest * request; nsmutablearray * contacts; nsarray * fullcontactlist; freobject hascontactlistaccess(frecontext ctx, void* funcdata, uint32_t argc) { uint32_t statusresult = true; if(contactstatus == cnauthorizationstatusdenied){ statusresult = false; } freobject returnboolean = nil; frenewobjectfrombool(statusresult,&returnboolean); return returnboolean; } freobject getallcontacts(frecontext ctx, void* funcdata, uint32_t argc){ contactstore = [[cncontactstore alloc] init]; [contactstore requestaccessforentitytype:cnentitytypecontacts completionhandler:^(bool grante

ios - Displaying The Date with NSDateFormatter -

what i'm trying display date , time similar see within facebook. however, xcode displaying error: use of unresolved identifier 'creator'. here's function i'm having trouble with: override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("postcell", forindexpath: indexpath) as! postcell cell.post = posts[indexpath.row] cell.index = indexpath.row var dataformatter:nsdateformatter = nsdateformatter() dataformatter.dateformat = "yyyy-mm-dd hh:mm" cell.timestamplabel.text = dataformatter.stringfromdate(creator.createdat) return cell } an error wasn't displaying until typed out second last line of code. specifically, know error being caused creator , believe timestamplabel culprit because didn't change color person following along in video. i'm utilizing parse store users data , cr

batch file - How can I delete Internet Explorer cookies using bat script? -

i have written simple bat script computer few things. 1 of these things delete cookies computer. i chose following command this; rundll32.exe inetcpl.cpl,clearmytracksbyprocess 4351 since following list of commands given on page; https://social.msdn.microsoft.com/forums/ie/en-us/ce81943b-32b8-437b-b620-171c3d5893e7/inetcplcpl-with-clearmytracksbyprocess?forum=ieextensiondevelopment echo clear temporary internet files: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 8 echo clear cookies: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 2 echo clear history: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 1 echo clear form data: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 16 echo clear saved passwords: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 32 echo delete all: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 255 echo delete w/clear add-ons settings: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 4351 however, running antivirus software

c# background task with class library (uwp app) -

i'm trying make program gets information of system , sends cloud system. so, want program works in background task only. i heard can use class library(.dll) make it. what wanna know is.... is possible make dll file background task , start-up task too? you may run windows service. suggest create console application following code: static void main(string[] args) { yourservice service = new yourservice(); if (environment.userinteractive) { service.onstart(args); console.writeline("press key stop program"); console.read(); service.onstop(); } else { servicebase.run(service); } } this more easy debug don't need reinstall service each time make changes.

php - Laravel Undefined variable when passing variable -

beginner question : i'm passing $wordsrow variable wordscontroller results2 blade. $wordsrow contains row in words table. wordscontroller code : $wordsrow = words::where(db::raw('body'),'like', "%{$body}%")->get(); return view('results2', [ 'message' => $message , 'wordsrow' => $wordsrow]); and in results2 blade, passing body , id columns of wordsrow dashboard2 blade. @if (isset($wordsrow)) @foreach ($wordsrow $wordsrow) <a href="{{route('dashboard2',[ 'wordsrowb'=>$wordsrow->body, 'wordsrowid'=>$wordsrow->id])}}">{{$wordsrow->body}}</a> <br> @endforeach @endif and in dashboard2 blade, have problem follows : if use form empty action <form action="#" method="post"> , no issues occur, , dashboard view opens no problems. while if use : <form action="{{route('post.cre

javascript - Convert .obj to .js files -

i have gone through different three.js examples. of examples uses .js or .bin files instead of .obj files. e.g. used in webgl_materials_cars.html example. how .js file .obj file? the three.js editor . converter . blender exporter . clara.io . various other converters , exporters

neo4j - Cypher: How to match relationship-node-relationship within a path -

i new cypher , neo4j (and stack overflow matter), question has easy answer. have spent hours reading documentation , googling, found nothing on point answer question. apparently need more reputation post images, best text. i can find path 1 node such: match path = (a {name:"a"})-[*]-(x {name:"x"}) return extract(r in nodes(path) | r); which return following 2 paths: (a)-[:red]->(b)<-[:blue]-(c)-[:red]->(f)<-[:red]-(g)-[:blue]->(h)<-[:red]-(x) (z)-[:red]->(h)<-[:red]-(x) so far good. there are, of course, lots of other relationships , nodes in database connect these nodes, right path. i need find 1 node along path has 2 red relationships coming so: -[:red]->(findme)<-[:red]- in 2 path examples above, findme = (f) , (h). note: there lots of matches in database, want 1 in path (should one). also, there many nodes , different relationships in path, or few 3 nodes each connected red relationsh

ios - Swift Iteration Character Length -

this question has answer here: generate random alphanumeric string in swift 16 answers i in process of making 1 of first apps, aim of password generator , telling people on scale of 1-1000 how hard guess, , how hard remember based on how letters formatted , looks , how brain remembers patterns. far have characters want use in array, , have in loop iterates through characters, can't figure out how specify length of password generate, prints each character. so, asking how can make 8 character long password generator possible, have far is: import foundation let chars = ["a","b","c","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u" ,&

java - JOptionPane.showMessageDialog(null, ...) always showing dialog on primary screen -

is there solution that? alternative library might use display dialog on mouse pointer's screen (can't use parent that)? or there api change dialog's screen? i tried using non-visible parent jframe on desired screen, has effect on dialog's screen positioning if visible when invoking dialog. "special case" have no app window or jframe around want stick dialog. should appear in center of screen user using. instead of using joptionpane recommend instead use jdialog . here example: joptionpane joptionpane = new joptionpane("really this?", joptionpane.plain_message, joptionpane.yes_no_option); jdialog jdialog = joptionpane.createdialog("dialog title"); to display on particular screen can bounds of screen want , place dialog in center of it, example: rectangle screenbounds = mouseinfo.getpointerinfo().getdevice().getdefaultconfiguration().getbounds(); int x = (int) screenbounds.getcenterx() - (jdialog.getwidth() / 2); int

ios - Text in UITextView Auto-Scrolled to Bottom -

i have believe standard uitextview in viewcontroller has substantial amount of text in it, enough not of can fit on screen. happen when view loaded, user can start reading @ top of text , scroll down page progress through text. makes sense, right? want not unrealistic. the problem when view loads, text in uitextview scrolled way down bottom. have scoured , there number of similar posts none of solutions therein resolving problem. here code in view controller: import uikit class welcometextvc: uiviewcontroller { var textstring: string = "" @iboutlet weak var welcometext: uitextview! override func viewdidload() { super.viewdidload() self.navigationcontroller?.navigationbar.translucent = false self.welcometext.text = textstring self.welcometext.scrollrangetovisible(nsmakerange(0, 0)) } override func viewwillappear(animated: bool) { super.viewwillappear(true) self.welcometext.scrollrangetovis

ios - Why are the UIImagePickerControllerDelegate methods not firing? -

i refactored app implement command pattern. end, trying silo of functionality appropriate command classes. have implemented pattern of commands, 1 exception. have command called harvestphotocommand launches uiimagepickercontroller , , want use command class picker's delegate. seems straightforward enough, reason delegate methods not being invoked. here's code: //header file @interface wsharvestphotocommand : wscommand < uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate, mwphotobrowserdelegate > @end //from super class header file: @property (nonatomic, weak) wsmapviewengine *mapviewengine; //implementation file -(void)execute { _imagepicker = [[uiimagepickercontroller alloc] init]; _imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera; _imagepicker.delegate = self; _imagepicker.navigationbar.barstyle = [wsappsettings sharedsettings].theme.barstyle; [self.mapviewengine.map

calling function from dialog button jquery ui -

demo calling function dialog box getting is not function error button click dialog: add: { class: 'calendareventleft', text: 'add', click: function() { var title = $("#title").val(); var description = $("#description").val(); var otherinfor = $("#otherinfo").val(); $(this).ajaxcall(title, description, otherinfor); } } button showing dialog $('#button').click(function() { $("#dialog").dialog({ title: "qwe" }); $("#dialog").html("<div>" + "<form>" + "title:<br>" + "<input type='text' id='title' class='calendarinput'>" + "<br>" + "description:<br>" + "<textarea id='description' class='calendarinput calendartxtarea'></textarea>" + "<br>" + "addition

python - Sum across all NaNs in pandas returns zero? -

i'm trying sum across columns of pandas dataframe, , when have nans in every column i'm getting sum = zero; i'd expected sum = nan based on docs. here's i've got: in [136]: df = pd.dataframe() in [137]: df['a'] = [1,2,np.nan,3] in [138]: df['b'] = [4,5,np.nan,6] in [139]: df out[139]: b 0 1 4 1 2 5 2 nan nan 3 3 6 in [140]: df['total'] = df.sum(axis=1) in [141]: df out[141]: b total 0 1 4 5 1 2 5 7 2 nan nan 0 3 3 6 9 the pandas.dataframe.sum docs "if entire row/column na, result na", don't understand why "total" = 0 , not nan index 2. missing? a solution select cases rows all-nan, set sum nan: df['total'] = df.sum(axis=1) df.loc[df['a'].isnull() & df['b'].isnull(),'total']=np.nan or df['total'] = df.sum(axis=1) df.loc[df[['a','b']].isnull().all(1),'total']=n

javascript - Sending Form Data to Node Server -

i trying send form data endpoint. here's client side code: <form name="form" action="http://localhost:8080/geodata" method="post"> <label for="minlat"> minlat: </label> <input type="text" name="minlat" value="0"><br> <label for="maxlat"> maxlat: </label> <input type="text" name="maxlat" value="1"><br> <label for="minlong"> minlong: </label> <input type="text" name="minlong" value="0"><br> <label for="maxlong"> maxlong: </label> <input type="text" name="maxlong" value="1"><br> <button type="submit" class="btn btn-success"> submit <span class="fa fa-arrow-right"></span>

xcode - swift Detect the correct textfield to add an attribute -

i´m writing input text quiz app, , have array of int can store if answer correct or not 0 or 1 , have 3 textfields write answers, , want change textfields ground color red or green depending on answers variable ,, if index variable 1 change color green , if 0 change color red.. have @iboutlet var textfield1: uitextfield! @iboutlet var textfield2: uitextfield! @iboutlet var textfield3: uitextfield! //change int 1 if answer correct (3, ea each textfield) var answers = [0,0,0] @ibaction func button(sender: anyobject) { (index, answer) in goodanswers.enumerate() { print (answer) if answer != 0 { print ("ok") } else { print("not ok") } } } thanks ! you need this: var goodanswers = ["one", "two", "three"] var textfields:[int:uitextfield]! override func viewdidload() { super.viewdidload() self.textfields = [0:textfield, 1