Posts

Showing posts from February, 2012

Renewing SSL certificate Service Fabric endpoint -

how can renew certificate on service fabric https endpoint after expires? i use port sharing multi-domain support ( weblistener ) , netsh bind cert ip:port (i can't use manifest file bind domain name, not supported now). but if don't want upload new package version (only run setupentrypoint ) there way send netsh command vm scale sets? if want run same command, netsh, on vms in scale set, way use custom script extension. can add custom script extension using powershell cmdlet add-azurermvmssextension.

Nested linked lists in C -

i'm trying implement nested linked list in c, used hierarchical menu. however, gcc (v4.9.3-1) complaining nested structures, , have no idea how fix this. here minimum (non)working example. is nesting possible in c? main.c #include "menu.h" int main(void) { init_menu(); return 0; } menu.c #include "menu.h" menuitem_t lvl_0_mainmenu = { .size = 0, }; menuitem_t lvl_1_measurements = { .size = 0, }; void init_menu(void) { menu_add_child(&lvl_0_mainmenu, &lvl_1_measurements); } void menu_add_child(menuitem_t *parent, menuitem_t *child) { parent->children[parent->size] = child; child->parent = parent; parent->size++; } menu.h typedef struct { unsigned char size; menuitem_t children[10]; menuitem_t *parent; } menuitem_t; extern menuitem_t lvl_0_mainmenu; extern menuitem_t lvl_1_measurements; void init_menu(void); void menu_add_child(menuitem_t *parent, menuitem_t *child); based

javascript - Changing the background-image -

could tell me have change here able change background-image via javascript? $(document).ready(function(){ $('p').css('background-image', 'url("misc/bilder/2.png")'); }); .p { height: 100%; width: 100%; position: relative; padding: 25%; background-size: cover; background-attachment: fixed; -webkit-transition: 0.2s ease; -moz-transition: 0.2s ease; transition: 0.2s ease; background-image: url("misc/bilder/1.png"); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <p> text </p> thanks! in css you're referencing .p class in javascript you're referencing p element. might help: $(document).ready(function(){ $('.p').css('background-image', 'url("misc/bilder/2.png")'); }); updated: question updated after answer. remove . .p in

firebase - Updating Android UI when database changes -

my android app uses volley http communication web service built django rest framework. backend consists of mysql database , python. the app consist of multiple users updating same page. page update close real time. when there update database (via web service) push updates connected clients. prefer push data clients instead of polling server. what recommended approach syncing database android ui? here of options have come across: android sync adapter firebase cloud messaging (if go route need migrate database?) pubnub is there way accomplish volley? i suggest use pubnub of realtime data management , use either broadcast receivers, eventbus or otto fire events listen locally. let me explain bit more. in database, when there successful crud operation, can publish pubnub server. in turn fire off clients subscribers. in application, can have android service running , listen , process pub nub events being received. @ point, can fire local events within appl

java - How to co-group 5 RDDs or More -

how cogroup 5 rdds javapairrdd<string ,ontologies1> ontologiespair javapairrdd<string ,instagram> inpair javapairrdd<string, pinterest> pintpair javapairrdd<string, twitter> tweetpair javapairrdd<string, klout> kloutpair i need cogroup javapairrdd<string, tuple5<iterable<ontologies1>, iterable<instagram>, iterable<pinterest> ,iterable<klout>,iterable<twitter>>> comb1 = ontologiespair.cogroup(inpair,pintpair,kloutpair,tweetpair); how achieve this.

java - Printing good characters into bad characters unknown characters -

Image
pdf files contain french accent characters such as: e tick markt on top of them same u or so. when check pdf files before printing, can see absolutely correct, can read them in pdf, can zoom in , copy them fine. but moment java touch , prints it. not work suppose be. how can fix please? cloud version of pdf perfect once following code use handle file, characters become broken in print copy. import java.awt.print.printerexception; import java.awt.print.printerjob; import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.net.url; import javax.print.docprintjob; import javax.print.printservice; import javax.print.attribute.hashprintrequestattributeset; import javax.print.attribute.printrequestattributeset; import javax.print.attribute.standard.mediatray; import org.apache.pdfbox.pdmodel.pddocument; import org.apache.pdfbox.printing.pdfpageable; public class printa4 { public static boolean savefile(url url,

javascript - why sleep in nodejs doesn't work as expected -

i use library sleep inside loop, loop this while(condition){ usleep(1) while(condition){ usleep(1) // ... stuff (sync) } } althought i'm sleeping 1us, loop never terminate take very long time, when remove sleep statement, run , done. i'm trying sleep make cpu calms down , not use 100% server keep accepting other requests! using settimeout inside loop not idea, because settimeout async. i thought using recursion, i'm afraid slow, i'm iterating arount 100000 sleep blocks current thread, not try accept other requests. can try sleep-async job.

sql server - How does SQL decide to add new data page -

Image
i trying understand how sql allots new data pages when insert new records table. i have create sample table called employee in fresh database - create database testdb go use testdb go create table employee ( employeename char(1000)) go insert employee values ('employee1') dbcc ind('testdb','dbo.employee',-1) after running dbcc, saw 2 pages. 1 iam page (pagetype =10 ) , other data page (pagetype = 1) holds actual data. later verified actual content of data page using dbcc page dbcc traceon(3604) dbcc page('testdb',1,298,3) i saw how sql calculated m_freecnt bytes count - = 1007 bytes recordsize + 96 bytes header + 2 bytes offset = 1105 bytes i.e. 8k page = 8192 bytes = 8192 - 1105 = 7087 bytes free. now go on adding records table in order understand how many records page accommodate , when sql allot new page keeping m_freecnt in mind. (record size = 1007 & offset bytes = 2 ) added 2nd record - insert employee v

android - How do I attach the specific app to Selendroid test suite? -

how 1 attach specific app tested selendroid ? i've seen example test app displayed virtually everywhere, well, have place apk under test? tried use id of app this: selendroidconfiguration config = new selendroidconfiguration(); config.addsupportedapp("io.selendroid.testapp:0.17.0"); selendroidlauncher selendroidserver = new selendroidlauncher(config); selendroidserver.launchselendroid(); desiredcapabilities caps = io.selendroid.common.selendroidcapabilities.android(); selendroidcapabilities cap = new selendroidcapabilities("io.selendroid.testapp:0.17.0"); but keep receiving errors: sessionnotcreatedexception . causing this? how attach specific app java project tests? seems issue caused not giving correct path apk. here should give path apk, giving package name of app config.addsupportedapp("io.selendroid.testapp:0.17.0"); the fix then config.addsupportedapp("c:/users/madis/documents/selend

sql - How to create a trigger which, update a row in the same table after insert? -

for example, have table t_1 , insert id value, trigger should after insert, update value id_2 , set id_2 id : create table t_1( id number(10), id_1 number(10) ); i create trigger: create or replace trigger id_to_id_2 after insert on t_1 each row begin update t_1 set id_2=:new.id id = new.id; end; / but when try insert, error: db constraint error: ora-04091: table t_1is mutating, trigger/function may not see it\nora-06512: @ i don't understand error, explain me doing wrong? you need before insert trigger this: create or replace trigger id_to_id_2 before insert on t_1 each row begin :new.id_2 := :new.id; end;

python - Access Jupyter notebook running on Docker container -

i created docker image python libraries , jupyter. start container option -p 8888:8888 , link ports between host , container. when launch jupyter kernel inside container, running on localhost:8888 (and not find browser). used command jupyter notebook but host, ip address have use work jupyter in host's browser ? with command ifconfig , find eth0 , docker , wlan0 , lo ... thanks ! you need run notebook on 0.0.0.0 : jupyter notebook -i 0.0.0.0 . running on localhost make available inside container.

BotFramework Avoid Confirmation in FormFlow -

i want bypass last confirmation step in formflow defined this new formbuilder<wizardresult>() .confirm("no verification shown", state => false) .message("form test") .oncompletion(processorder) .build(); according post done handler in confirm, in case confirmation still asked... what missing? it version 3.3.1.0 need call .addremainingfields() in formbuilder avoid confirmation. state=> false not required more.

how to retrive more than 1000 rows in azure tables php -

i trying more 1000 rows azure in php. first of not able use filter class. namespace need added use filter class after while loop gng in infinite loop help $tablerestproxy = servicesbuilder::getinstance()->createtableservice($this->connectionstring); $filter = "( partitionkey eq '$id' )"; $options = new queryentitiesoptions(); $options->setfilter(filter::applyquerystring($filter)); $result = $tablerestproxy->queryentities('test', $options); $entities = $result->getentities(); $nextpartitionkey = $result->getnextpartitionkey(); $nextrowkey = $result->getnextrowkey(); while (!is_null($nextrowkey) && !is_null($nextpartitionkey) ) { $options = new queryentitiesoptions(); $options->setnextpartitionkey($nextpartitionkey); $options->setnextrowkey($nextrowkey); $options->setfilter(filter::applyquerystring($filter)); $result2 = $tablerestproxy->queryentities("test", $options); $n

Android not able to scroll up -

i have login layout 2 edittext , button . when i'm typing text in edittext , keyboard open overlap of layout . try scroll not able scroll layout visible. I'm using relative layout create it. how solve it? thank you. place edittext s , button inside scrollview . whatever inside scrollview can scrolled. problem solved. note scrollview can host 1 child. have place view s inside viewgroup linearlayout or relativelayout although julia zhao's answer correct, uses relativelayout . if use relativelayout have more work make view s appear 1 below other. suggest use linearlayout android:orientation="vertical" inside it. automatically place 1 view below other without effort. won't issues 1 view overlapping on other. <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height

xamarin - Android - NullReferenceException on Scroll/Drag-and-Drop (setDragFocus) -

i'm working on android app using xamarin.android (c#). i have developed drag-and-drop autoscroll listview, seen in gist . it works amazingly well, sometimes, sometimes, crashes , leaves no clue why. exception thrown "in unmanaged code" , useful information debugger shows stacktrace: --- end of managed java.lang.nullpointerexception stack trace --- java.lang.nullpointerexception: attempt invoke virtual method 'void android.view.viewrootimpl.setdragfocus(android.view.view)' on null object reference @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1454) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.j

php - Magento/Adminhtml - Receiving error while trying to search for custom column in products grid -

Image
this adminhtml products grid.php: class mage_adminhtml_block_catalog_product_grid extends mage_adminhtml_block_widget_grid { public function __construct() { parent::__construct(); $this->setid('productgrid'); $this->setdefaultsort('entity_id'); $this->setdefaultdir('desc'); $this->setsaveparametersinsession(true); $this->setuseajax(true); $this->setvarnamefilter('product_filter'); } protected function _getstore() { $storeid = (int) $this->getrequest()->getparam('store', 0); return mage::app()->getstore($storeid); } protected function _preparecollection() { $store = $this->_getstore(); $collection = mage::getmodel('catalog/product')->getcollection() ->addattributetoselect('sku') ->addattributetoselect('name') ->addattri

sql server - grant read access on a view but not on it's underlying tables from other databases -

i want grant read permissions user view joins 2 tables database. i don't want to: give him permission on database tables or add him user there. make him owner of view/schema due security exploits. i don't want create first table, or variations of hack table truncate , stored procedure inserts data on trigger. can done somehow? maybe there's missed , guys might know. i have read these posts didn't solve problem: grant select permission on view, not on underlying objects grant select on view not base table when base table in different database https://msdn.microsoft.com/en-us/library/ms188676.aspx https://dba.stackexchange.com/questions/89632/sql-server-grant-select-access-to-a-user-in-a-view-and-not-in-its-tables thank you edit: easiest solution came with, after research, activating cross database ownership chaining option on database i'm placing views , granting read permission users. might in contrast 2nd point of things i'm trying av

can i host asp.net web site in linux server? -

Image
how can host asp.net website in linux server.. hosting asp.net website in linux server gives code error. can see screen short better understand. . you can host site in 2 ways: you use asp.net mono. you use asp.net core. the second way preferred each of them unstable , don't suitable production. use asp.net windows server iis.

java - Getting all logs of different class in one file -

i trying logs of different class in 1 file. using log4j2 , properties file configuration.my configuration file below. here test class , impl class implementation class contains code.please help. problem is not showing logs test class.it showing logs impl class. name=propertiesconfig property.filename = logs appenders = console, file appender.console.type = console appender.console.name = stdout appender.console.layout.type = patternlayout appender.console.layout.pattern = [%-5level] %d{yyyy-mm-dd hh:mm:ss.sss} [%t] %c{1} - %msg%n appender.file.type = file appender.file.name = logfile appender.file.filename=${filename}/propertieslogs.log appender.file.layout.type=patternlayout appender.file.layout.pattern=[%-5level] %d{yyyy-mm-dd hh:mm:ss.sss}[%t]%c{1}-%msg%n loggers=file logger.file.name=com.package.metadata.test logger.file.name=com.package.metadataservice.impl logger.file.level = debug logger.file.appenderrefs = file logger.file.appenderref.file.ref = logfile rootlogger.

java - What is going on with my Android Navigation drawer activity? -

i building opengl live wallpaper. decided have navigation drawer in main activity since there lot of features user have access to. the problem/issue if press "hardware" button close app initial fragment shown refreshes , app never closes. if hit home button , go app black screen. i've searched throughout google thinking maybe wasn't destroying mainactivity or way terminate fragment. i've tried calling finish() in main activity's ondestroy method. i've tried utilizing remove method fragment manager in each fragments ondetach method per posts i've found online. nothing has worked. i'm stumped. i've set debug points in main activity on ondestroy method , on fragments ondetach method no error being produced or information being given. @ point clueless. here's mainactivity class. public class mainactivity extends appcompatactivity implements onnavigationitemselectedlistener, onpostselectedlistener{ fragmentmanager mfragmentmana

Making a horizontal progress bar using image xamarin android -

Image
how can change progress bar picture? want want take horizontal length. i want result http://www.bellaterreno.com/graphics/biz_processingbar/processingbar_blue_diagonal_sm_ani.gif you can set custom progress bar creating additional xml in resource > drawable folder. create progressbar.xml file , customize own style. should looks similar this: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- define background properties: colors, gradient, etc --> <item android:id="@android:id/background"> <shape> <gradient android:startcolor="#000001" android:centercolor="#0b131e" android:centery="1.0" android:endcolor="#0d1522" android:angle="270" /> </shape> </item> <

jquery - Select children under the css pseudo class selector -

i'm using bootstrap tabs, both directly under <body> , , inside .modal . need select tabs not inside .modal via css . doesn't work: var act = $("div:not(.modal) ul.nav li"; intead of disregarding .modal contents, selects tabs inside .modal s. known limitation, achievable? there workaround this? <body> <div> ... <!-- more nested on actual code--> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"> <a href="#" data-toggle="tab">tab 1</a> </li> <li role="presentation"> <a href="#" data-toggle="tab">tab 2</a> </li> </ul> </div> ... <div class="modal fade lookup" id="search-adjustment-report-header-modal"&g

python - Starting Celery worker in windows -

i'm trying start celery worker in windows 7 following command celery worker -a routes.celery --loglevel=info result of above command c:\users\xxxxx\appdata\local\continuum\anaconda2\python.exe: can't open file 'c:\users\xxxxx\appdata\local\continuum\anaconda2\scripts\celery': [errno 2] no such file or directory is command "celery" designed unix-like system? if how start celery worker python script instead of command line.

angular - Access whole DOM in Angularl2 RC -

in angular 2 application need check whether or not chrome extension installed. google recommends here check dom element added extension. i'm implementing extension it's no problem add element when extension loads. but i'm struggling angular side. have service handles logic extension (install etc.), , implement check there well. unfortunately not figure out how access whole dom. there injectable class elementref property nativeelement , gives me access dom element belongs component. since element added extension direct child of body not work here. does how access whole dom in angular 2 compliant way? edit please check link provided tschuege if tempted used solution below. import renderer: import {renderer} '@angular/core'; inject it: constructor(private renderer: renderer) then element reference issuing: renderer.selectrootelement(<elementid>)

typescript - How to change TimePicker in NativeScript to show the time in 24-hour format? -

in nativescript, there timepicker, 1 shows time, in 12-hour format. have problem, because in database of times saved in string (in format "23:59"). i canot set hour, e.g. 14. i have idea, convert string split(':') , changing period pm, cannot see usefull method that. please, help. you can use native apis set 24-hour format. timepicker in nativescript using uidatepicker in ios , android.widget.timepicker in android page.js "use strict"; var application = require("application"); function onloaded(args) { var page = args.object; var tpicker = page.getviewbyid("tpicker"); if (application.android) { tpicker.android.setis24hourview(java.lang.boolean.true); tpicker.hour = 23; tpicker.minute = 59; } else if (application.ios) { // bit hacky solution // important set country not language locale var local

javascript - How to set the title of the entry that the browser displays for history.pushState? -

i use history.pushstate( stateobject, title, url ) push new entries history stack of browser. despite name second parameter title not set title of entry displayed in browser's history. if understand correctly title reserved future use , ignored browsers. should safe pass '' here , findings support this. hence, wonder how set label user see in history , thought document.title job. code looks this var mytitle = /* code generate title here */ var myurl = /* code generate url here */ var mystate = /* code generate realizable state object here */ document.title = mytitle; history.pushstate( mystate, '', myurl ); // 2nd parameter can mytitle; has no effect on major browsers however, not work expected. more precisely encounter strange off-by-one error. seems pushstate not create new history entry using new document.title previous title. guess problem dom not updated after js leaves current call stack. document.title = mytitle becomes effective after

scroll - jQuery & animate.css for scrollReveal -

Image
i have been trying create reveal on scroll effect, have tried multiple plugins can't seem find of them fit i'm looking , if im not sure on how implement want do. i have got piece of javascript code have been playing around with; $(document).ready(function(){ $(window).scroll(function(){ $('.hideme').each(function(i){ var bottom_of_object = $(this).offset().top + $(this).outerheight(); var bottom_of_window = $(window).scrolltop(); + $(window).height(); if(bottom_of_window > bottom_of_object){ $(this).addclass('animated fadeinup', 1000); } }); }); }); the problem animation added once it's off screen have scroll past animation take effect work. i'm not sure on how make js implement animate.css code element in view of window/browser. also thing have been trying remove class jquery (removeclass) method, hides , show

Use apollo stack with meteor -

i'm trying use apollp stack meteor project. used meteor add apollo meteor npm install --save apollo-client apollo-server express to install apollo stack when execute meteor run project gives errors /home/xxxxxx/example/crud/.meteor/local/build/programs/server/packages/modules.js:97872 const graphql_1 = require('graphql'); ^^^^^ syntaxerror: use of const in strict mode. at/home/xxxxxx/example/crud/.meteor/local/build/programs/server/boot.js:292:30 @ array.foreach (native) @ function._.each._.foreach (/home/xxxxxxx/.meteor/packages/meteor-tool/.1.3.4_1.1wjluqr++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11) any ideas happened here ?? i'm trying same thing. think can next step. add couple of things npm install: meteor npm install --save apollo-client apollo-server@^0.1.1 express graphql i've put in pr add graphql npm install in docs. also, apollo-server has updat

scrapy InitSpider: set Rules in __init__? -

i building recursive webspider optional login. want make settings dynamic via json config file. in __init__ function, reading file , try populate variables, however, not work rules . class crawlpyspider(initspider): ... #---------------------------------------------------------------------- def __init__(self, *args, **kwargs): """constructor: overwrite parent __init__ function""" # call parent init super(crawlpyspider, self).__init__(*args, **kwargs) # command line arg provided configuration param config_file = kwargs.get('config') # validate configuration file parameter if not config_file: logging.error('missing argument "-a config"') logging.error('usage: scrapy crawl crawlpy -a config=/path/to/config.json') self.abort = true # check if file elif not os.path.isfile(config_file): logging.error('specified config file not exist')

elixir - How to duplicate records for Ecto? -

i have couple of ecto records. want duplicate them (make them 100 times bigger) play big amount of records. how can via ecto mechanisms? you can replicate dup removing id key record: for n <- (0..10), do: user |> repo.get(record_id) |> map.delete(:id) |> repo.insert although won't work if have unique keys... leave needing populate struct yourself: def spawn_records(line_numbers) line <- line_numbers %user{first_name: "tyrone", last_name: "shoelaces#{line}"} |> repo.insert end end if you're thinking of second answer i'd echo dogbert , recommend using ex_machina in dev.

xamarin - Enable Calabash-sandbox in Shell Script -

i trying access calabash-sandbox running shell script. shell script has #!/bin/sh calabash-sandbox calabash-android --- which should run calabash-sandbox , respective commands. executes calabash-sandbox , stops there. i took @ script calabash-sandbox runs, , seems creates new bash session, complete environment variables calabash need. so, equivalent if ran bash && echo 'test' in script - wont see echo 'test' part, until exit session. but, there multitude of ways push commands new shell sessions, , 1 in particular seems work case. bash reference manual bash includes ‘<<<’ redirection operator, allowing string used standard input command. this means can this: calabash-sandbox <<< 'echo test' , open new special calabash session, execute command in string, , exit session. $ calabash-sandbox <<< 'echo test' terminal ready use calabash. exit, type 'exit'. test terminal normal. if

java - Why I'm getting error response from server when trying to upload file using HttpURLConnection -

i'm trying upload file server(not mine) think did needs please can correct me if doing wrong here api post https://i cant share url http/1.1 content-type: multipart/form-data; boundary=----------------------------8d19a412e59ea7e user-agent: mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/36.0.1985.143 safari/537.36 content-length: 567460 expect: 100-continue connection: keep-alive ------------------------------8d19a412e59ea7e content-disposition: form-data; name="filename"; filename="report.xml" content-type: application/xml my request private string uploadfile(string sourcefile,url) throws clientprotocolexception, ioexception { fileinputstream fileinputstream = new fileinputstream(sourcefile); httpurlconnection conn; dataoutputstream dos = null; string lineend = "\r\n"; string twohyphens = "--"; string boundary = "--------------------------8d19a412e59ea7e"; int

Rails setups postgresql database without primary key -

i messed around bit database , because screwed things figured start scratch , setup postgresql database again. rake db:setup rake db:migrate however, got kinds of errors in app. when comparing pg_dump of broken database working 1 still have on heroku, can see biggest differences of id columns don't defined primary key on local database (so not null part missing when defining id column on local database). , there no sequences made these id's on local database comparing schema.rb on local machine , heroku see difference on local machine column id defined these tables , on heroku not. example on local machine get create_table "pictures", id: false, force: :cascade |t| t.integer "id", limit: 8 t.datetime "created_at" t.datetime "updated_at" t.text "image" t.text "image_content_type" t.integer "image_file_size", limit: 8 t.datetime &quo

selenium - Rails capybara cookies issue -

how work cookies inside capybara? in application_helper.rb have method cookies def user_currency(currency) cookies[:user_currency] = currency end but when want use method in test it returns me undefined local variable or method `cookies' #<rspec::examplegroups how handle it? cookie manipulation different each capybara driver. easiest solution use show_me_the_cookies gem provides unified api. note drivers can set cookies domains visiting.

xml - Recursion and TreeNode xslt -

i newly introdused xslt, doing kind of small tasks familiarise myself xslt. stuck in problem not solve in transforming xml file one. scenario: input xml file contains nodes, each 1 pair of son , father tags indicates name of current node tag , , name of father node tag < father >. trying generate tree of node, first node 1 has no father (i created manually name 0 , level in tree 1), looking nodes have father tag equals (0) first step, in input file (1 , 4), here create new node node (0) holds name (1) , has level in tree equals (2) go , nodes have father tag equals (1) , on, when reach point no more children (1), create node name (4) , has same level in tree node name (1) continue looking nodes have father tag equals (4) , on. have xml: <typedpolling xmlns="http://schemas.microsoft.com/sql/2008/05/typedpolling"> <typedpolling0> <typedpolling0> <son>1</son> <father>0</father> <

.replace javascript not working -

hi working in java script have string var data = 'http://baab.bh/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/t/e/test.jpg'; i want replace /image/ 'image/440x600' using function .replace() but not working here code var data ='http://baab.bh/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/t/e/test.jpg'; data.replace('/image/', '/image/440x600/'); console.log(data); its showing same not replacing /image/ 'image/440x600' . strings in javascript immutable. cannot modified. the replace method returns modified string, doesn't modify original in place. you need capture return value. var data = 'http://baab.bh/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/t/e/test.jpg'; data = data.replace('/image/', '/image/440x600/'); console.log(data);

Passing a C++ pointer between C and Python -

i have python extension module written in c++, contains multiple functions. 1 of these generates instance of custom structure, want use other functions of module in python follows import mymodule var = mymodule.genfunc() mymodule.readfunc(var) to this, i've tried using pycapsule objects pass pointer these objects between python , c, produces errors when attempting read them in second c function ("pycapsule_getpointer called invalid pycapsule object"). python, however, if asked print pycapsule object (var) correctly identifies "'capsule object "testcapsule"'. c code appears follows: struct mystruct { int value; }; static pyobject* genfunc(pyobject* self, pyobject *args) { mystruct var; pyobject *capsuletest; var.value = 1; capsuletest = pycapsule_new(&var, "testcapsule", null); return capsuletest; } static pyobject* readfunc(pyobject* self, pyobject *args) { pycapsule_getpointer(args, "testc

c++ - Design of an xml reader -

i have class xmlreader reads xml , class point represents point. point can have various types, different types described enum inside class point. class xmlreader { void read() { string typereadfromxml; vector<double> coordinates; point* pt = newpoint(typereadfromxml, coordinates); // or //string typereadfromxml; //pointtype type= xmlreader::conversion(typereadfromxml); //vector<double> coordinates; //point* pt = newpoint(type, coordinates); } }; class point { point(string type, vector<double> v) { _type = conversion(type); } point(pointtype type, vector<double> v) { _type = type; } private: enum pointtype { type1, type2 }; pointtype conversion(string){} pointtype _type; vector<double> _coords; }; is ok conversion string custom type in point class or preferable conversion in read method of xm

Python: write decimal number into binary file -

i need replace few bytes in asn1 encoded binary file. because of i'm out of asn1 scope, want replace bytes starting @ position 9 (offset) , of length 9 bytes. i able open file binary write fh = open("emvdata_3839_test.der", "r+b") fh.seek(8) fh.write(bytearray(9)) fh.close() this replace 9 bytes 00 00 00 .... i need convert number e.g. 123456789012345678 \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\x01... can put fh.write() method , replace old values new. split long number single digits, convert them format \xyy , make bytearray ? ( mean format file.write() can handle) please consider in python cannot write basic loop without googling :) thanks much

Access to a static c++ field from objective-c -

i have library in c++ , did modifications want add new static variable. but have same error. ld /users/ricardo/library/developer/xcode/deriveddata/parlamobile-gjgrppzlpeaavrbixticgpbwnurz/build/products/debug-iphoneos/myapp.app/myapp normal arm64 cd /users/ricardo/xcode/mobile-ios export iphoneos_deployment_target=8.0 export path="/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos9.3.sdk -l/users/ricardo/library/developer/xcode/deriveddata/parlamobile-gjgrppzlpeaavrbixticgpbwnurz/build/products/debug-iphoneos -l/users/ricardo/xcode/mobile-ios/parlamobile/vendor/openssl/lib -f/users/ricardo/library/developer/xcod