Posts

Showing posts from September, 2010

knockout.js - Intercept route navigation and ask user "are you sure you wish to leave this page?" -

i have durandal app allows user update various bits of profile information. bits of data, user must click "save" indicate want save changes. in event user attempts navigate away current view unsaved changes, want intercept navigation , popup modal saying "you have unsaved changes--do want save them before leaving view?" however, in reviewing durandal router plugin documentation , haven't been able determine how intercept navigation requests in viewmodel. think want listen the router:route:activating event . but: i'm not sure , how setup listener this. i don't know how cancel navigation (so can instead pop modal) in event handler. you can in candeactivate event durandal has. var candeactivate = function () { // check if data has unsaved changes logic in haschanges() method if (haschanges()) { var msg = 'do want leave , cancel?'; return app.showmessage('message', 'confirm title', [&#

scala - Slick 2.0: Cannot insert java.sql.Timestamp into a table using HList -

i'm getting class cast exception in script , cannot why. error is: java.lang.classcastexception: java.sql.timestamp cannot cast scala.product here's code: import java.sql.timestamp import scala.slick.driver.mysqldriver.simple._ import scala.slick.collection.heterogenous._ import syntax._ import org.joda.time.datetime import db.dealdao import datetimeimplicits._ // implicitly convert datetime timestamp (and seems work) object datetimeimplicits { implicit def datetime2timestamp(value : datetime) = new timestamp(value.getmillis) } object tryhlist { class tests(tag: tag) extends table[timestamp :: hnil](tag, "tests") { def timecol = column[timestamp]("time_col") def * = (timecol :: hnil) } def tests = tablequery[tests] def createtable = dealdao.db.withsession { implicit session => tests.ddl.create } def insert(dt: datetime) = dealdao.db.withsession { implicit session => tests += (dt :: hnil) } } object ma

mysql - Prevent other users from calling php file -

here have php code: update: <?php $pdo=new pdo("mysql:dbname=gmaestro_agro;host=localhost","gmaestro_agro","pass"); $statement=$pdo->prepare("select * stat"); $statement->execute(); $results=$statement->fetchall(pdo::fetch_assoc); $json=json_encode($results); echo $json; ?> i call code ajax data mysql database, when go on domain http://mywebsite.com/get_json.php code give information of database. how can prevent other users calling this, js ajax code can call it? at least should check whether post request made: if ($_server['request_method'] === 'post') { // code } that way not fill database empty entries every time page requested via get . your code allows anonymous posts. possible designed way, if not, should check logged-in user. use sessions that. apart should validate individual fields, might empty others have filled before insert. edit: can set session variable

java - Why would this only print the first line? -

import java.util.scanner; public class parsethetweet { public static void main(string[] args) { // todo auto-generated method stub scanner thescanner = new scanner(system.in); string tweet = ""; system.out.println("enter tweet"); tweet = thescanner.nextline(); system.out.println(tweet); } } this program have far, simple , have feeling i'm doing easy wrong. want output variable tweet same input, keeps printing first line. ex. input: #typ offer; #det free essential supplies 4 evacs pets.; #loc 2323 55th st, boulder; #lat 40.022; #lng -105.226; output: #typ offer; #det free essential supplies 4 evacs pets.; #loc 2323 if want read more lines one, need call thescanner.nextline() in loop, e.g.: while (thescanner.hasnextline()) { string tweet = thescanner.nextline(); system.out.println(tweet); }

typescript - Full Definition Of A "Common Root" -

enumerations, modules , interfaces merged if multiple blocks defined within same common root. can't find official definition of common root in language specification. is more complicated than... either: the module, or the global scope (the complication can think of if module merged, members of parts of module being merged have same common root, zips go). is there other kind of common root? module x { export interface y { name: string; } } module x{ export interface y { age: number; } } // x.y has both name , age properties it's "common root" in graph theory sense of term, since combination of typescript modules or programs forms tree of declarations (because declaration has 1 parent). second half of spec section 2.3 ("declarations") defines how tree constructed in terms of establishing parent relationships. i think relevant phrase in spec here declarations merge if have "the same qualified

python - Subclassed QStyledItemDelegate ignores Stylesheet -

i'm trying subclass qstyleditemdelegate remove focus rectangle in qcombobox . even though i'm calling base implementation of paint function , nothing else, result different. looks if parts of style-sheet influence bounding box of item taken consideration. class pstyleditemdelegate(qstyleditemdelegate): def __init__(self, *args, **kwds): super(pstyleditemdelegate, self).__init__(*args, **kwds) def paint(self, *args, **kwargs): qstyleditemdelegate.paint(*args, **kwargs) what have paint unmodified qstyleditemdelegate ? as suggested tried replacing pyside pyqt4 , works, appears bug. update pyside 1.1.2 1.2.1 result same. unfortunately switch breaks other parts of code, if there no other suggestions i'm going accept answer. edit bug tracked here

c++ - Find X and Y coordinates of point in relation to the whole image -

i trying find nose tip landmark inside 2d image. it's not working 100% correct, first approach satisfy me. vector<rect> noses; vector<rect> faces; vector<rect> eyes; mat frame_gray; mat matched_frame; //frame matched face mat gray; rect region_of_interest; cvtcolor(frame, frame_gray, color_bgr2gray); face_cascade.detectmultiscale(frame_gray, faces, 1.1, 2, 0 | cascade_scale_image, size(30, 30)); (int = 0; < faces.size(); i++) { point pt1(faces[i].x, faces[i].y); // display detected faces on main window - live stream camera point pt2((faces[i].x + faces[i].height), (faces[i].y + faces[i].width)); rectangle(frame, pt1, pt2, scalar(255,0 , 0), 2, 8, 0); cvtcolor(frame, frame_gray, color_bgr2gray); equalizehist( frame_gray, frame_gray ); //nose tip detection rect noseroi1; noseroi1.x = (faces[i].x); noseroi1.y = faces[i].y + (faces[i].height/2.5); noseroi1.width = (faces[i].w

regex - Contents within an attribute for both single and multiple ending tags -

how can fetch contents within value attribute of below tag across files <h:graphicimage .... value="*1.png*" ...../> <h:graphicimage .... value="*2.png*" ....>...</h:graphicimage> my regular expression search result should result into 1.png 2.png all find content multiple ending tags single ending tags. use xml parser instead, regex cannot parse xml properly, unless know input follow particular form. however, here regex can use extract value attribute of h:graphicimage tags, read caveats after: <h:graphicimage[^>]+value="\*(.*?)\*" and 1.png or 2.png in first captured group. caveats: here have assumed 1.png , 2.png etc surrounded asterisks seems question (that \* for) this regex fail if 1 of attributes has ">" character in it, example <h:graphicimage foo=">" value="*1.png*" this mentioned before regex never being able parse xml properly. work around

Union with inner join, mysql error -

(select * app_detailsvvv dtable inner join new_apps on new_apps.trackid=dtable.trackid primarygenrename='games' , composed='1' , new_apps.top>0) union (select * app_detailsvvv dtable primarygenrename='games') limit 12 error: #1222 - used select statements have different number of columns on new_apps there fields not in app_detailsvvv, how can mask second query in union somehow. edit: (select dtable.* app_detailsvvv dtable inner join new_apps on new_apps.trackid=dtable.trackid primarygenrename='games' , composed='1' , new_apps.top>0) union (select * app_detailsvvv dtable primarygenrename='games') limit 12 worked yet when add order new_apps.top asc new error: #1250 - table 'new_apps' 1 of selects cannot used in global order clause try this: (select dtable.* app_detailsvvv dtable inner join new_apps on new_apps.trackid=dtable.trackid primarygenrename='games' , composed='1' , new_a

eclipse - How to run several .txt input files as a test for Java program with output files -

i've been using cmd run supplied .txt through java homework because instructor supplies correct output, can check our program functions properly. looks when it... ...documents\cse205\assignment5>java assignment5 < input1.txt > myoutput1.txt the instructor pointed file compare tool highlight differences between myoutput , expected output. learned can compile classes in folder command javac *.java so i'd know if there way feed program each of 4 inputs 4 separate myoutput files through command prompt or other way. thanks in advance macncheese create file run.bat in assignment5 folder. edit (right-click -> edit...) , write this: java assignment5 < input1.txt > myoutput1.txt java assignment5 < input2.txt > myoutput2.txt java assignment5 < input3.txt > myoutput3.txt ... make sure file names correct , assignment5 reflects name of mainclass. then open command line (depending on windows version might differ little bit), pressi

regex - How to remove the word and digit with underscore in a string -

i use regular expressions remove "2_abc_" in following string: $a="2_abc_300_300_300_300_1_120"; i have tried: $a=~ s/^\d_\w*//; but doesn't work since w includes numeric, undercore , alphabet. you can use [a-za-z] insted of \w . or [a-z] if want lower case letters. also, if want @ least 1 letter use + instead of * . if want 3 letters use [a-z]{3} .

vb.net - Error handling with data tables -

i have loop data table , i'm trying figure out if data table has no rows in it. ignore fact there no rows in , move on or fail , give , exception? here's code loop, question should same in cases. each dr datarow in dt.rows if not isdbnull(dr.item("materialid")) , dr.item("materialid") isnot nothing listofresults.add(cuint(dr.item("materialid"))) else trace.traceerror("error details: {0} stack: {1}", "the materialid nothing/null", system.reflection.methodinfo.getcurrentmethod.tostring) end if next if datatable has no rows hit loop , exit , execute next statement after loop. note : if datatable dt nothing throw exception.

certificate - cacert file not found on ColdFusion 9 -

for coldfusion 8 server, can see cacerts file in following path: c:\coldfusion8\runtime\jre\bin however, cacert file not present on coldfusion 9 server @ same location. i trying install cert coldfusion truststore following following steps: 1) run command prompt administrator on coldfusion server 2) make backup of original cacerts file in case run issues 3) change directory truststore’s location (where cacerts file located). in our case: c:\coldfusion8\runtime\jre\bin 4) type command (use current jvm , use current jvm’s keytool): c:\coldfusion8\runtime\jre\bin>keytool -import -v -alias exported -file c:\coldf usion8\runtime\jre\lib\security\exported.cer -keystore cacerts -storepass changeit 5) type yes @ prompt “trust certificate?” 6) restart coldfusion service not read updated cacerts file until this. is there new coldfusion 9? have installed certificate coldfusion 8 following above steps? please advise th

Sets of 25 with PHP and MySQL -

what i'm trying accomplish is, add list of words separate entries table. display words in group of 25. if there 25 entries, 1-25 shown in list. also, if there 27 entries, number 26 , number 27 show. not last 25 entries table. i know how insert , pull information database, not know how proper grouping them in groups of 25. edit: how increase limit automatically based on number of rows in table? edit #2: question not duplicate. not want recent 25. want them in groups of 25. question answered below. imho can't in 1 query (at least in standard sql in readable way). you need: get number of entries in table (assuming table named tbl1 ): select count(*) tbl1; get number of entries not-selected using integer division. exact code depends on language use. example on php (assuming result of step 1 stored in $count ): $offset = floor($count/25); //or: $offset = $count - $count%25; extract needed entries using limit: select * tbl1 order <specify-order

c# - IPP .NET 3.0 SDK Migration Issue: "Could not load type 'Intuit.Ipp.Core.Rest.SyncRestHandler'" -

i'm receiving following error when try create dataservice object. swapped out 2.0 sdk 3.0 , made adjustments detailed in docs. not sure what's going on though. ideas? "could not load type 'intuit.ipp.core.rest.syncresthandler' assembly 'intuit.ipp.core, version=2.1.7.0, culture=neutral, publickeytoken=null'" oauthrequestvalidator oauthvalidator = new oauthrequestvalidator(quickbookstoken, quickbookssecrettoken, quickbooksconsumerkey, quickbooksconsumersecret); servicecontext context = new servicecontext(oauthvalidator, quickbooksrealm, intuitservicestype.qbo); //blows here dataservice commonservice = new dataservice(context); same issue me, , appears working making dataservice plural: dataservices commonservice = new dataservices(context); unfortunately, has issue bit further on , limits functionality. example, have errors when attemp

jquery - How do I figure out why my html,css, bootstrap is not showing anything on the page -

here example of html code rendered out asp.net web form in previous person used tons of panels , tabs ... have been gutting many pages bootstrap, particular page not showing other top menu. i tried putting in snippets of code, commenting out tags. saved fiddle , hoping knows how troubleshoot why code, of not display. bootstrap 3.x , , asp.net webforms 4.5 (not matters ) thoughts? tags causing issues? <div class="navbar navbar-default navbar-fixed-top"> http://jsfiddle.net/tazmanrising/ttpgm/ remove visibility: hidden; inline css styles.

java - schemagen gradle build error -

i trying migrate existing maven project gradle build. in maven project using jaxb2-maven-plugin generate xsd(schemagen)/classes(xjc). wanted same functionality in gradle. have few classes jaxb annotation not how exclude files not needed. when below error. error: :createschematargetdir up-to-date :schemagen [ant:schemagen] error: org.gradle.person not have no-arg default constructor. [ant:schemagen] problem related following location: [ant:schemagen] @ org.gradle.person(person.java:5) [ant:schemagen] 1 error :schemagen failed failure: build failed exception. * where: build file 'e:\gradle-schemagen\build.gradle' line: 31 * went wrong: execution failed task ':schemagen'. > schema generation failed build.gradle apply plugin: 'java' apply plugin: 'eclipse' sourcecompatibility = 1.6 version = '1.0' schematargetdir = new file('build/generated-schema') configurations { jaxb } jar { manifest {

type conversion - What is a the quickest way to bitwise convert two ints to a long in java? -

i've been using images store data, since editing binary data through paint.net friendlier hex editors. however, of data long integers. long integers twice size of 32-bit integer in java, 64-bits. how 1 long 2 integers, , more importantly, long when reading image? since java not have unsigned ints, top bit of integer or long negative sign bit, though bit 32 (the lower integer/pixel) ordinary bit in long integer. most methods of converting long int discard upper bits, well, or may contain bitwise (binary) information! what need transform single long 2 integers faithful contain bit data transform 2 integers long faithfully contains bit data. no need use autoboxing ( long , integer , etc.). primitives work fine. following best can in java programming language. join combining 2 int s long int lo; // integer fill lower bits int hi; // integer fill upper bits long val = (((long) hi) << 32) | (lo & 0xffffffffl);   split retrieving (upper) bits

mysql - PHP MySQLi prepared statement getting row, but not displaying data -

i'm trying fetch data using id database value. here code: $query = "select id,uid,product,jpgid,saledatetime,quantity sales printed = ? , date_format(saledatetime, '%y/%m/%d') = ?"; if ($stmt = $mysqli->prepare($query)) { $printed = 0; $stmt->bind_param("is",$printed,$session_date); $stmt->execute(); $stmt->store_result(); //get result $stmt->bind_result($result_id,$result_uid,$result_product,$result_jpgid,$result_saledatetime,$result_quantity); //number of rows returned $count_rows = $stmt->num_rows; if ($stmt_fetch = $mysqli->prepare("select jpg,udate,imageset images id = ?")) { //fetch image information while ($stmt->fetch()) { $stmt_fetch->bind_param('i',$result_jpgid); $stmt_fetch->execute(); $stmt_fetch-&

compilation - Oldest ubuntu supporting Qt5 -

i'm developing app distributed binary, , app depends on qt5. have compile on various platforms create apps major distros (i assume). i support ubuntu - how far can go in ubuntu version , still qt5 packages compile against? (i don't want build qt5 source, must available package in default repos distro) qt5.2 has no special dependencies. have built on platforms 11 no problem. in fact, has been compiled , ported on platforms raspberry pi minimal problems. here list of build requirements: git (>= 1.6.x) perl (>=5.14) python (>=2.6.x) libxcb there helper compilation libraries 11. you can find information at: http://qt-project.org/wiki/building_qt_5_from_git

debugging - How can I get the bytecodes that are executed at runtime for a Java program? -

the compiled .class file contains bytecodes corresponding whole java class. however, during execution, bytecodes exectued multiple times while not executed @ all, depending on logic , input. there way trace of bytecodes executed during lifetime of java program? edit: use case i think use-case may help. after sample run of program, count frequency of bytecode instructions executed (e.g. areturn has been carried out 10 times). there profiler or other tool can use purpose? this obscure paper talks such tool http://ccsl.icmc.usp.br/files/vincenzi-et-al-2003.pdf it's quite old (2003) it states this paper describes coverage testing tool java programs , java-based components, named jabuti (java bytecode understanding , testing). differently other testing tools require java source code carry out program analysis, instrumentation , coverage assessment, our tool requires java bytecode. bytecode can viewed assembly-like language retains high-level infor

java - How to get ResultSet from executeBatch? -

i need result set executed batch : string [] queries = {"create volatile table testtable (select * orders) data;", "select top 10 * testtable;" , "drop table testtable" }; (string query : queries) { statement.addbatch(query); } statement.executebatch(); ones execute batch how can result set select query ? in short, should not. plain multiple execute() should used. as according javadoc of executebatch() , should not support getresultset()/getmoreresults() api. also, in jdbc™ 4.0 specification #14.1.2 only ddl , dml commands return simple update count may executed part of batch. method executebatch throws batchupdateexception if of commands in batch fail execute or if command attempts return result set. but jdbc drivers might support, try @ own risk.

Java int operation in Javascript -

java , javascript produces different result when operating large integers. example: getcode(1747,1763,-268087281,348400) returns 1921968083 in java javascript returns 2.510115715670451e+22 . how result in java using javascript? having done research problem seems related signed/unsigned 32/64 bit integer operations . have tried adding |0 , of operations , got 1921618368 closer not identical. java: public string getcode(int intval1, int intval2, int intval3, int inta) { int intval5 = intval2 ^ intval3 ; intval5 = intval5 + (intval1 | inta ) ; intval5 = intval5 * (intval1 | intval3 ) ; intval5 = intval5 * (intval2 ^ inta ) ; return string.valueof(intval5); } javascript: function getcode(intval1,intval2,intval3,inta) { var intval5 = intval2 ^ intval3 ; intval5 = intval5 + (intval1 | inta ) ; intval5 = intval5 * (intval1 | intval3 ) ; intval5 = intval5 * (intval2 ^ inta ) ; return intval5; } the |0 trick works

regex - Bash, Netcat, Pipes, perl -

background: have simple bash script i'm using generate csv log file. part of bash script poll other devices on network using netcat . netcat command returns stream of information can pipe grep command values need in csv file. save return value grep bash variable , @ end of script, write out saved bash variables csv file. (simple enough.) the change i'd make amount of netcat commands have issue each piece of information want save off. each issued netcat command possible values returned (so each time returns same data , burdensome on network). so, i'd use netcat once , parse return value many times need create bash variables can later concatenated single record in csv file i'm creating. specific question: using bash syntax if pass output of netcat command file using > (versus current grep method) file each entry on own line (presumably separated \n eol record separator -- easy perl regex). however, if save output of netcat directly b

c# - .NET, JSON, Embedded, Free Commercial-Use data management solution? What to do? -

i trying develop data management solution commercial product meets several criteria. criteria , reasoning follows: the solution should in c# or support c# manage data json no external schema maintenance be able cache or data in memory , persist disk not require additional installation if solution involves third-party software, license must support no-cost commercial use requirement #1 : application written in c# , prefer solution not involve integrating applications, libraries, or code in language. requirement #2 : there several json-based tools , libraries utilize, need solution data either in or converts to/from json. requirement #3 : want avoid schema maintenance comes using relational database solutions. prefer manage mismatched data-to-object mappings in code , have code update older data instead of managing schema updates separately. requirement #4 : require or data loaded memory @ times, , data persisted disk. whether data persists in memory or not should op

c# - Can i deserialize xml directly into a List -

this question has answer here: is possible deserialize xml list<t>? 7 answers this might silly noobish question, please bear me =) in program receive piece of xml akin this: <markers> <marker id="35" name="test1" address="anyway123" type="event"/> <marker id="370" name="test2" address="" type="event"/> <marker id="251" name="test3" address="somewhere 1337" type="com"/> </markers> what want know if there's way have class, containing sort of this: private int id; private string name; private string address; private string type; public int id { { return id; } set { id = value; } } public string name { { return name; } set {

joomla - Creating a folder on registration -

how possible create on every registration in joomla customized folder every user in images-folder? userid should foldername...(images/userid) where change code , should insert? thanks lot you have create profile plugin task, and use onuseraftersave folder creation section. basic profile plugin documentation can found here . another option edit core file, not recommended bcoz due joomla update may lost. if plan edit core file check model file inside components/com_users/models/registration.php , task register() in function send mail code there add custom codes before that. hope helps..

javascript - Created QUERY, need data to display inside drop down -

i trying modify webpage right uses php , html. basically have list of items generated. values 1, or 10 depending on row length. beside each list item have "delete" button, right have working delete need create confirmation dialog pop up. everything works, reason first button in list id goes javascript launches. in essence, after php loop runs, have line of code on html page 5 times. <input type="button" id="btnshowsimple" value="simple dialog" /> my javascript looks when "btnshowsimple" clicked, reason first 1 has function assigned it, when have same id? generate unique id's say $i=1; foreach($result $row) { echo '<input type="button" class="btnshowsimple" id="dialog['.$i.']" value="simple dialog" />'; $i++; } now use javascript see if class btnshowsimple clicked elements id , can whatever intend do.

asp.net mvc - Cannot add rows to a table in LINQ to EntityFramework - AddObject and InsertOnSubmit BOTH missing -

i know it's supposed 1 or other depending on whether using linq sql or linq entities ideas why neither option (addobject or insertonsubmit) available me? using linq entities shouldn't expect see addobject? update: per request, adding code. controller: using system.data; using system.data.entity; using system.linq; ...unimportant code... private datamodel db = new datamodel(); // <-- datamodel.edmx ...unimportant code... [httppost] public actionresult processapplication (httppostedfilebase file) { jobboardusersmodel jm = new jobboardusersmodel(); ...jm properties set... db.jobboardusers.add(jm) // <- here cannot use addobject or add client.send(message); jobdetails.isapplied = true; return redirecttoaction("index", jobdetails); } model: public class jobsummarymodel { public int? id { get; set; } public string name { get; set; } public string city { get; set; }

Jquery Removeclass and Form Validation -

i have here form validation. textbox doesn't allow special character except (-) using jquery validation. problems validation in bid , rfq textbox isn't working. accepts special characters , submit form. this working fiddle. http://jsfiddle.net/mhck7/1/ help please? jquery(function($) { var validation_holder; $("form#register_form input[name='submit']").click(function() { var validation_holder = 0; // /^[a-za-z\s]+$/ var rfq = $("form#register_form input[name='n_rfq']").val(); var rfq_regex = /^[0-9\-]+$/; // reg ex qty check var bid = $("form#register_form input[name='n_bid']").val(); var bid_regex = /^[0-9\-]+$/; // reg ex qty check var mode = $("form#register_form select[name='n_mode']").val(); var mode_regex = /^[a-za-z ]+$/; // reg ex qty check /* validation start */ if(bid

ios - Settings Bundle Not Changing Results -

Image
having difficulties settings bundle options , ability change settings within application. my plist structured following way. in viewdidload method have following: lbl = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 320, 80)]; lbl.backgroundcolor = [uicolor clearcolor]; lbl.textcolor = [uicolor whitecolor]; lbl.text = @"hello world"; lbl.textalignment = nstextalignmentcenter; [self.view addsubview:lbl]; [lbl release]; bool changebg = (bool)[[nsuserdefaults standarduserdefaults] valueforkey:@"cellswitched"]; if (changebg) { lbl.textcolor = [uicolor redcolor]; } else { lbl.textcolor = [uicolor blackcolor]; } the label changing black, never red. have tried rebooting device / reinstalling app. seems switch has no effect. the code should be: bool changebg = [[nsuserdefaults standarduserdefaults] boolforkey:@"cellswitched"]; you misusing valueforkey , incorrectly casting result.

javascript - I'm trying to toggle the top margin of a div on click. -

i'm trying shift div it's initial position top margin of 22em 0 when clicked. every other click should revert 22em. html <div id="container3" class="isdown"> <div class="test" id="name3"> </div> </div> css .test{margin-top: 22em;} jquery $("#container3").click( function(event){ event.preventdefault(); if ($(this).hasclass("isdown") ) { $("#name3").animate({margintop:"0em"}); $(this).removeclass("isdown"); } else { $("#name3").animate({margintop:"22em"}); $(this).addclass("isdown"); } return false; }); sorry if it's mess. have no idea i'm doing! try toggleclass css class like style .test{margin-top: 22em;} script $("#container3").click( function(event){ event.preventdefault(); $("#name3").toggleclass(

jquery - Moving data from One kendoui grid to other, both the grids have different models -

presenly have requirement in have pas data between 2 kendoui grids. problem datamodel of 2 grids different. my source grid has 2 columns destination grid had 2 columns source grid , additional columns. below have tried: unable insert selected records source destination grid. my source grid defination: <div id="searchadusergrid"> @(html.kendo().grid<viewmodeladusers>() .name("kaduser") .columns(columns => { columns.template(@<text></text>) .clienttemplate("<input type='checkbox' #= isselected ? checked='checked':'' # class='chkbx' />"); columns.bound(p => p.userloginname); columns.bound(p => p.userdisplayname); }) .autobind(false) .datasource(ds => ds

api - Extracting elevation from website for lat/lon points in Australia, using R -

g'day everyone, i trying elevation data 700 points have. thought might use code provided same question ( conversion latitude/longitude altitude in r ), unfortunately errors when using geonames package, , website best answer provides not have australian elevation data available (errors provided below fyi). i found website provides accurate elevation data australia, have no idea how might extract information webpage . think using google elevation api, again have no idea how access that. when put 'lat, lon' coordinates 'search location' box gives elevation data below map. however, can't seem find in source page. website http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm . some example lon lat values work: -36.0736, 146.9442 -36.0491, 146.4622 i wondering if can me query site r, , extract elevation data? or seem of hassle? realise there batch function (up 100 locations) on website, cool able r. thanks everyone, sorry if extremely obvi

android - Programmaticaly install app from google play and get response -

i starting google play store within app install targeted app. i know can achieved using this: try { startactivity(new intent(intent.action_view, uri.parse("market://details?id=" + apppackagename))); } catch (android.content.activitynotfoundexception anfe) { startactivity(new intent(intent.action_view, uri.parse("http://play.google.com/store/apps/details?id=" + apppackagename))); } question is - there way know if app installed using intent? startactivityforresult() work here? kind of response can expect? after you've launched intent yo, app can watch broadcast action_package_added (see doc here ). what should is: add service in app listen action_package_added in service, check if name match 1 want trigger event want.. launch intent in question , wait service triggered.. this may not simple want think way.

ios7 - Is it possible to use iOS 7's modified Helvetica in apps? -

Image
for ios 7, apple made special modified version of helvetica thin/light has rounded periods , colons: compare using helvetica-neue thin or helvetica-neue light in xcode: is possible develop apps special modified version rounded colons , periods? edit : turns out these round colons , periods not custom designed apple, "character alternates" , can see them in favorite font glyph viewer. here's how it. reading documentation, it's unclear. first, have characteristics of font, give constants use in uifontdescriptorfeaturesettingsattribute . got mine this post . this gives feature type identifier keys, , options values, feature selector identifier keys. nsarray *timerdisplaysettings = @[ @{ uifontfeaturetypeidentifierkey: @(6), uifontfeatureselectoridentifierkey: @(1) }, @{ uifontfeaturetypeident

android - Unable to use MatrixCursor.newRow() in Robolectric -

i have contentprovider attempting call matrixcursor.newrow() . crashing nullpointerexception in private method matrixcursor.ensurecapacity() . debugging this, see matrixcursor.data null (appears shadowmatrixcursor not instantiate in constructor). i'm using latest robolectric jar, version 2.2. @runwith(robolectrictestrunner.class) public class matrixcursortest { @test public void thiscrashesinnewrow() { matrixcursor c = new matrixcursor(new string[] { "test", "cols" }, 1); matrixcursor.rowbuilder b = c.newrow(); // crashes npe } } i'm trying understand how can around this. i've tried creating "myshadowmatrixcursor" follows, don't see how can override behavior of newrow() return empty rowbuilder (whose constructor default/package-private, not accessible shadow.) import android.database.matrixcursor; import android.database.matrixcursor.rowbuilder; import org.robolectric.annotation.implementatio

android - Applying Zoom on Imageview and Sliding Imges -

public class showimgsactivity extends activity implements ontouchlistener{ int imagesarray[]={r.drawable.a1,r.drawable.a2,r.drawable.a3}; private imageview img; private list<string> sd; float x1,x2; float y1, y2; private string[] files; private assetmanager assetmanager; private int possition; static int forwarint=1; private static final string tag = "touch"; @suppresswarnings("unused") private static final float min_zoom = 1f,max_zoom = 1f; // these matrices used scale points of image matrix matrix = new matrix(); matrix savedmatrix = new matrix(); // 3 states (events) user trying perform static final int none = 0; static final int drag = 1; static final int zoom = 2; int mode = none; // these pointf objects used record point(s) user touching pointf start = new pointf(); pointf mid = new pointf(); f

multithreading - Objective C wait until an asynch task has been processed -

in code, running local server (cocoahttpserver). when server receives request, creates thread , passes control method ( - (nsobject<httpresponse> *)httpresponseformethod:(nsstring *)method uri:(nsstring *)path , perhaps irrelevant here). i need read list of local assets , return result. api call ( [assetslibrary enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup *group, bool *stop) ... ) asynchronous. since httpresponse needs wait until api call has finished, have created flag called _isprocessing , set before making api call. after call finished, unsetting flag , returning http request. code wait looks like: // api call non-blocking. hence, wait in loop until command has finished samcommand->isprocessing = yes; while (samcommand->isprocessing) { usleep(100*1000); } the api call calls delegate method upon finishing task follows: // called @ end of asynch operation (eg: reading local asset list) - (void) commanddidfinish { // flag op

ios - NSFetchRequest Hangs -

i'm having trouble app hanging on nsfetchrequest. i've been reading quite few hours. there apparently threading issue going on, can't figure out how fix it. i'm downloading json object server, parsing , storing in coredata model. occurs on background thread complete before app hangs. here code occurs: - (void) populateregistrationlist:(nsstring *) list script:(nsstring *)script { nsurl *url = [nsurl urlwithstring:[primary_url stringbyappendingstring:script]]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration ephemeralsessionconfiguration]; nsurlsession *session = [nsurlsession sessionwithconfiguration:configuration]; nsurlsessiondownloadtask *task = [session downloadtaskwithrequest:request completionhandler:^(nsurl *localfile, nsurlresponse *response, nserror *error) { if (!error) { nsarray *jobj = [nsjsonserialization jsonobje

colors - Control middle value colours with scale_colour_continuous using R/ggplot2 -

Image
i have set of data , map colour aesthetic around sort of "reference value" so: values below red values near blue values above green i still want show fact values on continuoum, using function cut() , using scale_colour_discrete not i'm looking for. here's example data: set.seed(123) x <- runif(100, min = 1, max = 10) y <- runif(100, min = 1, max = 10) test <- data.frame(x = x, y = y) test$colour <- runif(100, min = 1, max = 10) ggplot(test, aes(x = x, y = y, colour = colour)) + geom_point(size = 3) that produces following: i'm familiar scale_colour_gradient(low = "red", high = "green") , hoping more deliberately transition colours along desired value mapping make regions "pop" bit more visually. spacing not linear. in other words, reference value of 3, mapping this: value: 1 3 10 colour: red blue green is possible? i'd take alternative solutions accomplish visualization highlig