Posts

Showing posts from March, 2012

java - Bst tree delete() method doesnt work -

i implementing binary search tree , wondering, why delete() method doesn't work... findmin() method work, have tested out far. type in key, doesn't exist in 3 , right exception, whenever type in key, existing, doesn't remove node three... here code far: import java.util.nosuchelementexception; public class bst { node root; node head; node tail; public bst(){ root = null; } public void insert (node root, int key){ node newnode=new node(key); if(root==null){ root=newnode; } if(key<=root.getkey()){ if (root.getleft()!=null){ insert(root.getleft(), key); } else{ root.setleft(newnode); } } if (key>=root.getkey()){ if (root.getright()!=null){ insert(root.getright(),key); } else{ root.setright(newnode); } } } public void printtree(node root){ if (root==null) return; printtree(root.getleft()); ...

javascript - How to set request body and params on $resource POST -

i'm attempting pass data in request body , request parameter angular $resource call. below click handler controller , service calls: controller.js: vm.setlimit = function(limit) { var data = { activity: 'point_limit', limit: limit }; playersservice.setplayerlimit({ playerid: playerid, data }); }; service.js: angular.module('gameapp') .factory('playersservice', ['$resource', function($resource) { var base = '/api/players/:playerid/'; return $resource(base, {}, { getplayerinfo: {method: 'get', url: base + 'playerinfo'}, setplayerlimit: {method: 'post', url: base + 'playerlimit'} }); }]); getplayerinfo works, setplayerlimit not because, reason, not being passed playerid . playersservice.setplayerlimit should take 4 parameters in order: (request parameters, request body, success callback, error callback) modify code as...

android - How to destroy a fragment and then create a new? -

i have fragment plays videos, start application , goes perfectly, when press button , select video file play, view not play video. videoactivity @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_video); a=this; th = thread.currentthread(); // obter url vÍdeo bundle extras = getintent().getextras(); if (extras != null) _videourl = extras.getstring("caminho_arquivo"); if (savedinstancestate == null) { getfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()).commit(); } } public static class placeholderfragment extends fragment { static private final int buffer_size = 700;// mb static private final int num_files = 20;// count files in cache dir public placeholderfragment() {} @override public view oncreateview(layoutinflater inflater, viewgroup conta...

android - Image rollover issue -

i implemented images rollover css using code: .content3{ background-image:url(../img/tablet2.jpg); background-repeat:no-repeat; border:5px solid #fa8072; border-radius:5px; width:220px; height:200px; margin:0 auto; } .content3:hover{ background-image:url(../img/servizibis.png); background-repeat:no-repeat; border:5px solid #fa8072; border-radius:5px; width:220px; height:200px; margin:0 auto; } this works fine on website desktop version doesn't work on responsive version on ipad , smartphone android. exist solution javascript or jquery code?

Really fast word ngram vectorization in R -

edit: new package text2vec excellent, , solves problem (and many others) well. text2vec on cran text2vec on github vignette illustrates ngram tokenization i have pretty large text dataset in r, i've imported character vector: #takes 15 seconds system.time({ set.seed(1) samplefun <- function(n, x, collapse){ paste(sample(x, n, replace=true), collapse=collapse) } words <- sapply(rpois(10000, 3) + 1, samplefun, letters, '') sents1 <- sapply(rpois(1000000, 5) + 1, samplefun, words, ' ') }) i can convert character data bag-of-words representation follows: library(stringi) library(matrix) tokens <- stri_split_fixed(sents1, ' ') token_vector <- unlist(tokens) bagofwords <- unique(token_vector) n.ids <- sapply(tokens, length) <- rep(seq_along(n.ids), n.ids) j <- match(token_vector, bagofwords) m <- sparsematrix(i=i, j=j, x=1l) colnames(m) <- bagofwords so r can vectorize 1,000,000 million short sentenc...

html5 - A div containing images disappears on iphone -

Image
i have tried searching solution everywhere not find it. hence posting request here. we have website built on php code-ignition mvc framework, issue html rendering on various devices imo. section on bottom of rendered page disappears on iphone, renders fine on ipad , normal browser. have saved page html , able reproduce via chrome devices (from developer tools), switching on various devices. the designer helped create these templates not accessible anymore, not able further help. suspect css issue. website uses twitter-bootstrap. screenshots: normal browser & iphone redering comparison: (the div in question marked arrow) i have looked view source , div in question appears on both versions in html source: <div class="button-holders button-overlay" id="button_holder"> <div class="col-sm-3 col-xs-3 noway" id="noway" style="display: block;"> <a id="noway1" style="cursor:point...

fortran90 - Have a function in fortran return a reference that can be placed on the left-hand-side of an assignment -

as stated in title, want directly modify data access through pointer retrieved function. having reference returned function appearing on l.h.s. of assignment(=) no issue in c++ following minimal example in fortran errors out: module test_mod implicit none integer, target :: a=1, b=2, c=3 ! member variables contains function get(i) integer, pointer :: integer, intent(in) :: select case (i) case (1) => case (2) => b case (3) => c end select end function end module test_mod program test use test_mod implicit none integer, pointer :: i_p !> prints out 1 2 3 print*, get(1), get(2), get(3) !> want error !> error: 'get' @ (1) not variable get(2) = 5 !> works not want i_p => get(2) i_p = 5 end program test is there way accomplish behaviour; maybe i'm missing attributes? bypass writing setter routines such as set(i,value) since should mimic appearan...

How to paste Excel data into Outlook as an image using VBA? -

i have excel sheet data in a1:q38 need paste body of outlook email. idea how while not saving image jpg or png? the outlook object model provides 3 main ways working item bodies: body . htmlbody . the word editor. wordeditor property of inspector class returns instance of word document represents message body. so, you can use word object model whatever need message body . for example, can use copy method of range class excel object model , use paste method of range class word object model paste copied data in excel. see chapter 17: working item bodies more information.

wordpress - HTTPS header issue with Chrome version 44.0.2403.xx -

i have been struggling since have installed new chrome version 44.0.2403.xx. my initial issue stylesheet on website load on https, website http. i use wordpress, have searched inside core function find https added url. the culprit is_ssl() function. wordpress base https verification on $_server['https'] variable, , mine set 1. i found out last google chrome version sending header https = 1 . how can prevent header cause problems website? to solve issue have enabled mod_header on server , added rule appache2.conf file: <ifmodule mod_headers.c> requestheader unset https </ifmodule>

asp.net mvc - MVC3 EditorTemplate for a nullable boolean using RadioButtons -

i have property on 1 of objects nullable boolean, want logic have true represent yes, false no , null n/a. because going have multiple properties on many different objects makes sense make editor , display templates these properties. going use jquery ui apply visual element of buttonset after working now, that's beyond scope of problem. editor template looks this. @model bool? <div data-ui="buttonset"> @html.radiobuttonfor(x => x, true, new { id = viewdata.templateinfo.getfullhtmlfieldid("") + "yes"}) <label for="@(viewdata.templateinfo.getfullhtmlfieldid(""))yes">yes</label> @html.radiobuttonfor(x => x, false, new { id = viewdata.templateinfo.getfullhtmlfieldid("") + "no" }) <label for="@(viewdata.templateinfo.getfullhtmlfieldid(""))no">no</label> @html.radiobuttonfor(x => x, "null", new { id = viewdata.templateinfo.getfullhtmlfieldid(...

java - Where can I find WORKING samples of Amazon's S3 Image Upload Code for Android -

i have spent past 2 days struggling amazon's s3 sdk android. able java 1 (in eclipse) working without problems whatsoever; upload pictures, download them, , no problem. changing gears android, however, , have had no luck. currently, selected code: amazons3client s3 = new amazons3client( new basicawscredentials( constants.aws_access_key, constants.aws_secret_access_key ) ); //these correct, have confirmed. objectmetadata metadata = new objectmetadata(); metadata.setcontenttype("jpeg"); //binary data putobjectrequest putobjectrequest = new putobjectrequest( constants.bucketname, constants.key3, new file(selectedimageuri.getpath()) ); //selectedimageuri correct well, //(file:///storage/emulated/0/mydir/image_1437585138776.jpg) putobjectrequest.setmetadata(metadata); s3.putobject(putobjectrequest); //errors out here i getting multiple errors, common of this: amazonhttpclient﹕ unable execute http request: write error: ssl=0xb8cefc10: i/o...

javascript - How to put string label on X axis in d3 -

Image
i using scatter plot d3 , i'm trying label x axis of plot string can read csv file. here code current implementation: var xvalue = function(d) { return d.age;}, // data -> value xscale = d3.scale.linear().range([0, width]), // value -> display xmap = function(d) { return xscale(xvalue(d));}, // data -> display xaxis = d3.svg.axis().scale(xscale).orient("bottom"); var yvalue = function(d) { return d["income"];}, // data -> value yscale = d3.scale.linear().range([height, 0]), // value -> display ymap = function(d) { return yscale(yvalue(d));}, // data -> display yaxis = d3.svg.axis().scale(yscale).orient("left"); d3.csv("predict_plot_h1b.csv", function(error, data) { // x-axis // y-axis // other d3 elements }); this gives me (only x axis labels important in plot below): this csv data looks like: age, income 72, 2 50, 1 55, 3 50, 2 80, 2 so on here want use exact age la...

ios - UIViewController interfaceOrientation Property Deprecated -

i utilizing interfaceproperty of uiviewcontroller of ios 8 has been deprecated. @property(nonatomic,readonly) uiinterfaceorientation interfaceorientation ns_deprecated_ios(2_0,8_0); i using said property determining physical home button orientated accelerometer , gravity vector corrections. uideviceorientation not suitable replacement because these corrections applied user interface . i have searched suitable refactoring advice, however, not apply use of property. you can try using uiapplication.sharedapplication().statusbarorientation it return uiinterfaceorientation value can use interface orientation of device.

how to use two List<> as datasource of a repeater at the same time asp.net -

i trying display data of 2 different list<> repeater. secondary list must displayed in column of table inside of repeater. both number of list<>'s items same.i happy if guys give me solution or method solving. you concatenate 2 string lists object list so: make new class has 2 strings properties (this can in current page code behind file if want should outside of page's class declaration - e.g. below end if page class): class twostrings { public string string1 { get; set; } public string string2 { get; set; } } here sample code take 2 lists of strings (like have) , brings them in list of twostrings class. list<string> list1 = new list<string>(); list<string> list2 = new list<string>(); //some sample data list1.add("1"); list2.add("one"); list1.add("2"); list2.add("two"); list<twostrings> twostringlist = new list<twostrings>(); //this assumimg both lists same...

java - android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams -

there other related issues on not address situation (their error code has sort of recycling and/or bad cast calls client code). my situation more complex. i have code user can pull library of photos. the thing is, working fine on 7 phones have, running api's 19+. however have google nexus 4.3 that's running api 17. , crash log has none of code, library code. if can advise how might able code work around i'd ears: fatal exception: main java.lang.classcastexception: android.widget.framelayout$layoutparams cannot cast android.widget.abslistview$layoutparams @ android.widget.gridview.onmeasure(gridview.java:1042) @ android.view.view.measure(view.java:15848) @ android.widget.relativelayout.measurechildhorizontal(relativelayout.java:728) @ android.widget.relativelayout.onmeasure(relativelayout.java:477) @ android.view.view.measure(view.java:15848) @ android.widget.relativelayout.measurechild...

opencv - Mapping frames based on motion -

i need create 3 intermediate frames between 2 frames (previmg, nextimg), have found out motion of each pixel using calcopticalflowfarneback() function in opencv calcopticalflowfarneback(gray1, gray2, flow, pyrscale, pyrlevel, winsize, iter, polyn, sigma, method); then have created 3 intermediate frames calling function createnewframe(), following shift (func. argument) values 0.25, 0.5, 0.75 void createnewframe(mat & frame, const mat & flow, float shift, int & c, mat & prev, mat &next) { (int y = 0; y < mapx.rows; y++) { (int x = 0; x < mapx.cols; x++) { point2f f = flow.at<point2f>(y, x); mapx.at<float>(y, x) = x + f.x/shift; mapy.at<float>(y, x) = y + f.y/shift; } } remap(frame, newframe, mapx, mapy, inter_linear); } but not getting proper intermediate frames.. transition 1 frame other non smooth (flickering). problem in code ? need proper intermediate frames ...

android - Why is my apk output versionCode not updating correctly? -

i'm trying minimize apps apk size splitting them abi. i'm using following guide doing that. the problem i'm having versioncode not updating correctly on output apk. added printf test versioncode being computed , was. any ideas help. here gradle file. parts omitted.. apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.vblast.test" minsdkversion 14 targetsdkversion 22 versioncode 41 versionname "1.4.7" } // special flavor dimensions different markets , // versions paid , free. flavordimensions 'market', 'version' productflavors { google { dimension 'market' } amazon { dimension 'market' } mobiroo { dimension 'market' } // base free version ...

ios - xCode search bar crash when I'm trying to query data with parse -

so here's code - (void)viewdidload { [super viewdidload]; _queriedresults = [[nsmutablearray alloc]init] } -(void)searchbar:(uisearchbar *)searchbar textdidchange:(nsstring *)searchtext{ [_queriedresults addobjectsfromarray:[self searchbarquery:[searchtext lowercasestring]]]; } -(nsarray*)searchbarquery:(nsstring*)searcheduser{ nsarray * users; pfquery *query = [pfuser query]; [query wherekey:@"username" equalto:[searcheduser lowercasestring]]; users = [query findobjects]; return users; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath]; cell.textlabel.text = [_queriedresults[indexpath.row]username]; return cell; } so main functions i'm using in view controller class. i've done debugging , queriedresults succesfully name of user searching, tablev...

single sign on - Why does it fail every time it wants to create the super user account in CA SiteMinder during Policy Server Installation? -

i'm trying install ca policy server ca single sign-on (formerly ca siteminder)but after 3 or 4 times i'm getting same error command: "c:\users\administrator.ajc\appdata\local\temp\2\195853.tmp\smreg" -su ****** return: -1 stdout: policy store not initialized. failed create super user account. stderr: *** i tried mentioned on discussion " the policy store not initializated " ca security single sign on community: base tables: c:\f6\ca\siteminder\db\sql\sm_mssql_ps.sql xps tables: c:\f6\ca\siteminder\xps\db\sqlserver.sql siteminder xdd files: xpsimport c:\f6\ca\siteminder\xps\dd\smmaster.xdd but cannot run xpsimport. cannot run smreg -su password , don't have idea i'm doing wrong. googled didn't found solution. information need know in order me, it. i'm little bit newbie lkind of environment (ms windows server, ms sql server, etc.) king regards. ps: i'm trying in windows server 2012 r2 , have installed sql server 201...

c - Reasons for compilation error -

Image
the hackerearth facebook page uploads mcqs these everyday! so, suppose can share image here. seems me compilation error! because of fact there statement post-increments char array a in for loop! last 2 statements:: &lt;p<<k } are valid in way? < & > converted &gt; &lt; etc link says < gets converted &lt; ! or compiler error? was curious because couldn't trust myself compilation error closing bracket , &lt;p<<k; statement there in question! the last 2 lines not supposed there. question differences between arrays , pointers. found answer: a array, not pointer, , can therefore not post-incremented.

Draw multiple lines on the same graph in Matlab? plot() or something else? -

i want draw several dots, , lines connecting of dots. programmed this: prompt = 'please enter file name: '; filename = input(prompt, 's'); saturationfile=fopen(filename); porecount =fscanf(saturationfile, '%d\n', 1); throatcount=fscanf(saturationfile, '%d\n', 1); pi=fscanf(saturationfile, '%d\n', porecount); px=fscanf(saturationfile, '%f\n', porecount); py=fscanf(saturationfile, '%f\n', porecount); ps=fscanf(saturationfile, '%d\n', porecount); ti=fscanf(saturationfile, '%d\n', throatcount); tb=fscanf(saturationfile, '%d\n', throatcount); te=fscanf(saturationfile, '%d\n', throatcount); ta=fscanf(saturationfile, '%f\n', throatcount); tl=fscanf(saturationfile, '%f\n', throatcount); ts=fscanf(saturationfile, '%d\n', throatcount); tb=tb+1; te=te+1; maxa=0; i=1:throatcount if ta(i)>maxa maxa=ta(i); end end scale=10; px =px *scale; py =py *scale;...

jQuery, delay link replacing iframe target -

i have simple grid layout 4 thumbnails, each link inside changes target of single iframe sits @ top of page. these work fine, want add slight delay iframe's target changing allow page scroll top after each click. here iframe code; <iframe id="video-frame" name="video-frame" width="560" height="315" src="[youtube-url]" frameborder="0" allowfullscreen></iframe> this play button code (of there 4, each different href values; <a class="play-button" href="[youtube-url]">&nbsp;</a> and jquery code scrolls page top on each .play-button click $('.play-button').click(function(){ $('html, body').animate({ scrolltop: 0 }, 500); $('#video-frame').attr("src", $(this).attr("href")); }); my issue changing of iframe src causes scroll glitchy need add 650ms delay changing of iframe src scroll has finished if trying...

javascript - Can't go between fragments onClick -

i have 2 fragments, fragmenta , fragmentb. have button on layout of fragmenta, want go fragmentb when click button. tried few things doesn't work. have. this fragmenta. import android.app.fragmentmanager; import android.app.fragmenttransaction; import android.os.bundle; import android.app.fragment; //import android.support.v4.app.fragmentmanager; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.button; /** * simple {@link fragment} subclass. */ public class fragmenta extends fragment implements view.onclicklistener { button button; view v; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment v = inflater.inflate(r.layout.fragment_a, container, false); return v; } @override public void onactivitycreated(bundle savedinstancestate) { s...

How to retrieve the package-name of a resource using the SonarQube REST-API? -

can think of elegant way determine package of java-class in sonarqube using rest-api? this snippet http://myhost:9000/sonar/api/resources?resource=my.project%3asimple.analysis&depth=-1&scopes=fil delivers result containing <lname>my/project/src/com/tobi/my/heros/schmidtskatze.java</lname> i xslt com/tobi/my/heros/ , wonder if there propper way? think? from question ask, reckon using sonarqube 4.2 or later. since sq 4.2, resource ws language agnostic , deals files , directories, not java class , packages anymore. therefor, information looking not available in plain in ws response, you'll have xslt or other parsing , transformation.

c++ - OSX, VideoToolbox, Compression Session -

environment osx yosemite xcode 6.4 c++ use-case given h264 gop consisting of single key-frame , multiple corresponding delta frames, decode gop, , then, encode single 4.2mbit key-frame problem description i able decode gop , encode key-frame, however, resulting key-frame of low quality ( low bit-rate ), is, although set bit-rate 4.2mbit ( can seen in code snap bellow ), having in mind need single key-frame , there way setup videotoolbox encoder output high bit-rate key-frame ? const cmvideocodectype fourcc = (cmvideocodectype)cmvideoformatdescriptiongetcodectype(fmt); // else, generate h264 keyframe cfobjectsmartptr< cfmutabledictionaryref > dictencspec; dictencspec.attach(cfdictionarycreatemutable(null, 0, &kcftypedictionarykeycallbacks, &kcftypedictionaryvaluecallbacks)); //dictencspec.attach(cfdictionarycreatemutable(null, 0, 0, 0)); // cfdictionarysetnumval(dictencspec, kvtvideoencoderspecification_requirehardwareacceleratedvideoencoder, true...

ruby on rails - RoR - Select tag with include_blank disable -

i want result : <select dir="rtl"> <option selected disabled>choose car</option> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> with following code can end : <%= f.select(:car, xxxxxx, {:include_blank => 'choose car', :disabled => 'choose car'}) %> => <select id="xxx" name="xxx"> <option value="">choose car</option> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> the first option not disabled... i believe looking below: <%= f....

caching - Odata filter on cached data -

say instance want pull list of 50 individuals. when using odata filter, $top=2&$skip=4, returning 2 records, wanting possibly sending 50 individuals, , able run filter against those. when debug program, run 50, , every subsequent call brings me 50 cache. when run same thing, add following $top=2&$skip=4, runs through code , gets records , returns 2 objects code, not cache. getindividuals(odataqueryoptions<individuals> opts) { ..... var results = opts.applyto(objall.asqueryable(), settings); return new pageresult<individual>( results ienumerable<individual>, request.odataproperties().nextlink, objall.asqueryable().count()); } i hope clear.....any ideas on how return larger group of data , run odata on after fact?

azure - Choosing a long-term storage/analytic system? -

a brief summary of project i'm working on: i hired web dev intern @ small company (part of larger corporation) close state college attend. past couple months, myself , 2 other interns have been working on front-end back-end. company prototyping adding sensors products (oil/gas industry); tasked building portal customers login to see data machines if they're not near them. basically, we're collecting sensor data (~ten sensors/machine) , it's sent us. we're stuck determining best way store , analyze long term data. have redis cache set fast access front-end, lastest set of data each machine stored. historical data, (and coworkers) having tough time deciding best route go. our whole project based in vs (c#/razor) azure integration (which amazing way), i'd keep long term storage there well. far can tell, hdinsight + data in blob seems best option, i'm green when comes backend solutions. input older developers may have more experience in area, developers ...

javascript - Directions map not centering/zooming properly -

update: have static solution working right now, i'd still see if can improved upon. of code same aside on click event switching views. $(document).on('click', '.mobile-toggle a', function (e) { e.preventdefault(); if (!$(this).hasclass("active")) { var target = $(this).attr("data-target"); $("#results > div, .mobile-toggle a").removeclass("active"); $(this).addclass("active"); $("#" + target).addclass("active"); } var center = dmap.getcenter(); google.maps.event.trigger(dmap, 'resize'); dmap.setcenter(center); dmap.setzoom(12); }); this gets map centered properly, good. zoom fine, doesn't fit route. route big fit, , other times map should zoomed in little bit more. there way determine zoom value should used based on route? i'm supposed happen on own, doesn't seem case time around. original post below. ...

c++ - Multimap no match for operator== -

i have multimap inside bar class , unsigned long , reference foo class . class bar { //etc. struct map_sort { bool operator()(const unsigned long& e1, const unsigned long& e2) const { return (e2 < e1); } }; std::multimap<const unsigned long,const foo&, map_sort> m_map; find_and_erase(const unsigned long var1, const foo& var2); } and want retrieve values multimap , erase some. void bar::find_and_erase(const unsigned long var1, const foo& var2) { auto = m_map.begin(); (it=m_map.begin(); it!=m_map.end(); ++it) { const unsigned long first = (*it).first; const foo& second = (*it).second; if((first == var1) && (second == var2)) //<----error no match operator== m_map.erase(it); } } question how can compare (second == var2) ? (what want find entries multimap, , delete ones on find_and_erase() f...

.net - How to view all properties for a loaded Visual Studio project? -

i'm struggling issue i'm having custom defined project property, supposed imported external build target file. the property defined such in imported file: <project> <!-- ... --> <propertygroup> <!-- ... --> <mycustompath>$(myothercustompath)\myrelativepath</mycustompath> <!-- ... --> </propertygroup> <!-- ... --> </project> appearantly though, i'm trying variable doesn't seem working. leading me guess reason property isn't loaded project should. so able, visual studio, check on property's current value make sure set correctly. isn't there way can list of given project's properties , in-memory values?

delphi - How can I determine the input area size of a TEdit? -

it's easy outer dimensions of tedit control, includes bevel (or frame, depending on whether ctrl3d true or not). find out dimension , position of white input area of tedit. i tried tedit.clientrect, seems give correct size if ctrl3d true. still have add 2 pixels left , top adjust bevel. if ctrl3d false, size large 2 pixes , left / top offset must increased one. is there way correct size , position of area, e.g. using windows api function? on vista , higher, can use em_getrect message: function geteditrect(edit: tcustomedit): trect; begin sendmessage(edit.handle, em_getrect, 0, lparam(@result)); end; unfortunately: under conditions, em_getrect might not return exact values em_setrect or em_setrectnp set—it approximately correct, can off few pixels.

android - SQLite : DEFAULT values are not set to table's columns -

i trying create table in app's sqlite database has 3 columns accept integer values. create table use following code : db = openorcreatedatabase("helpmedatabase", context.mode_private, null); db.execsql("create table if not exists settings (\n" + "\t whatsapp \t integer not null default 1,\n" + "\t viber \t integer not null default 1,\n" + "\t vibration \t integer not null default 1\n" + ");"); the table created default values not assigned columns . have idea why happens? sorry taking long answer. @nkorth's , @rajesh khadka's suggestions managed solve issue. so, after table's creations put condition insert single row once. db.execsql("create table if not exists settings (" + " whatsapp integer default 1 not null," + " viber integer default 1 not null," + ...

iOS Swift Segues -

Image
what want: when i'm on green screen , push button "pushtobrown" want brown screen "think" i'm coming blue. if push button in brown screen want go blue. at moment: call green screen programmatically example performseguewithidentifier(..., nil) , can switch brown or implement drag&drop (from button "pushtobrown" brownvc screen). if push "back button" go green. -> how can tell brown should go blue? i suppose that's problem navigation controller. me if know tutorials segues or navigationcontroller handlding. thanks in advance! the solution problem unwind segue : what unwind segues , how use them? what should ( can see in link ) add exit point, create unwind method , call 1 instead of simple popviewcontroller . first answer contains both explanation, code examples, , both objective-c , swift

javascript - How can I recognize a hand drawn shape is similar to a SVG Model -

i let users re-draw on svg shape (the number 8), , able detect if shape completed or not. user have re-draw on borders of svg, finger on mobile, abie continue through website. want use javascript. my first approach use hidden divs , detect whenever mouse passes on each 1 in right order (see sketch ), there can errors. , highlight drawn track in way show filling progress. which approach should use ? well, depends on how implemented drawing canvas. without actual code, it's difficult provide answer. regardless, might try use second path hidden/transparent , overlaps first one. then capture mouseenter/mouseleave (or whatever events you're using "draw") , based on event coordinates, assess if "shape" correctly draw or not. basic example: var foo = document.getelementbyid('foo'), x = -1, y = -1; function between(n, en, err) { return (n >= en - err && n <= en + err); } function fail() { // user ...

delphi - TCheckBox to filter dataset by a field -

i'm trying filter dataset 1 field when ticking checkbox, following code have put , thought correct doesn't appear working, brings 0 records. procedure tfrmcustomers.cbclick(sender: tobject); if cbactive.checked = true dmod.cds begin disablecontrols; try filtered := false; filteroptions := [focaseinsensitive,fonopartialcompare]; filter := ('active true'); filtered := true; enablecontrols; end; end; end; the name of field in dataset called 'active' , stores string of either 'true' or 'false'. any appreciated. thanks, if field 'active' holds string should write: filter := ('active = ''true'''); right filtering on boolean value true. also, why don't use boolean / bit field active field?

rdf - Multiple statements query SPARQL 1.1 property-paths Virtuoso 7.2.X -

a sample rdf dataset has entries owl#namedindividual grouped owl#class , custom relation named ismemberof . when try obtain list of results segregated type, works moment add way obtain corresponding ismemberof don't expected results. here 3 sparql 1.1 queries gave virtuoso (sample dataset below): query 1 sparql select * <test> { #if uncomment next line don't proper results # ?s <ismemberof> ?member_of. ?s rdfs:label ?name. { ?s rdf:type/rdfs:subclassof* <livingthings>. } union { ?s <rock>. } }; query 2 sparql select * <test> { #if uncomment next line no results @ # ?s <ismemberof> ?member_of. ?s rdfs:label ?name. ?s rdf:type/rdfs:subclassof* <livingthings>. }; query 3 sparql select * <test> { ?s <ismemberof> ?member_of. ?s rdfs:label ?name. ?s rdf:type <dog>. #if replace previous line next line no results @ # ?s rdf:type/rdfs:subclassof* <livingthings>. }; t...