Posts

Showing posts from April, 2013

python - Finding keys for a value in a dictionary of integers -

the problem write python function returns list of keys in adict value target. keys , values in dictionary integers , keys in list return must in increasing order. this work have far: def keyswithvalue(adict, target): ''' adict: dictionary target: integer ''' ans = [] if target not in adict.values(): return ans else: key in adict.keys(): if target in adict[key]: ans+=[key] return ans.sort() i keep on getting: "typeerror: argument of type 'int' not iterable" but don't understand means, , how fix it. if help, i'd grateful! the issue here if target in adict[key]: you trying iterate on integer value, wont work. you should instead use if target == adict[key]: you can refactor code this. have made assumption input data looks like. if i'm wrong can adjust answer. d = {1:1, 2:2, 3:3, 4:3, 5:3} def keyswithvalue(adict, targe

asp.net mvc 5 - MVC5 Unused model fields are lost between GET and POST -

if respond populating model object initialization data (like current username), , no editor field used in view, when form posts, field nulled out. appears true if use displayfor or lablefor well. example: //changeaccountinfo [authorize] public actionresult changesecurityqa() { changesecurityqamodel qa = new changesecurityqamodel(@user.identity.name); //this constructor sets username , loads several other fields necessary process. return view(qa); } // //changesecurityqa post [httppost] [authorize] public actionresult changesecurityqa(changesecurityqamodel imodel) { \\imodel.username null... } the view in question not use username, methods call in post handler will. for username thats not big deal again, info more complicated flow, how can ensure information entered model controllers come post? that data has exist in form somewhere. if there's

How to make Ant build fail if standard out or error contains a warning? -

i have ant-based build worked on multiple developers. want discipline team causing hard build break if part of build pipeline emits warning. realistically, think build needs fail if either stdout or stderr contains regex along lines of "\bwarn(ing)?\b|\berror\b|\bfatal\b" \b 's word boundaries. how can accomplish this? if want control output of build, need implement custom listener. see https://ant.apache.org/manual/listeners.html more information. once implemented, can instruct ant use listener passing -listener fully_qualified_listener_classname , assuming class added classpath. basically need implement org.apache.tools.ant.buildlistener , logic in messagelogged method receives build event corresponding log generated task. event contains message logged can parse determine whether stop build, typically throwing runtime exception buildexception .

Java make custom object comparable? -

i have object below. public class coords { public int x; public int z; public coords(int x, int z) { this.x = x; this.z = z; } } how can implement compareable? im not sure compareto method should doing. @override public int compareto(object o) { // todo auto-generated method stub return 0; } you compare x , compare z (alternatively, z , x ). also, suggest override tostring . like, public class coords implements comparable<coords> { public int x; public int z; public coords(int x, int z) { this.x = x; this.z = z; } @override public int compareto(coords o) { if (this.x == o.x) { if (this.z == o.z) { return 0; } return this.z < o.z ? -1 : 1; } return this.x < o.x ? -1 : 1; } @override public string tostring() { return string.format("{%d, %d}", x, z)

c# - MD5 each file in a folder and also MD5 the folder -

if please ask assistance problem have, i'd open folder display each file , hash , @ end of displayed files i'd hash display of total folder structure. code below isn't correct adds path md5 file md5. the code below displays each file in listbox , under hash hash code hash folder repeated each file. private void btnfolder_click(object sender, eventargs e) { dialogresult result = folderbrowserdialog1.showdialog(); if (result == dialogresult.ok) { _path = folderbrowserdialog1.selectedpath; txtfolder.text = _path; // assuming want include nested folders var files = directory.getfiles(_path, "*.*", searchoption.topdirectoryonly) .orderby(p => p).tolist(); foreach (string items in files) { md5 md5 = md5.create(); (int = 0; < files.count; i++) { string file =

javascript - Programmatically save chrome's console log -

is there way in javascript or nodejs programmatically in chrome's console can save file or database? before executing code want log, overwrite console.log 1 throws array (or anywhere else) example in ecmascript 6: var logs = []; var oldconsolelog = console.log; console.log = function(...args) { logs.push(args); oldconsolelog.call(this, args); }

php - Check valid international URL -

i need check if international url valid. example: http://täst.de/äxample-url/ how can that? can use composer package. you can try test url using filter php. example: $url = "http://www.w3schools.com"; if (!filter_var($url, filter_validate_url) === false) { echo("$url valid url"); } else { echo("$url not valid url"); } http://www.w3schools.com/php/filter_validate_url.asp http://php.net/manual/en/filter.filters.validate.php

apache storm - How to do Fields Grouping in Kafka Spout (JAVA)? -

- i've requirement consume delta updates of items kafka queue partitions. producer makes sure delta updates corresponding given item available in same partition , in order. ex: i1 & i2 items, there updates i1-up1, i1-up2 in same partition.similarly, i2-up1 & i2-up2 in same partition. hence, when first set of bolts receive should fields grouped based on items( i1 , i2). mean, same bolt should receive updates of i1 in order. the problem how can specify in bolt right after spout kafkaspout needs something. a quick search said can write own kafka scheme(implement multischeme), lacks code examples. i've written 1 not sure how make sure fields grouping.

insert css to ruby app - namely, rtl support to gitlab -

couldn't find on subject, more general "ruby" , "css" terms (as opposed "gitlab" , "rtl"). apologize if missed existing answer. my problem complete lack of knowledge in ruby, , of time learn it. not new programming though, , know thing or 2 web programming (played django little). we interested in deploying gitlab on server in workplace, need display hebrew text properly. don't need gitlab translated! our comments , issues created in hebrew. believe can achieved applying following css code pages (all of them, why not): div.event-note { direction: rtl; text-align: left; } div.issue-actions { left: 30px; } div.issue-title { direction: rtl; padding-bottom: 5px; text-align: right; } div.note-text p { direction: rtl; text-align: right; } div.state-label.state-label-green { float: left; } div.st

android - "if" in method on the BroadcastReceiver service will not work -

this question has answer here: how compare strings in java? 23 answers i have problem checking variables in "if". userphonenumber variable sharedpreferences , phonenumber of smsmessage. i displaying toast both variables , same, if didn't work. problem? my broadcastreceiver class: public class incomingsms extends broadcastreceiver { string userphonenumber = ""; string sendernum= ""; string message= ""; final string tag="locationservice"; gpstracker gps; double latitude = 0.0; double longitude = 0.0; // object of smsmanager final smsmanager sms = smsmanager.getdefault(); public void onreceive(context context, intent intent) { sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(context); userphonenumber = settings.getstring("userphonenumber", ""); log.

git - Rebase entire development branch onto new master branch -

i'm working repository in theory should following gitflow workflow (see a successful git branching model vincent driessen). however, initial commit on repository made on develop branch , there no master branch seen. it's nearing release time , need create master branch reflects production-ready state of project should've been there start. keep in mind develop branch has multiple feature branches coming off of it. repository entirely local , hasn't been pushed. my idea create orphan branch master , rebase develop branch onto it, don't know how i'd go doing that. so, how can create master branch if created start? update: in case, first commit on develop not commit should considered suitable production, using initial master commit unwise. reason project in state because not using vcs when decided use git. after fiddling, came with. simpler, manual approach vonc's answer . rebasing entire development branch let's assume have

How to hide direct download link in wordpress -

i using wordpress.org create site embedding direct download links ftp. want hide links users. if user right click on link, url file(resolved), if user go developer console of browser url download visible , @ time of downloading (in downloads of browser) ,it shows link downloading. how can make hide user? the method you're looking php dispatching . means file served via php rather redirect file path, meaning url stays invisible user downloading file. depending on level of experience can either use plugin achieve effect such this one , or alternatively can hook wordpress directly, although require php knowledge.

Auto Face Tagging Library -

i looking library can auto tag persons on photo. features similar facebook, picasa or iphoto tagging function. preferably it's able run on linux server, callable through php , python. recommendation? thanks. with regard you're looking for, aren't going find can host on own server. rather, companies offer api can send requests, , charged base don how use api. in no particular order, here several resources might consider using. https://lambdal.com/face-recognition-api - have low priced entry options, , well-suited detecting , recognizing new faces. http://www.alchemyapi.com/products/alchemyvision/face-detection - more geared recognizing famous or well-know people.

iOS Background location tracking fails on test devices -

based on example application , stackoverflow post: periodic ios background location updates , have managed create working implementation periodic background location tracking. everything works on device , install application xcode, every tester send application via crashlytics app still times out in background. does have debug/release mode or provisioning profiles? are sure using background location permissions correctly? testing/deploying on ios 7 or ios 8? check article more information: http://nshipster.com/core-location-in-ios-8/

ios - Xcode: My user location doesn't show the first time I run the simulation but the second time it does -

whenever first open project , hit build , run first time app won't focus on current user location. if stop simulation , build again , run it, focus on user location want to. can't figure out why this, wrong simulator or wrong code? super viewdidload]; self.mapview.showsuserlocation = yes; self.mapview.delegate = self; [self.mapview setusertrackingmode:mkusertrackingmodefollow animated:yes]; did try debug->location service ? try this

javascript - Performance issue in ngRepeat -

i have ngrepeat block iterates on array of objects draws row accordingly. one of properties of object string requires transformation before displayed. performancewise, right run function everytime angular runs loop? <div ng-repeat="a in arr">{{ strtransform(a.name) }}</div> yes , ok, performance-wise , everything, unless: your transformation function way expensive, in case you're doomed, or: you got humongous amount of elements process, in case you're doomed rendering time anyway. -- as side note, i'd add might wanna use angular filter (link) these kinds of operations :)

android - How can I get more than one 'tab' character in my textview? -

i'm trying display log file in textview, tab characters have in file aren't displaying properly. spannablestringbuilder span = new spannablestringbuilder(text); span.setspan(new tabstopspan.standard(600), 0, span.length(), spanned.span_exclusive_exclusive ); ((textview) findviewbyid(r.id.logtext)).settext(span, textview.buffertype.spannable); what happens first tab in line displays properly, subsequent tabs show spaces. have tried replacing '\t' \u0009 still didn't work. have tried changing tab span, wasn't successful. you need set them all: for (int = 0; < 1000; += 100) span.setspan(new tabstopspan.standard(i), 0, span.length(), spanned.span_exclusive_exclusive);

php - Why is it wrong to tie a depencency into a Business Object? -

in general, has been told me dependencies should injected. concerns should separated. control should inverted. why? for example, if use separation of concerns don't inversion of control. why wrong? i.e. see code below discussion.. class businessfunctionality { public $motor; function dostuff() { //i.e. @ creation time not injecting data //into motor. create empty motor set data later $this->motor = new motor(); //motor loads data $this->motor->loadmotor(); } } class motor { public $motordata; function loadmotor() { $motordata = new motordata(); //motordata class created //separate concerns of motor functionality //from database details //we load data acquired motordata, motor $this->motordata = $motordata->loadmotor(); } } class motordata { function loadmotor() { //mock database $type = "industria

python - How to get highest quality .tiff from .pdf using linux software? -

Image
i have picky label printer , need convert black , white .pdf file .tiff image saving quality possible. have example .tiff converted using adobe software , that's quality aiming for. tried using graphicsmagick job, can't close enough. here's section of image: on left side try , on right 1 converted adobe software: as can see adobe converted image thicker images of same resolution (200x400) can give me hint how convert .pdf .tiff using common python libraries or ubuntu packages , similar results? cheers

asp.net mvc 4 - Javascript "Expect ;" on int -

i keep getting "expected ;" error on 3 int variables (month, day, year) defining: <script type="text/javascript"> function validatedateformat(input) { var values = input.value.split("/"); int month = parseint(values[0]); int day = parseint(values[1]); int year = parseint(values[2]); if ((month < 1 || month > 12)) { alert("month value: "+ month + " not valid month using mm/dd/yyyy format"); input.value = ""; return; } if ((string.valueof(year).length() != 4)) { alert("year value: "+ year + " not valid year using mm/dd/yyyy format"); input.value = ""; return; } if(day < 1 || day > daysinmonth(month, year)) { alert("day value: "+ day + " not valid day month value: " + month + " using mm/dd/yyyy format"); input.va

jquery - Django search box on separate page from results -

i have search box in django site that's code looks this: <li> <i class="search fa fa-search search-btn"></i> <form action="" method="get" class="search-open"> <div class="input-group animated fadeindown"> <input id="searchfield" type="text" class="form-control" placeholder="search" name="searchfield"> <span class="input-group-btn"> <button id="searchbutton" class="btn-u" type="button">go</button> </span> </div> </form> </li> i need submit search form , have go through django view wont cooperate. i've tried few methods can seem things work if page displaying results same page search form not case here. any or suggestions ton. have search function , , template display things

python - Django - Cache vs QuerySet Filter for Server Efficiency? -

which 1 of these 2 more efficient on server resources? lets have 1 "main" queryset use , have 3 additional filters display filtered results. option 1: q = entry.objects.filter(filter='filter') = q.filter(filter=a) b = q.filter(filter=b) c = q.filter(filter=c) option 2. lets assume can cache filtered results memcached can either run option 1 or can following: q = entry.objects.filter(filter='filter') = cache.get('key_a') b = cache.get('key_b') c = cache.get('key_c') is correct assumption option 1 1 database query , the filters applied django? or wrong , running option 1 database hit 4 times? now if option 1 = 1 database hit, more efficient process a, b, c, filters django (or rather web server) versus grabbing results cache? i cache q results technically have these 2 options: option 1a: get q cache , apply queryset filters q = cache.get('key_q') = q.filter(filter=a) b = q.filter(filter=b) c = q.f

Cython C++ static methods in a template class -

problem i have template class in c++ has static method. looks more or less this: template<typename t> class foo { static std::shared_ptr<foo<t>> dosth(); } so in c++ call like: foo<int>::dosth(); . in cython however, way call static methods using classname namespace: cdef extern "bar.h" namespace "bar": shared_ptr[bar] dosth() # assuming shared_ptr declared but has no notion of templates. obviously, passing foo<t> namespace doesn't work, because translates foo<t>::dostr() in c++, no concrete type substituted t. question how in cython? there way, or workaround? note : answer right @ time written (and still work) should use @robertwb's answer question instead properly. i don't think can directly in cython. create thin wrapper of normal (non-static-method) c++ template function template <typename t> std::shared_ptr<foo<t>> foo_t_dosth<t>() { return fo

c# - How to Use GridView to display XML Web Response By Attribute Name Instead of DataSet Column Name -

i'm trying display xml web response using asp.net form gridview. i'm new .net framework i'm struggling of particulars. i'm developing search engine xml response result of search particular phrase or word. sample of xml response <response> <lst name="responseheader"> <int name="status">0</int> <int name="qtime">8</int> <lst name="params"> <str name="qf">recordkey</str> <str name="df">text</str> <str name="echoparams">all</str> <str name="indent">true</str> <str name="wt">xml</str> <str name="q">*:*</str> </lst> </lst> <result name="response" numfound="281" start="0"> <doc> <str name="date created">2014-10-30</str> <str name="facility">*****<

sql server - In sql divide row1 by row,row2 by row3.... . .and store the output third column -

i have table, need perform division on amt column , update data int calcamt month amt calcamt jan 10000 null feb 20000 null mar 30000 null apr 40000 null eg: (feb/jan) store output in calcamt of feb, (mar/feb) store output in calcamt of mar, expected output: month amt calcamt jan 10000 0 feb 20000 2 mar 30000 1.5 apr 40000 1.33 this can done through lead/lag , since using sql server 2008 you cannot use lead/lag function. instead use can generate row number each row , self join same table row number + 1 fetch previous row data. note: need add remaining months in order in case statement if have any. as side note should not use reserved keywords object name ex: month ;with cte (select rn=case [month] when 'jan' 1 when 'feb' 2 when 'mar' 3 else 4 end, * yourta

html - separate file uploads node.js -

i want know easiest way handle 2 separate file uploads, 1 images , other audio. right using multer , uploads multipart uploads same location. can specify different locations both file uploads? assuming want save files disk, can this: var storage = multer.diskstorage({ destination: function(req, file, cb) { if (file.fieldname === 'image-file') { return cb(null, 'folder-for-image-uploads'); } if (file.fieldname === 'audio-file') { return cb(null, 'folder-for-audio-uploads'); } cb(new error('unknown fieldname: ' + file.fieldname)); }, filename: function(req, file, cb) { if (file.fieldname === 'image-file') { return cb(null, 'image-filename.jpg'); } if (file.fieldname === 'audio-file') { return cb(null, 'audio-filename.mp3'); } cb(new error('unknown fieldnam

javascript - External function call from JSNI is not working -

i trying translate javascript code jsni code. script imports <script src="jquery-1.11.2.min.js"></script> <script src="jquery.typeahead.min.js"></script> <script src="autocompletetest/autocompletetest.nocache.js"></script> script $('#q').typeahead({ minlength: 1, order: "asc", group: true, groupmaxitem: 6, hint: true, dropdownfilter: "all", href: "https://en.wikipedia.org/?title={{display}}", template: "{{display}}, <small><em>{{group}}</em></small>", source: { country: { data: data.countries }, capital: { data: data.capitals } }, ... to $doc.getelementsbyclassname("q").typeahead({ ... }) but i'm getting error: @com.citi.sevi.client.autocompletetest::loadjquery()([]): $doc.get

node.js - Aggregating in local timezone in mongodb -

i building application in mongodb , nodejs used in italy . italy timezone +02:00 . means if 1 saving data @ 01:am of 11 july saved 11:00 pm of 10 july mongo saves date in utc. need show date wise tx count. made group query on date. shows tx in previous day. should workaround this. > db.txs.insert({txid:"1",date : new date("2015-07-11t01:00:00+02:00")}) > db.txs.insert({txid:"2",date : new date("2015-07-11t05:00:00+02:00")}) > db.txs.insert({txid:"3",date : new date("2015-07-10t21:00:00+02:00")}) > db.txs.find().pretty() { "_id" : objectid("55a0a55499c6740f3dfe14e4"), "txid" : "1", "date" : isodate("2015-07-10t23:00:00z") } { "_id" : objectid("55a0a55599c6740f3dfe14e5"), "txid" : "2", "date" : isodate("2015-07-11t03:00:00z") } { &quo

ruby - Why doesn't ---.*--- select everything between --- inclusive? -

i have text file looks this: some text here. text not replaced. --- , wild block appears! has stuff in i'm trying replace. --- block no more. nothing replace here. and i'd replace between --- , --- . i'm trying: text=file.open('myfile') text.sub(/---.*---/, 'replacement') but doesn't seem work. doing wrong? you need specify "multiline" option in pattern make dot symbol match newline characters: thus, code should like text.sub(/---.*?---/m, 'replacement') see example

objective c - How to display image correctly from link ? ios -

i using code display images on ios app : nsdata *receiveddata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:url]]; self.image=nil; uiimage *img = [[uiimage alloc] initwithdata:receiveddata ]; self.image = img; this code work perfect many images , can't display image : https://docs.google.com/uc?authuser=0&id=0bw8vnowkrlfgumc3ahbkczkwbjq&export=download also android app display correctly ! what's problem ? edit : mention can't open image on mac preview , shows message : may damaged or use file format preview doesn’t recognize. can open chrome. your image isn't valid png file. it's webp image. it's supported google chrome, os x or ios doesn't have native support format, that's why code doesn't work.

c# - Why does custom WinForms control not adhere to properties set in constructor when drawn? -

i have custom text box control inherits system.windows.forms.textbox . basically set automatically checks whether value entered number every time text changes. sample code: public class mytextbox : textbox { public mytextbox() : base() { base.textchanged += mytextbox_textchanged; base.backcolor = color.white; base.forecolor = color.black; } private void mytextbox_textchanged(object sender, eventargs e) { try { int.parse(base.text); base.backcolor = color.white; base.forecolor = color.black; } catch(formatexception) { base.backcolor = color.red; base.forecolor = color.white; } } } as indicated above, have default background , foreground white , black respectively, winforms designer draws component having red background, , comes way when launch program well. when start typing numbers in, however, change black/white , otherwise behaves expected. but w

Trying to build a calculator in java but I keep getting the .class error -

i started java class summer program offering , tasked creating simple calculator. have different cases created , variables accounted reason keep getting .class error , have no clue know comes from: cases(int fnum, int snum, string op); import java.util.scanner; public class day1{ public static void main(string [] args){ cases(int fnum, int snum, string op); } public static void input(){ scanner userinput = new scanner(system.in); int fnum, snum; string op; system.out.println("enter first num: "); fnum = userinput.nextint(); system.out.println("enter second num: "); snum = userinput.nextint(); system.out.println("enter operation: "); op = userinput.next(); } public static void cases(int fnum, int snum, string op){ input(); switch(op){ case "+": system.out.println(fnum + snum); break; case "-": system.o

oracle10g - Oracle cumulative totals by week for a given date range -

i using following query column totals week given date range... select to_char(week_start - 1, 'dd-mon-yy') week_end, run_qty, acc_qty, case when run_qty <> 0 round(acc_qty/run_qty, 4) else 0 end pct (select week_start, sum(run_qty) run_qty, sum(acc_qty) acc_qty (select trunc(next_day(trunc(created_date), 'monday')) week_start, nvl(sum(run_qty), 0) run_qty, nvl(sum(accepted_qty), 0) acc_qty shema.table_a (some conditions) , created_date between :fromdate , :todate group trunc(next_day(trunc(created_date), 'monday')) union select trunc(next_day(trunc(to_date(zday, 'dd-mon-rrrr')), 'monday')) week_start, 0run_qty, 0acc_qty (select :fromdate + (level - 1) zday dual connect level <= (:todate - :fromdate))) group week_start o

Django 1.8 handwritten form no POST data -

i've become frustrated problem i'm having. have large form that's hand-written (not using django's forms), , trying access data inputs in views (in case, inputs posting, others weren't). leaving specifics of form aside since there many things @ play, in troubleshooting process wrote simplest form think of, , getting no post data besides csrf_token. i have no idea why be, since similar (and more complex) works fine on several other django projects i'm running. example, tried action="" no avail. there incredibly obvious i'm missing? here's html: <!doctype html> <html> <head> </head> <body> <form method="post" id="theform" action="/simpleform/">{% csrf_token %} <input type="text" id="thetext" value="where i?" /> <input type="hidden" id="hiddeninput" value="i don't

Ruby code for configuring Selenium to access JavaScript console -

what correct ruby code configuring selenium access javascript console (i.e., messages writing using console.log , console.error , console.info , etc.)? i've found several articles java, python, , c# code; but, i'm having trouble getting right ruby. here best guess firefox: caps = selenium::webdriver::remote::capabilities.chrome caps[:loggingpref] = {:browser => :all} return selenium::webdriver.for :firefox, :desired_capabilities => caps this code doesn't appear affect (i logging messages, not generated console.log , console.error , etc.). therefore, suspect have spelled wrong, or symbol need string. chrome provide access console.info , console.error , , console.warn messages default. not show console.log messages. assume there similar technique configuring chrome driver return messages; but, again, can't find right combination of keys, values, symbols, , strings make work. the capability called :logging_prefs in ruby , :browser p

c++ - What's the best way to detect a white ball on the water surface by using opencv? -

Image
i put small white ball on water surface. wind makes white ball move in water. want using opencv detect , track ball.because background(water surface) single color, ball single color. use color in hsv , set threshold detect white color(ball). think way easier , better camshift, tld, optical flow method. have problem, detect white color find ball, wind strong , water wave happen follow ball. pic follow the wave have white color in hsv. when use findcontours edge of ball, edge including ball , wave. have tried use erode , dilate remove wave noise.but can't result. have no idea now. can , show me how can remove wave in better way? i'm not sure using color detect ball best choice in case. maybe should try camshift, tld, optical flow method? can show idea me?thanks in advance!! i can't think of perfect solution @ moment can suggest strategy can atleast mis-detect ball. the optical flow of whole scene can find velocities of pixels or selected keypoints. once fin

jQuery blur function is called twice -

<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 location_detail" style="clear:none !important;"> <div class="col-xs-12 txt_selectd_location">selected locations <div class="col-xs-3 pull-right">qty.</div> </div> <div id="changecont" class="col-xs-12 pad0"> <div class="col-xs-12 unallocate-amount"> <div class="col-xs-8 pad0 bold">unallocated</div> <div class="col-xs-3 pull-right" id="unallocated-stcok-display">200</div> <input type="hidden" id="unallocated-stcok" value="200"> </div> <div class="location_row"> <div class="city"> ahmedabad

wso2esb - Linking the Wso2 Api Manager to Wso2 ESB - 4.8.1 vice versa -

issue: not able confiure esb proxy services in wso2 api manager.. new product.. workaround solution explored: have downloaded wso2 api (with version 1.9.0 ) manager wso2 website , have started wso2 api manager , both esb , api manager running successfully. in wso2 esb have created proxy services , want setup same in wso2 api manager. , java version using jdk 1.7 , please check version compatablity there wso2 esb , wso2 api manager . updated code: please find proxy service: wsb proxy service url:https://i0025:8247/services/addassetservice <?xml version="1.0" encoding="utf-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="addassetservice" transports="https" statistics="disable" trace="enable" startonload="true"> <target> <insequence> <log> <property name="message" value="test

Make Such Array For TreeView in PHP Where parent chid hierarchy directly did not exists -

i have function gives me treelist if give him $treedata = array(id=1,name=abc, parentid=null). have table structure there no problem provide such array. problem starts when have no such structure in table client want treelist such structure parent child hierarchy not directly exists. table structure have types subjects topics lessons lessontypes in lessontypes have typeid, subjectid, topicid, lessonid i tried make array function not quite please see code: private function maketreedataarray(){ $treedataarr = array(); $resourcetesttypesarr = array(); $topicarr = array(); $lessonarr = array(); $testtypeidprefix = 'testtype@'; $subjectidprefix = 'subject@'; $topicidprefix = 'topic@'; // $model = new resourcetesttype(); //get testtypes treedataarr $model = new option(); $testtypes = $model->where('type','testtype')->get(); foreach ($testtypes $k => $tt) { $testtypeid

c# - CSV Helper not writing to file -

i've been stuck trying csv helper write file. when run action downloads file proper name , else, never writes it. public async task<stream> getdownloadstreamasync(int id) { var memorystream = new memorystream(); var streamwriter = new streamwriter(memorystream); var streamreader = new streamreader(memorystream); var csvhelper = new csvhelper.csvwriter(streamwriter); csvhelper.writerecord(new eventregistrant { firstname = "max" }); await memorystream.flushasync(); memorystream.position = 0; return memorystream; } the action: public async task<actionresult> downloadregistrantscsv(int id) { var @event = await _service.getasync(id, true); if (@event == null) return httpnotfound(); var stream = await _service.getdownloadstreamasync(id); return file(stream, "application/txt", "test" + ".csv"); } i've tried using documentation csv helper , can't write. here&

django - Which model to consider in Geodjango? The initial one or the one generated by ogrinspect? -

i have made models application given in https://docs.djangoproject.com/en/1.8/ref/contrib/gis/tutorial/ after did ogrinspect , generated model. difference between model , 1 ogrinspect generated geometry field. initially model has mpoly = models.multipolygonfield() objects = models.geomanager() and 1 ogrinspect generated has geom = models.multipolygonfield(srid=4326) objects = models.geomanager() so model should want consider? whether should replace existing model 1 generated ogrinspect , migrate or no need of replacing?