Posts

Showing posts from January, 2011

Android listview with nested CursorAdapters? -

i trying implement variation on simple master-detail view, can't seem find out there relates particular issue. it's possible , not searching on right terms, in case, i'd appreciate point in right direction. instead of standard master-detail approach planning on, i'd display detail in master listview textview ellipsis, , display popup dialog. for record in master table, there 1...n detail records, need access when displaying master listview. i've looked @ cursorjoiner, don't think fits needs, require cursors sorted on record id, display want them ordered alphabetically. is possible , idea nest cursoradapters? in master cursoradapter, have new cursorloader load details item. or there better way go this?

codeigniter - Only the first row of a table updates after new details are inserted in a popup form -

in each row of table, have “insert” link. when user clicks link, popup window appears containing form. when user clicks “save” button form, form update works first row of parent table. takes first row id. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </style>--> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>popup contact form using css - demo | codingcrazy</title> <link href="<?php echo base_url();?>assets/css/styleform.css" rel="stylesheet" type="text/css"/> <link href='http://fonts.googleapis.com/css?family=electrolize' rel='stylesheet' type='text/css' /> <!--cc--> <link rel="stylesheet" href="<?php echo base_url();?>ass

html5 - Dynamically rotate text horizontally in jquery -

Image
i add functionality rotate text horizontally in jquery plugin. found 1 plugin called jqueryrain rotating 360 deg clock/anti-clock wise.

Transfer CVS repository to GIT repository -

i have files in cvs repository, need in way transfer git without conflicts , bugs..what risk need take? the cvs server , git server set on linux ofcourse how can that? anthor question, if use software dosent have git plugin, how can use git yet? repeated: migrate cvs git without losing history about second question, not need plugin use git software. can use want. otherthing if asking ides git integration. again, can use git directly without them too.

c# - WCF Rest XML EndPoint.(HTTPPOST). Deserialise an external object -

i have service contract supposed accept widget input parameter. widget spec given me third party using contract. made appropriate data contracts , can use unit test (which using wcf service reference) serialize widget , http post. it bare bones xml serialization embedded in body of httppost. not formed xml document. e.g. stringwriter sw = new stringwriter(); xmltextwriter xtw = new xmltextwriter(sw); xtw.writestartelement("widget"); xtw.writeelementstring("datetime", widget.datetime); xtw.writestartelement("status"); foreach (myservref.status status in widget.status) { xtw.writestartelement("status"); xtw.writeelementstring("bay", status.bay.tostring()); xtw.writeelementstring("currentstate", status.currentstate.tostring()); xtw.writeelementstring("sector", status.sector.tostring()); xtw.writeelementst

android - How to set programmatically "allow all devices to connect" in Tethering and Wi-Fi hotspot Settings -

i have developed android application control tethering , wi-fi hotspot settings in device. able important tasks such turn on-off wi-fi hotspot, chage ap name, shared key ect.. still not able find method control "allow devices connect" option. if there method please me..

c# - ReWrite only root URL in IIS - ignore everything else? -

curious knows way re-write root url of app in iis , ignore else? for example: www.test.com/ re-directs web.test.com www.test.com redirects web.test.com www.test.com/intro not redirect http://www.iis.net/downloads/microsoft/url-rewrite iis has url rewrite plugin.when install this,you can add rule use regex www.test.com[/]{0,1}$ match www.test.com or www.test.com/ not match www.test.com/intro,so can redirect match url

c++ - Surface Mesh Generation Code in CGAL, not compiling -

i trying utilize surface reconstruction feature of cgal (taken here , yet keep getting error: in file included /usr/include/cgal/io/output_surface_facets_to_polyhedron.h:25:0, /home/mrsl_student/git/catkin_ws/src/mesh_map/include/mesh_map/cgaldelaunaytriangulation.h:14, /home/mrsl_student/git/catkin_ws/src/mesh_map/src/cgaldelaunaytriangulation.cpp:3: /usr/include/cgal/value_type_traits.h: in instantiation of ‘struct cgal::value_type_traits<cgal::point_with_normal_3<cgal::epick> >’: /usr/include/cgal/point_with_normal_3.h:165:1: required substitution of ‘template<class iter> cgal::normal_of_point_with_normal_pmap<typename cgal::kernel_traits<typename cgal::value_type_traits<t>::type>::kernel> cgal::make_normal_of_point_with_normal_pmap(iter) [with iter = cgal::point_with_normal_3<cgal::epick>]’ /home/mrsl_student/git/catkin_ws/src/mesh_map/src/cgaldelaunaytriangulation.cpp:21:113: required here /u

android - How to enable GPS automatically -

i using code security exception. private void turngpson(){ string provider = settings.secure.getstring(getcontentresolver(), settings.secure.location_providers_allowed); if(!provider.contains("gps")){ //if gps disabled final intent poke = new intent(); poke.setclassname("com.android.settings", "com.android.settings.widget.settingsappwidgetprovider"); poke.addcategory(intent.category_alternative); poke.setdata(uri.parse("3")); sendbroadcast(poke); } } private void turngpsoff(){ string provider = settings.secure.getstring(getcontentresolver(), settings.secure.location_providers_allowed); if(provider.contains("gps")){ //if gps enabled final intent poke = new intent(); poke.setclassname("com.android.settings", "com.android.settings.widget.settingsappwidgetprovider"); poke.addcategory(intent.category_alternative); poke.setdata(uri.parse("3")); sendbroadc

angularjs - Use filter input to search globally on server in angular ui-grid -

i using angular ui-grid display data. i want use ui-grid's filter input used global search box. in, when type in filter input should make api call server. i have similar on single column in grid. column has attribute "useexternalfiltering: true". from columndefs { name: 'myfieldname', displayname: 'column name', useexternalfiltering: true, filter: { condition: uigridconstants.filter.contains }, }, then in controller have $scope.gridoptions.onregisterapi = function (gridapi) { $scope.gridapi = gridapi; $scope.gridapi.core.on.filterchanged($scope, function () { var grid = this.grid; var columnindex = 1; // index of column want work var termfrommycolumnofinterest = grid.columns[columnindex].filters[0].term; $scope.loaddata(termfrommycolumnofinterest); $scope.gridapi.core.notifydatachange(uigridconstants.datachange.all); } } $scope.loaddata = function (term) { $q.all([ you

java - JSP does not create class of servlet on linux -

Image
this jsp code called html file... <% system.out.println("debug1"); int id = (request.getrequestedsessionid()+request.getremoteaddr()).hashcode(); system.out.println("debug2"); servletclass d = new servletclass(id); // stuck here system.out.println("debug3"); string sen = request.getparameter("data"); string name = request.getparameter("name"); system.out.println("sen: "+sen); string rtn = d.runjob(name, sen); system.out.println("rtn: "+rtn); %> i developed project on windows eclipse , tried war deployment test on windows. worked wanted. but when copy war file linux , tried deploy on it, new servletclass(id) not working. terminal shows debug1 , debug2. of course, changed server.xml in linux is there difference between windows , linux? on centos 7. p.s. used apache tomcat 8.0.24 edit i'm sorry can't upload class code because of part of work company. invokes several methods in javase

python - How to iterate over a generator? -

assume big list , want iterate on it. >>> x=[] >>> in x: print(x) but because list big, using generator best way: >>> g=(i in range(10)) >>> g.__next__() 0 but there problem number of times iterate. because don't know how many times should use g.__next__() , need more dynamic. for example: for in x: it not important how long x loop iterate end. how can iterate using generators? you can use for syntax generators: >>> g=(i in range(10)) >>> g <generator object <genexpr> @ 0x7fd70d42b0f0> >>> in g: ... print ... 0 1 2 3 4 5 6 7 8 9

How to write single line scala codes? -

i'm new scala , i've written piece of code takes employee file(empid, name, age, salary, department) input , prints out department , total salary in department. it novice code. how shorten code? please code: object usingcollectionmaps { def main(a: array[string]) { val filename = "employee.txt" var map = collection.mutable.map[string,long]() var sal: long = 0 (line <- source.fromfile(filename).getlines()) { val fields = line.split(",") if (map.contains(fields(4))) { map.put(fields(4), (map(fields(4)) + fields(3).tolong)) } else { map.put(fields(4), fields(3).tolong) } } println(map) } } i try avoid mutable structures , make sense of file, part case class. after that, use of groupby , sum. import scala.io.source case class employee(empid: string, name: string, age: int, salary: long, department: int) source.fromfile("somefile.txt")

Display Contents of PDF opened in iOS App (Swift) -

i have app configured pdfs in other applications such mail, can hold down on pdf , have open "open in" app; have working , app opens, want display document in app, how do that? pretty sure have use appdelegate, started using swift , lost , cannot find tutorial helps task, appreciated. appdelegate.swift class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? let uiapplicationlaunchoptionsurlkey: string = "" func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { if uiapplicationlaunchoptionsurlkey.isempty { print("string empty.") } else{ let alertview:uialertview = uialertview() alertview.title = "pdf upload" alertview.message = "??" alertview.delegate = self alertview.addbuttonwithtitle("ok") alertview.show() } return true } in appdelegate's didfinishlaunching

c# - Adding sound effects to WPF Surface application -

i trying play sound whenever object touched/moved in wpf surface application, depict has been selected or movement. here tried doesn't seem work. soundplayeraction soundplayeraction = new soundplayeraction(); soundplayeraction.source = new uri(@"c:\resources\selection.wav", urikind.relativeorabsolute); eventtrigger eventtrigger = new eventtrigger(touchenterevent); // event want trigger sound effect. eventtrigger.actions.add(soundplayeraction); any feedback or ideas appreciated. create new folder in project , rename sounds insert sound files in , try this: soundplayeraction soundplayeraction = new soundplayeraction(); soundplayeraction.source = new uri(@"sounds\selection.wav", urikind.relativeorabsolute); eventtrigger eventtrigger = new eventtrigger(touchenterevent); // event want trigger sound effect. eventtrigger.actions.add(soundplayeraction); triggers.add(eventtrigger); // add event trigger window.triggers

internet explorer - PNG img displays in Visual Studio Designer but not IE -

Image
i writing webpage. want there banner image on top of webpage. here html , css: index.html <!doctype html> <html> <head> <title>protect environment!</title> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body> <div> <img src="http://intranet.kings.edu.hk/~s13977/banner.png" id="banner-image" alt=""/> </div> </body> </html> styles.css body { background:#f8e4e4; font-family:'segoe ui', tahoma, geneva, verdana, sans-serif; font-size:medium; } #banner-image { height: 106px; width: 582px; } as can see, did put image in html , src set correct url. can copy url , check. here how looks visual studio designer: but when run ie, looks this: i tried add #banner-image css rule: visibility:visible; but doesn't work @ all. page stays sam

angularjs - Protractor returning a value from a promise -

i'm writing test see if code removing level looking @ text value on screen holds count of levels. 'allows deleting level versions', -> browser.get('/api#/costings') element(by.id("edit")).click() startcount = element(by.id("versions_count")).gettext().then( (count) -> return count ) element(by.id("versions")).click() first=element.all(by.id("listing")).first() first.element(by.id("delete")).click() helper.accept_dialog() element(by.id("back")).click() expect(element(by.id("versions_count")).gettext()).toequal(startcount - 1) problem here startcount results in function. cannot seem startcount integer can see if count has gone down 1 item. it gives me error; 1) edit existing costing allows deleting level versions message: expected '1' equal nan. if try parseint(startcount) same error. the variable startc

cordova - AngularJS JSON Parsing issue...below is the response i dont know how to parse data -

below response { "messages": { "httpcode": 200, "message": "signed in successfully" } } below code controller, want make loop if httpcode == 200 , want assign value variable var res = $http.post('http://webservices.it.com/webservices/services/customerdetail/login', data); res.success(function(data, status, headers, config) { console.log("check", json.stringify(data)); $scope.status = status; console.log("data", $scope.data); console.log("b1222", $scope.messages); console.log("status", $scope.status); console.log("status", $scope.headers); console.log("status", $scope.config); alert(" message: " + json.stringify({ data: data })); }); res.error(function(data, status, headers, config) { $scope.error = data; console.log("status", $scope.error); alert(&

ios - App crashes if the view disappears while the UiTableView is being reloaded -

i have view list of entities pulled remote source (via web-service). app crashes, if button pressed (view tableview disappears) while entities being loaded on table view. if keyboard appeared, resign keyboard.

jquery - Adding queuecomplete to dropzone.js -

i have been trying figure our how add queuecomplete callback option dropzone.js. read dropzone.js - how after files uploaded shows couple options, not understand where/how implement this. tried adding code after reference dropzone.js, in dropzone.js, etc no luck. trying make simple minimal form dropzone class. i tried: dropzone.options.filedrop = { init: function () { this.on("complete", function (file) { if (this.getuploadingfiles().length === 0 && this.getqueuedfiles().length === 0) { dosomething(); } }); } }; and also this.on("queuecomplete", function (file) { alert("all files have uploaded "); }); but keep getting dropzone not defined. i think need know how implement this. you must add javascript file first, , after script working with. <script src="./path/to/dropzone.js"></script> <script> dropzone.options.filedrop = { init: function () { t

algorithm - Structured Light - How to do when the projector's resolution is lower than patterns? -

Image
i try build structured light environment 3d scanning. as far know, if choose use gray code reconstruct 3d model, have implement specific patterns encode in power 2(2^x, x = 0 ~ 10). that said, patterns must @ least 1024 x 1024 in resolution. what if dlp projector support resolution 800 x 480? projects moire pattern when gray code pattern resolution becomes high(i tried). should do? my friends suggest create 1024 x 1024 patterns, , "crop" them 800 x 480, but thought gray code should follow specific sequence , patterns, friends suggestion create several image not symmetry. does have same experience me? ----------2015.8.4 update question---------- i thinking if projector can't projects high resolution patterns, can let projects patterns low resolution, instance, 2^0 2^6? or gray code strictly demands patterns 2^0 2^10? otherwise gray code not available? you can not directly scale down resolution because distort pattern make useless instea

Why is this Autofac mock's lifetime disposed in a simple MSpec test? -

i've got base class i'm using mspec provides convenience methods around automock: public abstract class subjectbuildercontext { static automock _container; protected static isubjectbuilderconfigurationcontext<t> buildsubject<t>() { _container = automock.getloose(); return new subjectbuilderconfigurationcontext<t>(_container); } protected static mock<tdouble> getmock<tdouble>() tdouble : class { return _container.mock<tdouble>(); } } occasionally, i'm seeing exception happen when attempting retrieve mock so: it should_store_the_receipt = () => getmock<ifileservice>().verify(f => f.savefileasync(moq.it.isany<byte[]>(), moq.it.isany<string>()), times.once()); here's exception: system.objectdisposedexceptioninstances cannot resolved , nested lifetimes cannot created lifetimescope has been disposed. i'm guessing has way mspec

ios - Get GMSAddress from GMSPlace placeID -

is there way gsmaddress placeid. interested in getting address using placeid obtained autocompletequery method. p.s: have placeid , finding way corresponding gmsaddress in ios. i found thread here not help. thanks, after autocomplete, place up, pass coordinates gmsgeocoder retrieve details, still missing street_name , street_number. cllocationcoordinate2d addresscoordinates = cllocationcoordinate2dmake(latitude,longitude); gmsgeocoder* coder = [[gmsgeocoder alloc] init]; [coder reversegeocodecoordinate:addresscoordinates completionhandler:^(gmsreversegeocoderesponse *results, nserror *error) { if (error) { nslog(@"error %@", error.description); } else { gmsaddress* address = [results firstresult]; nslog(@"thoroughfare %@",address.thoroughfare); nslog(@"locality %@",address.locality); nslog(@"sublocality %@",address.sublocality); nslog(@"administrativearea %@

objective c - Navigate in uiviewcontroller iOS -

Image
i have problem in memory management, when navigate specific uiviewcontroller example: i have 3 uiviewcontroller , use storyboard modal segue , stay in first , need go number 3 directly i use code works fine, when need return 1 , if repeat code. receive memory warning , crash later. this code: go view 3 -> uistoryboard *storybord = [uistoryboard storyboardwithname:@"main" bundle:nil]; uiviewcontroller * viewtree = [storybord instantiateviewcontrollerwithidentifier:@"three"]; [self presentviewcontroller:viewtree animated:yes completion:nil]; go view 1 -> uistoryboard *storybord = [uistoryboard storyboardwithname:@"main" bundle:nil]; uiviewcontroller * viewone = [storybord instantiateviewcontrollerwithidentifier:@"one"]; [self presentviewcontroller:viewone animated:yes completion:nil]; you must presenting each view controller on each other, raising memory warning issue. present viewcontrollerthree use following

django database models with one field common -

Image
i struggling define django models can achieve following functionality per picture below: basically, i want able create new projects (so, create model: class projectlist). i want assign generic list of stages each project create model: class stagelist. stage list contains list of stages names same each project. stages should contain integer values average values of area fields. so, want create list of areas , create model: class arealist. arealist may different every project. the important think end user wants see is: a value of stage 1 (which average) project 1. stage 1 average of example area 1, area 2 in project 1. stage 2 avg of area 1, area 2 in project 2 etc. i thought doing relation arealist below: area_num = models.foreignkey(stagelist, related_name='area_items') i realized not way because relates specific stage in stage list want have few different area values different stages. how can ? what believe you're looking followin

ModelMapper Provider ignored on first level properties of a mapping -

i have used provider in modelmapper transformation i've stumbled upon weird situation. i've noticed provider being considered objects beyond "first level" of transformation, eg.: have 2 hierarchies: 1st) tipoconsultarprocessoresposta, tipoprocessojudicial , tipodocumento 2nd) consultarprocessoresposta, processojudicial , documento tipoconsultarprocessoresposta has tipoprocessojudicial in turn has list of tipodocumento, 2nd hierarchy ressembles first. converting first hierarchy second , provider working fine tipodocumento documento conversion being ignored conversion of tipoprocessojudicial processojudicial. here relevant part of code: modelmapper = new modelmapper(); modelmapper.getconfiguration().setmatchingstrategy(strict); modelmapper.addmappings(new documentopropertymap()).setprovider(documentoprovider); modelmapper.addmappings(new processojudicialpropertymap()).setprovider(processojudicialprovider); consultarprocessoresposta resposta

r - Different Valuse Returned from Using PCA Function -

can explain me how these different? #first type of pca. scales , transposes manually pr.data <- prcomp(scale(t(data))) #second type of pca pr.data <- prcomp(data, retx=true, scale=true) is 1 transposed (the first one) , second 1 not transposed? i think t(data) affect data because switch positions of "samples vs. features" "features vs. samples." transposing matrix "flip" analysis.

php - UTF-8 all the way through -

i'm setting new server, , want support utf-8 in web application. have tried in past on existing servers , seem end having fall iso-8859-1. where need set encoding/charsets? i'm aware need configure apache, mysql , php - there standard checklist can follow, or perhaps troubleshoot mismatches occur? this new linux server, running mysql 5, php 5 , apache 2. data storage : specify utf8mb4 character set on tables , text columns in database. makes mysql physically store , retrieve values encoded natively in utf-8. note mysql implicitly use utf8mb4 encoding if utf8mb4_* collation specified (without explicit character set). in older versions of mysql (< 5.5.3), you'll unfortunately forced use utf8 , supports subset of unicode characters. wish kidding. data access : in application code (e.g. php), in whatever db access method use, you'll need set connection charset utf8mb4 . way, mysql no conversion native utf-8 when hands data off applicati

javascript - Dynamic background color in Bootstrap Carousel with AngularJS -

i have strange behaviorin bootstrap carousel using angularjs. below html code trying dynamically add background color each thumbnail. observe following: initially, "active" part of carousel adds background color dynamically each thumbnail expected. however, once start rotating carousel, thumbnails lose background color. now, when reload page, thumbnails background color again. so cannot understand causing loss of background color during rotation? thanks. <div class="well"> <div id="mycarousel" class="carousel slide"> <!-- carousel items --> <div class="carousel-inner"> <div ng-repeat="imgset in imgsets" ng-class="{item: true, active : $first}"> <div ng-class="row"> <div ng-repeat="img in imgset track img.id" class="col-sm-3">

python - Why is the result of string.format() a string, even for numbers? -

the following evaluates true: '{:.2f}'.format(2.0) > '{:.2f}'.format(10.0) i want write number excel 2 decimals (2 2.00) using dataframe.to_excel , gets displayed text instead of number in cell. update: import pandas pd data_table = [[1.0,2.0,3.0],[4.0,5.0,6.0]] dataframe = pd.dataframe(data_table) writer = pd.excelwriter(filename, engine='xlsxwriter') dataframe.to_excel(writer,float_format='%11.2f', index=false) writer.save() it still shows 6 instead of 6.00. maybe excel strips 0 when open it 1 2 3 4 5 6 to_excel has float_format option.

components - How to Two-way Data Binding Between Parents and grandchildren in Vue.js -

i faced problem, solve cookies want solve problem without cookies. have component called app-header , has component called outmodal. now, first vue instance require component app-header. var vue = new vue({ el : "html", data : { title : "site title", description : "description of page", keywords : "my keywords", view : "home", login : "login" }, components:{ "app-header" :require("../../components/header"), "app-footer" :require("../../components/footer"), "home" :require("../../views/home") }, }); code of app-header var vue = require("vue"); vue.partial("login",require("../../partials/login.html")); vue.partial("logged",require("../../partials/logged.html")); module.exports = { template

hadoop - Apache hive MSCK REPAIR TABLE new partition not added -

i new apache hive. while working on external table partition, if add new partition directly hdfs, new partition not added after running msck repair table. below codes tried, -- creating external table hive> create external table factory(name string, empid int, age int) partitioned by(region string) > row format delimited fields terminated ','; --detailed table information location: hdfs://localhost.localdomain:8020/user/hive/warehouse/factory table type: external_table table parameters: external true transient_lastddltime 1438579844 -- creating directory in hdfs load data table factory [cloudera@localhost ~]$ hadoop fs -mkdir 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory1' [cloudera@localhost ~]$ hadoop fs -mkdir 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory2' -- table data ca

Segmentation Error In Objective C -

i trying write program nsdate in ubuntu (as don't have mac using ubuntu run objective c programs). while compiling program getting error "segmentation fault (core dumped)". below code #import <foundation/foundation.h> #import <objc/objc.h> #import <objc/object.h> int main() { nsautoreleasepool * pool=[[nsautoreleasepool alloc] init]; nsdate *now = [nsdate date]; nslog(@"now %@", now); nstimeinterval secondsinaweek = 7 * 24 * 60 * 60; nslog(@"secondsinaweek %@", secondsinaweek); nsdate *lastweek = [nsdate datewithtimeinterval: secondsinaweek sincedate:now]; nslog(@"last week %@", lastweek); nsdate *nextweek = [nsdate datewithtimeinterval: secondsinaweek sincedate:now]; nslog(@"next week %@", nextweek); [pool drain]; return 0; } please me find error. able output nsdate *now, after getting segmentation error. ask me if need more info regarding code

The android emulator is out of view, how to set position center of window? -

Image
i know question old, , ask many times on stackoverflow soltutions not working me , using window 8.1 pro i have used following links: the android emulator out of view, how can move it? emulator: emulator window out of view , recentered i tried change screen resolution of screen, alt + space , move didn't work can see in image no title bar display, i have tried edit c:/users/username/.android/avd/emulatorname.ini file following code window.x = 0 window.y = 0 didn't work i appreciate answer if resolve issue ! the issue resolved using following procedure alt + space -> move : move screen using arrows (left, right, up, down) instead of cursor/pointing device

java - ERROR - ListenerManager Couldn't initialize the httpstransport listener - WSO2 -

i started fresh copy of wso2 api manager 1.8 , below error no reason. error - listenermanager couldn't initialize httpstransport listener how can fix this? check system hostname running following command $ hostname try ping output hostname. $ ping <output of hostname command> if gives error check /etc/hosts file. @ least should have host entry 127.0.0.1 127.0.0.1 <hostname> or <local ip> <hostname>

c++ - Wrap getter and setter with "operator[]" -

many libraries provide getter , setters access , modify there processed variables. 1 of libraries boost propertytree . want wrap getter , setter in boost::property_tree::ptree operator[] . source: class xmldocument { boost::property_tree::ptree ptree_; public: xmldocument(const std::string &content) { std::stringstream ss; boost::property_tree::read_xml(ss << content, ptree_); } template <typename t> t &operator[](const std::string &path) { /* todo */ } } int main() { xmldocument xml("<foo>bar</foo><baz>qux</baz>"); std::cout << xml["foo"] << std::endl; // access element. xml["baz"] = "quux"; // modify element. std::cout << xml["baz"] << std::endl; } output: bar quux how can do?

Passing compiler flags via make argument rather than Makefile -

is possible add compiler flags compiler calls (all .cpp files) via make argument rather makefile? if possible, how? yes, possible. can pass make operand of form variable=value defines make variable variable have value , overriding content of variable defined in makefile. consult documentation of make implementation more details. notice may work differently when using := assignment in gnu make.

matlab - error while masking an image -

i want threshold before applying algorithm.i tried in 1 algorithm , got perfect result.but here considered binary image , masking.i want intervertebral disc(ellipse portion) in between vertebrae .can suggest other method? close all; clear all; %% img = imread('sub.png'); img=rgb2gray(img);%convert single channel data not contain color image img=im2bw(img,.16); fig1=figure; subplot(221) imshow(img); title('original image') m1 = uint8(img>35); subplot(222), imshow(m1,[]); title('mask m1'); m2=uint8(img<300); subplot(223), imshow(m2,[]); title('mask m2'); sd = stdfilt( double(img), ones(3,3)); m3= uint8(sd<18); subplot(224), imshow(m3,[]); title('mask m3'); fig2=figure; = uint8(img.* m1); = uint8(i.* m2); = uint8(i.* m3); subplot(221), imshow(i); title('masked img') i'm getting error as i cannot view mask1 , mask 2, mask3 , i'm

locking - How to find out table lock or row lock in Sybase -

i have stored procedure in sybase, it's called java code on row row insertion, how find out whether sp locking table or locking row? check underlying table properties or sp itself? create procedure dbo.sp1 (@id_code varchar(10), @position_id numeric(10,0) output ) begin begin transaction insert abc..table1( id_code, position_id ) values ( @id_code @position_id ) commit select @position_id = @@identity end go exec sp_procxmode 'dbo.sp1', 'unchained' go if object_id('dbo.sp1') not null print '<<< created procedure dbo.sp1 >>>' else print '<<< failed creating procedure dbo.sp1 >>>' the lock scheme table can determined using lockscheme() built in command. lockscheme('tablename') you can specify obj_id , dbid . ase 16 documentation: lockscheme

sorting - sortedResultsUsingProperty realm iOS -

in ios realm has ability return sorted rlmresults database. sortedresultsusingproperty(..) is possible 'not return anything, , sort locally saved database ? realm not have way sort of objects in place, doesn't make guarantees order objects stored in underlying database (which allows better performance). of time, however, sorting rlmresults going fast enough it's not concern.

c# - Create new database or use the existing ASP.NET Identity database? -

i have been teaching myself asp.net mvc5 development , have problem determining best practice in situation. i using asp.net identity system created database me. want add more tables , things it. should create new database or should add existing database? best practice in situation? try using same database rather creating new database each new table. 1 database can have many tables need have.

Using subprocess to execute a linux command in python and then grab the resulting prompt -

i using subprocces.popen() run linux commands in python. trying use command ssh different machine, , see whether prompts me password. however, have no idea how grab resulting prompt , use in python script. for example, if use subprocess.popen() call command "echo hello world" can use communicate() method grab resulting stdout running command. but here trying do: use popen() run: ssh -hostname- 'echo hello' , grab result of use within python script. if ssh runs prompt password, want able have output of prompt in python script use string. finally, want able exit out of prompt (equivalent of typing ^c when using linux terminal). however, when using popen() , communicate(), shows prompt on actual linux stdout , doesn't grab prompt. i hoping suppress prompt ever showing on actual linux terminal stdout. here code have been using (this code works when grabbing normal stdout): p = subprocess.popen(["ssh", hostname, "echo hello"], stdou

How to add "like" button to html blog page? -

Image
how add simple button not associated facebook? have searched online, of instructions facebook likes. think should simple, amateur html. please help. thanks. button this: thanks lot! you should read this: http://www.w3schools.com/tags/tag_button.asp helps understand how add buttons html , if want keep trace on amount of likes gets add code , variables can read here: html displaying text using variable think need make button add +1 variable , variable 1 displaying amount of likes. hope helps. should end having : jsfiddle.net/ydhtq/64

android - starting a service at boot time taking too much time,why? -

i'm trying build app starts service displays view. trying display view after boot takes time(>1min) start service. broadcastreceiver: @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_screen_off)) { intent intentservice = new intent(context,newservice.class); try{ context.startservice(intentservice); } catch(exception e){ e.printstacktrace(); } } else if (intent.getaction().equals(intent.action_screen_on)) { intent intent11 = new intent(context,mainactivity.class); intent11.addflags(intent.flag_activity_new_task); } else if(intent.getaction().equals(intent.action_boot_completed)) { context.startservice(new intent(context,newservice.class)); } manifest: <uses-permission android:name="android.permission.receive_boot_completed"/> <service android:name="com.example.p.newservice&q

Should I pause my thread or not Android -

so have thread checks every 10ms's if drag outside draggingzone. basicly thread code doing nothing 99% of time should make pause , resume when needed? or literally nothing when right , left false? my code looks this timer = new thread() { //new thread public void run() { b = true; try { { sleep(10); runonuithread(new runnable() { @override public void run() { if (right) { dragzone.moveleft(-5); } else if (left) { dragzone.moveleft(5); } } }); } while (b); } catch (interruptedexception e) { } } ; }; timer.start(); it looks using thread here not necessary, , shoul

c# - Change layout size depends on Screen size -

i'm new in android programming. wrote small app. when launched on 4.7" screen device looks small. how can make autoscaling different sizes of screen? my xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:weightsum="100" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minwidth="25px" android:minheight="25px"> <framelayout android:layout_width="wrap_content" android:layout_height="267.9dp" android:weight="100" android:id="@+id/framelayout1"> <imageview android:src="@drawable/fone" android:layout_width="match_parent" android:layout_height="ma