Posts

Showing posts from August, 2013

c# - Now that WebServiceHost2Factory is dead, how do I return error text from a WCF rest service? -

i've seen several references webservicehost2factory class use effectively handle errors in wcf rest services. apparently class, had throw webprotocolexception , body of response contain pertinent information. that class seems have fallen out of favor now. there replacement somewhere in .net 4 stack? i'm trying figure out how return error text in body of response post operation, if went wrong. key question below next *'s example: [description("performs full enroll , activation of member loyalty program")] [operationcontract] [webinvoke(method = "post", uritemplate = "/fullenroll/{clientdeviceid}", bodystyle = webmessagebodystyle.bare, requestformat = webmessageformat.json, responseformat = webmessageformat.json)] public memberinfo fullenroll(string clientdeviceid, fullenrollmentrequest request) { log.debugformat("fullenroll. clientdeviceid: {0}, request:{1}", clientdeviceid, request); memberinfo ret = ...

javascript - What is the better way to show a log in HTML showing the indentation? -

i have application gulp task, in task have retire, security package, when run task gulp, log this: demo-mobile 1.1.5 ↳ debowerify 1.3.1 ↳ bower 1.3.12 ↳ semver 2.3.2 i want save log in html format not possible, when run gulp, saves in html div. child.stdout.setencoding('utf8'); child.stdout.on('data', function (data) { console.log(data); loginfo+= data; }); the html template doesn't have indentation console. demo-mobile-1.1.5-↳-debowerify-1.3.1-↳-bower-1.3.12- somebody have , idea how fix behavior. best regards. well, there might better way, how about: var input = "demo-mobile-1.1.5-↳-debowerify-1.3.1-↳-bower-1.3.12-"; var spaces = " "; while (input.indexof("-↳-") >0) { input = input.replace("-↳-", "<br>"+spaces+"↳"); spaces += " "; } // below show output. var outputdiv = document.getelementbyid("output"); output...

javascript - How to break out of a loop from a returned promise value? -

a bit new javascript, i've read, values within promise usable within promise right? basically getsomething() returns true/false promise. , break out of loop if true. tried this, i'm sure it's not right it's not printing out "breaking" for(...) { var bool = this.getsomething(a,b,c).then((flag) => { if (flag == true) { console.log('returning true'); return true; // can't use break have set boolean - eslint gives me unsyntactical break } }); if (bool == true) { console.log('breaking'); break; } } getsomething(a,b,c) { const n = b[a].element(by.binding('something')); return n.gettext().then((text) => { if (text === c) { return clicksomething(); // returns true after click() } }); } the reason i'm using loop because need find matching text in strong tag, click on button in td tag below it. <tbody...

regex - get part of a string which contains given substring -

in bash have string , part (separator being white space characters) contains substring. have list="some string substring want match" and substring "ubst". i'd string "substring" returned. (in case of multiple matches should return first substring matches.) the parts of string compiler flags. can contain special characters (but no white space). using awk can this: str="some string substring want match" awk -v s='ubst' -v rs=' ' '$0 ~ s' <<< "$str" substring -v rs=' ' set record separator space breaking each space separated word individual record. $0 ~ s return word when word matched given search term ps: if want print first match use: awk -v s='ubst' -v rs=' ' '$0 ~ s{print; exit}' <<< "$str" just academic exercise if 1 wants single grep use pcre regex: grep -op '^(?:(?!\w*ubst).)*\k\w*ubst\w*' <<...

java - multiple filter in openrdf sesame Model -

i filter model, triples has specific predicate , subject of type c. below code not return result, 1 has idea how implement it? return triples.filter(null, new uriimpl(property.getfulliri()), null).filter (null, rdf.type,new uriimpl(c.getfulliri())); the problem applying second filter on result of first - result of first filter only contains triples property on filtered - second filter can never return empty result (since no triple in intermediate result have rdf:type predicate). since expressing secondary constraint 'non-sequential' in fashion, can not solve filtering alone. need construct new model , fill data go along. along these lines: // use valuefactory, avoid instantiating uriimpl directly. valuefactory vf = valuefactoryimpl().getinstance(); uri c = vf.createuri(c.getfulliri()); uri prop = vf.createuri(property.getfulliri()) // create new model resulting triple collection model result = new linkedhashmodel(); // filter on supplied prop...

smalltalk - How do I change the font of a text field in Pharo? -

in pharo, having trouble changing font of specific field. using uitheme openmodal file. below reference code: openmodal |builder dialog content login| builder := uitheme builder. content := (builder newlabelgroup: { 'login' -> (login := (builder newtextentryfor: contact gettext: #login settext: #login: help: 'enter login of user') acceptoncr: false; minwidth: 200). 'full name' -> ((builder newtextentryfor: contact gettext: #fullname settext: #fullname: help: 'enter full name of user.') acceptoncr: false; minwidth: 200). 'password' -> ((build...

powershell - Get-Help format is different when calling it in a script -

Image
i wondering why powershell get-help outputs following image when using script i've written. script's purpose display get-help information when selecting function array. #run file in same directory functions file. #this function validates user input function getinput { { $input = read-host "`n>enter function # see description" }until(([int]$input -gt 0) -and ([int]$input -le $flist.count)) $input } #include script want . "$psscriptroot\functions.ps1" #this operates on loop. after viewing info, press key , prompted choose function. $quit = 0 while(!$quit){ #get functions $f = @(get-content functions.ps1 | where-object { $_.startswith("function", "currentcultureignorecase") -and (-not $_.contains("#")); $c++} | sort-object) "there " + $f.count + " functions!" #split on ' ', second word (function name), add array $flist = @{} $i = 0 ...

css - Lines either side of date header -

im using following css create 2 lines either side of date header .date-header span { display: inline-block; position: relative; } .date-header span:after { content: ""; position: absolute; border-bottom: 1px solid #caa69a; top: 6px; width: 160%; left: 110%; } .date-header span::before { content: ''; position: absolute; top: 6px; border-top: 1px solid #caa69a; width: 160%; right: 110%; } however lines change size according length of date. i'd lines stay fixed length. i'm not sure edit or add?

c# - How to secure my wcf service using AWS authentication -

can secure wcf service using aws authentication. tring figure out google search , finding articles on calling service secured using aws authentication. not article of how secure wcf service aws. isn't there option, understanding of aws authentication , signing wrong this. please point me article start with. i'm going assume intend create wcf rest service uses an hmac based authentication scheme amazon s3 using. the way implement create own webservicehost , override applyconfiguration method. in method, set new serviceauthorizationmanager . this.authorization.serviceauthorizationmanager = new myserviceauthorizationmanager(); derive myserviceauthorizationmanager class wcf's serviceauthorizationmanager , override checkaccesscore method. class myserviceauthorizationmanager : serviceauthorizationmanager { protected override bool checkaccesscore(operationcontext operationcontext) { // check validity of hmac // return true if val...

R converting a single week row, to 7 day rows -

i've seen few similar examples , threads online morning, nothing find quite particular case. have dataframe looks this: week income views partner 09/07/15 2000 345 bob 09/07/15 460 11980 jane 08/31/15 304 678 mark what need each "week row" replicated each day within week. don't need worry how alter other variables divided 7, can perform operations without assistance. having trouble expanding week row 7 rows total describe each day within week, so: week income views partner 09/07/15 2000 345 bob 09/08/15 2000 345 bob 09/09/15 2000 345 bob 09/10/15 2000 345 bob 09/11/15 2000 345 bob 09/12/15 2000 345 bob 09/13/15 2000 345 bob 09/07/15 460 11980 jane 09/08/15 460 11980 jane 09/09/15 460 11980 jane 09/10/15 460 11980 jane 09/11/15 460 ...

Confgure pax-exam with --definitionURL -

from dmytro pishchukhin's blog learned pax-exam's runner can configure extension xml containing platform definition in following way: @configuration public static option[] configureplatform() { return options( ... rawpaxrunneroption("--definitionurl", "file:platform-equinox-3.6m7.xml") ); } seems rawpaxrunneroption has been deprecated , removed. there way load definition these days? (documentation @ pax runner docs ) doesn't seem updated.

javascript - Getting the Name of Key Pressed -

i trying use jquery.hotkeys plugin. while triggers events on keypress, want know name of key pressed. so code: $(document).bind('keydown', 'alt+ctrl+z', mycallback); i want value alt+ctrl+z inside mycallback function mycallback(){ // how name of clicked key i;e `alt+ctrl+z` here } i want value alt+ctrl+z inside mycallback since you're using jquery.hotkeys plugin, can access keys property on data object of event object passed: $(document).bind('keydown', 'alt+ctrl+z', mycallback); function mycallback(e) { console.log(e.data.keys); // alt+ctrl+z }

Sending from one logstash to another using TCP -

i'm trying forward events logstash server another. last logstash server should write received logs file in source logstash i've added: output { tcp { host => "host" port => port } } and destination logstash has: input { tcp { port => port } } output { file { path => "/var/log/project/log" } } this boot log: {:timestamp=>"2016-01-15t23:12:30.884000+0100", :message=>"reading config file", :file=>"logstash/agent.rb", :level=>:debug, :line=>"309", :method=>"local_config"} {:timestamp=>"2016-01-15t23:12:31.011000+0100", :message=>"compiled pipeline code:\n @inputs = []\n @filters = []\n @outputs = []\n @periodic_flushers = []\n @shutdown_flushers = []\n\n @input_tcp_1 = plugin(\"input\", \"tcp\", logstash::util.hash_merge_many({ \"port\...

Python unit test how do I pass variable from one function to another -

how pass variable 1 function another? like: def test_url(self): current_url = "xyz" def check_url(self): #call current_url here. def get_url(self): current_url = 'xyz' return current_url def test_check_url(self): url = get_url() # write more lines a better way this, overload setup() function comes unittest. setup() work of initializing variables , tests you. class yourtestcase(unittest.testcase): def setup(self): self.current_url = 'xyz' def test_check_url(self): self.assertequal(self.current_url, 'xyz')

javascript - Open a href link in the same pop up window -

i working on pop window displays list of store locations. each location there links google maps(maps , directions). my question that, when click on maps , directions link, open google map on same pop window, have button @ end take me previous window. right now, every time, click on maps , directions, opening in browser window. @charlietfl. ok. have product page link check store availability. when click on link, use jquery dialog open new pop dialog box. jsp page. in page, have search text can search list of stores zipcode. on search, ajax call, list of stores json , display them on jsp. each stores there link maps , directions take me google maps. for example <a href="http://maps.google.com/?q=1200 pennsylvania ave se, washington, district of columbia, 20003" id="mapdirections_0" target="_self">map & directions<a> . aim when user clicks on link, map displayed on same pop jsp. any appreciated. let me know if can provide more info...

spring mvc - Spark MLlib and Rest -

i working proof of concept of having spark mllib training , prediction serving exposed multiple tenants form of rest interface. did poc , running seems bit wasteful has create numerous spark contexts , jvms execute in wondering if there way around or cleaner solution having in mind spark's context per jvm restrictions. there 2 parts it: trigger training of specified jar per tenant specific restrictions each tenant executor size etc. (this pretty out of box spark job server, sadly doesnt yet seem support oauth), there way it. part don't think it's possible share context between tenants because should able train in parallel , far know mllib context 2 training requests sequentially. this trickier , can't seem find way that, once model has been trained need load in kind of rest service , expose it. means allocating spark context per tenant, hence full jvm per tenant serving predictions, quite wasteful. any feedback on how can possibly improved or re-architected...

python - Requires string as left operand, not reversed Error -

so code far: def mirror(s, v, m): rev = reversed(v) if(v in s): if(rev in s): if(m in s): return true return false str1 = "abcmcba" str2 = "abc" str3 = "m" mirror(str1, str2, str3) it supposed return true keeps giving me error: requires string left operand, not reversed you can streamline function following: def mirror(s, v, m): return m in s , v in s , v[::-1] in s note i've put fastest checks first doesn't waste time on slower operations unless they're necessary.

reactjs - browserHistory undefined with React Router 2.00 release candidates -

with react router 2.0.0rc1-5 have been getting browserhistory undefined after import: import { browserhistory } 'react-router' the package seems installed correctly, regardless of version , whether on server or client, have gotten same result. maybe known bug? see userouterhistory: https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md#using-custom-histories i'm using in server-side: import {router, routercontext, match, userouterhistory} 'react-router'; import {creatememoryhistory} 'history'; // ... const apphistory = userouterhistory(creatememoryhistory)({}); const component = ( <provider store={store} key="provider"> <router routes={routes} history={apphistory} /> </provider> );

How do I get a status to only update when necessary in javascript? -

i'm trying create 5th edition d&d character generator app (i know, super nerdy). i'm trying have questions asked based on level character at. want update information instead of reasking of same information. example, if character ranger @ level 1, ask favored terrain , favored enemies. if have character go level 2, reask questions , ask next question related level 2. how have update information gathered level 2 , on? i believe question answer how update experience points , not have ask same questions on , on again. if not, next question. thanks. here sample of code in question: if (level >= 1){ var favterrain1 = prompt("name favorite terrain."); var favenemy1 = prompt("name favorite enemy type or 2 humanoid races. (if select latter, please separate comma.)"); document.getelementbyid("level1").innerhtml = "<h4><b> favored terrain: </b>" + favterrain1 + "<br>...

shell - BASH scripting for username/password constructs -

i want write simple bash script using ncat open connection isp , port. the first command be: nc address port upon doing this, prompted first provide username. must hit enter, , prompted provide password , must hit enter again. after this, want open terminal process window. can point me sufficient resources type of scripting? i know username , password already, i'm not sure how work around fact must provide , hit enter. i'm unsure how open new terminal proceses. thanks in advance! check out expect script expect example: # assume $remote_server, $my_user_id, $my_password, , $my_command read in earlier # in script. # open telnet session remote server, , wait username prompt. spawn telnet $remote_server expect "username:" # send username, , wait password prompt. send "$my_user_id\r" expect "password:" # send password, , wait shell prompt. send "$my_password\r" expect "%" # send prebuilt command, , wait s...

uitableview - TableView extension swift 2 image hidden -

i using swift 2 xcode 7.2 in extension. rendering uitableview cells have image , label in problem image hidden ! idn't know why! can me please override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) uitableviewcell cell.textlabel!.textcolor = uicolor.whitecolor() let query = pfquery(classname:"recipe") query.orderbydescending("createdat") query.findobjectsinbackgroundwithblock { (objects: [pfobject]?, error: nserror?) -> void in if error == nil { print("success retrieved \(objects!.count) scores.") if let objects = objects { object in objects { let a:string = object.objectforkey("title") as! string self.contentstring.append(a) } ...

version control - Cleaning up after a conflicted git merge? -

i had small conflict in .h header file in project i'm working on. project tracked in git. fortunately, conflict simple solve. used git mergetool and chose default ( opendiff ) seemed filemerge on mac. made appropriate changes, saved file, , closed. git asked me if merge successful, said yes: was merge successful? [y/n] y but now, have: > git st # on branch develop # changes committed: # modified: myheader.h # # untracked files: # (use "git add <file>..." include in committed) # # myheader.h.backup.52920.h # myheader.h.base.52920.h # myheader.h.local.52920.h # myheader.h.remote.52920.h # myheader.h.orig which of junk conflict files created filemerge, , git? and more importantly: how remove them? you can delete them other file. example: rm myheader.h.orig alternatively, if there no other untracked files, after commit with git commit -a you may clean repository with git clean -n git clean -f git clean -n ...

arrays - println turning up as empty string in go -

so wrote small go program, gives instructions turing machine, , prints selected cells it: package main import "fmt" import s "strings" func main() { fmt.println(processturing("> > > + + + . .")); } func processturing(arguments string) string{ result := "" dial := 0 cells := make([]int, 30000) commands := splitstr(arguments, " ") := 0;i<len(commands);i++ { switch commands[i] { case ">": dial += 1 case "<": dial -= 1 case "+": cells[dial] += 1 case "-": cells[dial] -= 1 case ".": result += string(cells[dial]) + " " } } return result } //splits strings delimeter func splitstr(input, delim string) []string{ return s.split(input, delim) } problem is, when run, console doesn't display anything. disp...

mongodb - Pymongo importing succeeded but not showing in the collection -

i tried importing json file succeeded mongoimport --db dbwhy --collection dbcol --jsonarray consumer_complaint.json 2016-01-15t19:00:42.277-0600 connected to: localhost 2016-01-15t19:00:42.320-0600 imported 34 documents but when tried viewing it, not there from pymongo import mongoclient client = mongoclient('localhost',27017) db = client['dbwhy'] coll = db['dbcol'] curs = db.coll.find() in curs: print(i) it not show anything the problem here: db.coll.find() this find documents inside coll collection , your collection named dbcol . instead, use coll variable you've defined: from pymongo import mongoclient client = mongoclient('localhost',27017) db = client['dbwhy'] coll = db['dbcol'] curs = coll.find() # fix here in curs: print(i)

Notepad++ Regex Replace Capture Groups With Numbers -

so have numbers i'm trying replace in notepad++ , have tweak both positive values , negative ones, search looks this: v (.{0,1})13.500000 and replace: v $1 10.500000 except don't want space there between capture group reference , other digits, if leave space out, places nothing (no capture group #110). how "escape" capture group separate character-literals without inserting unwanted character? i 2 replacements, figured must possible, although can't figure out how search it. sample source text: v 13.000000 19.0000000 8.000000 v 13.000000 19.0000000 9.000000 v -13.000000 19.0000000 9.000000 v -13.000000 19.0000000 8.000000 desired result: v 10.000000 19.0000000 8.000000 v 10.000000 19.0000000 9.000000 v -10.000000 19.0000000 9.000000 v -10.000000 19.0000000 8.000000 try replacement: v ${1}10.500000

Python CSV reader return Row as list -

im trying parse csv using python , able index items in row can accessed using row[0] , row[1] , on. so far code: def get_bitstats(): url = 'http://bitcoincharts.com/t/trades.csv?symbol=mtgoxusd' data = urllib.urlopen(url).read() dictreader = csv.dictreader(data) obj = bitdata() row in dictreader: obj.datetime = datetime.datetime.fromtimestamp(int(row['0'])/1000000) q = db.query(bitdata).filter('datetime', obj.datetime) if q != none: raise valueerror(obj.datetime + 'is in database') else: obj.price = row['1'] obj.amount = row['2'] obj.put() this returns keyerror: '0' , have no idea how set up. did input interactive shell , when running for row in dictreader: print row i output: {'1': '3'} {'1': '6'} {'1': '2'} {'1': '6'} {'1': '9'} ...

swift - MapView over UITableViewCell -

i'm trying have mapview cover entire uitableviewcell , disable user activity on mapview, still have cell clickable. however, mapview (even though sent subview back) intercepting user clicks , causing didselectrow method never called. you can try way below: you add view above mapview , set background color clearcolor . think resolve problem.

SSL Not Working On NodeBB Forum Apache2 -

i have signed ssl certificate on site, , nodebb isn't working it. i'm using apache2 , certificate work. have use mod_proxy make forum run @ subdirectory instead of port :4567 work? suggestions welcome. thanks. here config { "url": " http://website.com:4567 ", "secret": "secret", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "27017", "username": "xxxxx", "password": "xxxxx", "database": "xxxxx" } } get ssl certificate, got mine here https://letsencrypt.org/ then put nodebb on port 443 , use apache mod_proxy remove port. ssl works.

draw 43 xy scatter drawing using vba in excel -

i need draw 43 x/y scatter drawing using vba in excel developed code 1 drawing , not sure how can apply draw remaining 42 drawing mean don't want change range of data manually need put in loop or this. code sub draw() activesheet.shapes.addchart2(240, xlxyscattersmoothnomarkers).select activechart.seriescollection.newseries activechart.fullseriescollection(1).name = "=""hbes""" activechart.fullseriescollection(1).xvalues = "=en!$g$253:$g$278" activechart.fullseriescollection(1).values = "=en!$h$253:$h$278" activechart.seriescollection.newseries activechart.fullseriescollection(2).name = "=""nhbes""" activechart.fullseriescollection(2).xvalues = "=en!$g$253:$g$278" activechart.fullseriescollection(2).values = "='en1'!$g$253:$g$278" activechart.seriescollection.newseries activechart.fullseriescollection(3).name = "="...

Hex editing Java bytecode throwing ClassFormatError -

while researching java, bytecode editing in particular, stumbled across this tutorial , guides through steps of editing compiled java .class files hex editor. intrigued, gave go. i made sure typed in correctly, checked , double-checked, replaced right bytes in hex editor, etc. everything's ok. the first thing noticed hex dump different his, however, expected this, different java versions yield different results. after inputting correct bytes (replacing hacking java bytecode! l33t hax0r bro , , 3 occurrences of 00 16 00 0e ), saved file, , ran it. however, instead of getting output of l33t hax0r bro , writer of tutorial did, got rather ugly error: error: jni error has occurred, please check installation , try again exception in thread "main" java.lang.classformaterror: unknown constant tag 116 in class file user @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:760) @ java.security.secureclas...

html - Making Bootstrap's navbar appearing in different position on desktop/mobile -

i want make bootstrap's navbar appear @ top on desktop view , @ bottom on mobile view. possible? how can it? there actual html top navbar: <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"><span class="fa fa-cloud-upload fa-fw"></span>&nbsp; gitup</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">...

asp.net mvc - mvc forms authentication landing page -

i have mvc website uses forms authentication. attempting add default landing page site ( landing.html ) each user hitting http://mywebsite.com example redirected to. i tried setting default document in web.config, redirected account/login page. i not want change login url because make user's session has expired go landing page, not want. any appreciated. thanks update "default" route. mvc projects have following route defined in routeconfig class , called in global.asax during application startup. public class routeconfig { public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); } } just replace "home" , ...

python - Importing Views -

my app layout my_app __init__.py my_app __init__.py startup create_app.py create_users.py common_settings.py core models.py views.py inner __init__.py from flask import flask flask_script import manager flask_sqlalchemy import sqlalchemy app = flask(__name__) # wsgi compliant web application object db = sqlalchemy(app) # setup flask-sqlalchemy manager = manager(app) # setup flask-script my_app.startup.create_app import create_app create_app() create_app.py from native_linguist_server import app, db @app.before_first_request def initialize_app_on_first_request(): """ create users , roles tables on first http request """ .create_users import create_users create_users() def create_app(extra_config_settings={}): app.config.from_envvar('env_settings_file') # load blueprints manage...

Segmentation fault: 11 ? C++ -

can tell why generate segmentation error? problem seems occur when operator[] called , when don't call it, goes fine. operator[] supposed return reference element index i.. great.. //dynamic_array.cpp file #include <iostream> #include "dynamic_array.h" using namespace std; dynamic_array::dynamic_array() { int *array; array=new int[4]; array[0]=3; size = 4; allocated_size = 5; } dynamic_array::~dynamic_array() { delete [] array; } int dynamic_array::get_size(void) const { return size; } int dynamic_array::get_allocated_size(void) const { return allocated_size; } int& dynamic_array::operator[](unsigned int i) { return array[i]; } //test.cpp file #include <iostream> #include <stdlib.h> #include "dynamic_array.h" using namespace std; int main() { dynamic_array a; cout << a[0]; } //dynamic_array.h file using namespace std; class dyna...

Twilio with Laravel - Error: XML declaration allowed only at the start of the document -

i'm getting following error when trying access 1 of routes on twilio using laravel. error on line 2 @ column 6: xml declaration allowed @ start of document the cause seems there empty 1st line in xml document rendered library because i've tested on different installation , didn't have same error. however, not know how go removing it. i've looked elsewhere online , the've suggested removing spaces preceding php tag, i've tried, hasn't worked. how remove first line in xml file generated? route::get('/outbound', function() { $saymessage = "hello"; $twiml = new services_twilio_twiml(); $twiml->say($saymessage, array( 'voice' => 'alice', 'language' => 'en-gb' )); $twiml->gather(array( 'action' => '/goodbye', 'method' => 'get', )); $response = response::make($twiml, 200); ...

api - iOS - Re-Attempt Failed NSURLRequests In NSURLSession -

in app, 2-4 api calls server can happening @ same time (asynchronously) within api class's nsurlsession . in order make api requests server, must supply authentication token in httpheaderfield of each nsurlrequest . token valid 1 day, , if becomes invalid after 1 day, need refresh token. i in following code in api class: /*! * @brief sends request nshttpurlresponse. method private. * @param request request send. * @param success block called if request successful. * @param error block called if request fails. */ -(void)sendtask:(nsurlrequest*)request successcallback:(void (^)(nsdictionary*))success errorcallback:(void (^)(nsstring*))errorcallback { nsurlsessiondatatask *task = [self.session datataskwithrequest:request completionhandler:^(nsdata *data, nsurlresponse *response, nserror *error) { [self parseresponse:response data:data fromrequest:request successcallback:success errorcallback:^(nsstring *error) { //if auth token expired...

signal processing - Optimal value of sampling frequency for guitar notes detection -

i running fft algorithm detect music note played on guitar. the frequencies interested in range 65.41hz (c2) 1864.7hz (a#6). if set sampling frequency of input 16khz, output of fft yield n points 0hz 16khz linearly. input interested in first n/8 points approximately. other n*7/8 points of no use me. decreasing resolution. from nyquist's theory ( https://en.wikipedia.org/wiki/nyquist_frequency ), sampling frequency needed twice maximum frequency 1 desires. in case, 4khz. is 4khz ideal sampling frequency guitar tuning app? intuitively, 1 feel better sampling frequency give more accurate results. however, in case, seems having lesser sampling frequency better improving resolution. regards. you confusing pitch of guitar note spectral frequency. guitar generates lots of overtones , harmonics @ higher frequency pitch of played note. higher harmonics , overtones, more possibly weak fundamental frequency in cases, human ear hears , interprets lower perceived pitch...

javascript - Dynamically generate table in form using Ajax with symfony -

i working symfony project . want generate table in form when select option in form. this task. there name options in form ( eg. john , mia , lia .. etc) when select "john" . want display detail "john" using table. table should locate in form . there example in link http://www.w3schools.com/php/php_ajax_database.asp but want using symfony. what best way this. please mention example. using javascript , jquery or ajax symfony the symfony keyword misleading here because generate table client javascript code. in javascript initiate ajax call post request php/symfony application. 1 returns json array of objects, , ajax complete/done method create table using jquery example. here example: <html> <head> <script src="https://code.jquery.com/jquery-2.2.0.js"></script> <script> $(document).ready (function () { }) ; function go () { $.post ('/index.php/api/mycall', ...

python - How can I handle huge matrices? -

i performing topic detection supervised learning. however, matrices huge in size ( 202180 x 15000 ) , unable fit them models want. of matrix consists of zeros. logistic regression works. there way in can continue working same matrix enable them work models want? can create matrices in different way? here code: import numpy np import subprocess sklearn.linear_model import sgdclassifier sklearn.linear_model import logisticregression sklearn import metrics def run(command): output = subprocess.check_output(command, shell=true) return output load vocabulary f = open('/users/win/documents/wholedata/rightvo.txt','r') vocab_temp = f.read().split() f.close() col = len(vocab_temp) print("training column size:") print(col) create train matrix row = run('cat '+'/users/win/documents/wholedata/x_tr.txt'+" | wc -l").split()[0] print("training row size:") print(row) matrix_tmp = np.zeros((int(...

ssis - Fetch image from non direct HTML link -

we have couple ssis jobs nicely fetch images , various expected graphics on websites. can't figure out how fetch image following site (sample). http://tess2.uspto.gov/imageagent/imageagentproxy?getimage=77666637 any thoughts on ssis techniques? i'm hoping don't have screenscrape or that... you can use script task fetch image. following article gives sample code can adjust save image file instead of text file. here link : http://www.sqlis.com/sqlis/post/downloading-a-file-over-http-the-ssis-way.aspx

ruby - The best way to browse rubygems documents on console -

it easy find rubygems documents on web, want read them on console. ri not enough me, because have know name of class or method before reading ri. @ time, however, don't know other package name! so need fastest way find synopsys of rubygems, perldoc. is there way? if using bundler can do: $ bundle open gemname which open gem in $editor allowing check out readme.rdoc (or whatever author using root documentation) not mention of source code. helpful when debugging too!

Stuck at SSH while post-commit on SVN -

i'm trying setup svn export files existing server. because company server live , huge has been operating several years, cannot wipe whole webserver , svn update server files big , content custom file. what want commit on server , scp latest committed file server b, file in web server direction. have attempt following below fail, better way recommend me? i'm not on doing configuration. here i'm attempt on post-commit: repository="file:///var/www/html/svn/testrepo/" revision_from=$2 target_directory="/home/svn/" expr $((revision_from--)) rm -r -f $target_directory line in `svn diff --summarize -r $revision_from:head $repository | grep "^[am]"` if [ $line != "a" ] && [ $line != "am" ] && [ $line != "m" ]; filename=`echo "$line" |sed "s|$repository||g"` # don't export if it's directory we've created if [ ! -d ...

levenshtein distance - How to calculate equal hash for similar strings? -

i create antiplagiat. use shingle method. example, have following shingles: i go cinema i go cinema1 i go th cinema is there method of calculating equal hash these lines? i know of existence of levenshtein distance. however, not know should take source word. maybe there better way consider levenshtein distance. the problem hashing that, logically, you'll run 2 strings differ single character hash different values. small proof: consider possible strings. assume of these hash @ least 2 different values. take 2 strings , b hash different values. can go b changing 1 character @ time. @ point hash change. @ point hash different single character change. some options can think of: hash multiple parts of string , check each of these hashes. won't work since single character omission cause significant difference in hash values. check range of hashes. hash 1 dimensional, string similarity not, won't work either. all in all, hashing not way go....