Posts

Showing posts from February, 2011

apache spark - Understanding MultiFileWordCount example in Hadoop -

i'm trying understand multifilewordcount example in order implement combinefileinputsplit in hadoop. most of easy except 2 lines i'm finding confusing https://github.com/hanborq/hadoop/blob/master/src/examples/org/apache/hadoop/examples/multifilewordcount.java#l142 i'm not clear why skipfirstline needed , why offset decreased 1. this same thing used in post ibm well. here appreciated.

c# - How can I debug multi-project using VS Code? -

Image
i working on solution have several projects, can see following image: and question can debug main program counld not debug dependency project; did have solutions solve problem? can give me reply? i have found solution,just modify project.json can touch breakpoint @ dependency project; "buildoptions": { "debugtype": "portable" }, value debugtype portable

c# - Better for loop performance to check radiobuttons -

i have 512 separate radio buttons , each of them related bool display. i made function for loop uses lots of cpu. there better way this? for (int k = 0; k < numwords_for_plctohmi_bools * 16; k++) { string sradiobuttonname = "radiobutton_plctohmi_bool" + k.tostring(); radiobutton r = controls.find(sradiobuttonname, true)[0] radiobutton; r.checked = kepwarearrwordtobools_plctohmi[k]; } you retrieve radiobuttons first, , iterate them afterwards in memory this: var radiobuttons = this.controls.oftype<radiobutton>(); (int k = 0; k < numwords_for_plctohmi_bools * 16; k++) { string sradiobuttonname = "radiobutton_plctohmi_bool" + k.tostring(); radiobutton r = radiobuttons.single(x => x.name == sradiobuttonname); r.checked = kepwarearrwordtobools_plctohmi[k]; } this should more efficient.

linux - Exec format error while executing the file in embedded device from telnet -

i have embedded device consist of 32-bit arm-7 winbond cpu , uclinux os. have windows 7 64-bit machine. have install virtual box ubuntu compiling program uploading through ftp server. file in embedded device being executed telnet server. device has own vdi file unable open image in virtual box install ubuntu in virtual box. the problems are: when compile program , upload in device through ftp, while executing file telnet not execute program , shows "exec format error". debugged executable file shows " stack smashing detected ". how solve this? when copy sample code windows ubuntu server in virtual machine , loaded program in device through ftp not executed. , same did windows 7, uploaded sample code in device through windows ftp program being executed. why happens? you can't run program built different architecture. app built x86 64-bit architecture, , try run on 32-bit arm) have cross-compile program given architecture. here can read cros

javascript - Jquery post response not available -

i'm new javascript, , problem may trivial need help. goal send post python server based on tornado. in following function : var machin = $.post( '/room/testroom', function( data ) { truc = data; return truc; i never content of truc . variable has url inside used create new websocket connection. when console.dir(machin); see wanted responsetext wanted url in console, i'm not able outside of console. the variable data inside function has wanted data, if : alert(data) see alert box wanted url. feel free ask me details may not entirely clear. server side, python code one: def post(self, roomname): print 'je poste' db = connect(host=config.sqlserver, user=config.sqluser, passwd=config.sqlpass, db=config.sqldb) cursor = db.cursor() uri = self.request.uri url = uri.split('/') roomname = url[2] sql = 'select roomid abcd_un roomname = %s', [roomname] cursor.execute(*sql) room

python - Graphene-django - How to catch response of query? -

i use django , django graphene make graphql api. in view of application, use reactjs , react-bootstrap-table . react-bootstrap-table expects pass object array not support nested objects . i created query in schema.py : class applicationnode(djangoobjecttype): class meta: model = application filter_fields = ['name', 'sonarqube_url'] interfaces = (relay.node,) class query(objecttype): application = relay.node.field(applicationnode) all_applications = djangofilterconnectionfield(applicationnode) the answers these queries json nested objects this: { "data": { "allapplications": { "edges": [ { "node": { "id": "qxbwbgljyxrpb25ob2rloje=", "name": "foo", "sonarqubeurl": "foo.com", "flow":{ "id": "qybwbgljyxrpb45

PHP can't login to MySQL server? -

i have client.php file in server a use database server server b . both centos. i have installed necessary services such php, phpmyadmin, mysql on both servers , @ first, encountered issue "reading initial communication packets, lost connection sql" when login using php file , researched, needed run following commands. setsebool -p httpd_can_network_connect=1 setsebool -p httpd_can_network_connect_db=1 after running commands, error message doesn't appear anymore doesn't log in @ all.. stuck in login page. do have allow features php able work mysql in centos remotely? please kindly out im newbie in linux.

node.js - Getting email Bounce when using gmail nodejs api -

this code using send email. function sendmessage(auth) { var gmail =google.gmail('v1'); var email_lines =[]; email_lines.push("from:a@gmail.com"); email_lines.push("to:b@gmail.com"); email_lines.push('content-type:text/html;charset=iso-8859-1'); email_lines.push('mime-version:1.0'); email_lines.push("subject:testing "); email_lines.push("hi,"); email_lines.push("testing"); email_lines.push("<b>hi</b>"); var email =email_lines.join("\r\n").trim(); var base64encodedemail = new buffer(email).tostring('base64'); base64encodedemail=base64encodedemail.replace(/\//g,'_').replace(/\+/g,'-'); gmail.users.messages.send({ auth, 'userid': 'me', 'resource': { 'raw': base64encodedemail } },function(err, response) { if (err) { console.log('the api returned error: ' + err); return; } console.l

Servicestack return wrong content type when returning a file with html extension -

i testing servicestack rest files service. when calling angularjs , asking html file back, results comes standard servicestack html format instead of json format. when appending ?format=json, not work correctly. trying browse html files , trying load ace editor. think servicestack getting confused response type. checked , content-type set application/json on client side when doing request. i'm assuming request you're making is: get /files/myfile.html it's returing html because .html file extension built-in registered format in servicestack assumes you're explicitly requesting api in html format. you can avoid ambiguity specifying file path on querystring, e.g: get /files?path=myfile.html which tells servicestack send using appropriate format specified in accept header. or if prefer can explicitly specify format adding {.ext} @ end of path info, e.g: get /files.json?path=myfile.html another option, if you're not using servicesta

Does Direct2D have CompositingModeCopy like GDI+? -

i trying move virtual white board application gdi+ direct2d. perviously used graphics::setcompositingmode(compositingmodecopy) "eraser" function, can't find similary interface in direct2d. thanks. d2d1_compositing_mode_source_copy , requires direct2d 1.1 (windows 8+, or windows 7 sp1 w/ platform update) https://msdn.microsoft.com/en-us/library/windows/desktop/hh446995(v=vs.85).aspx also, pairing id2d1rendertarget::pushaxisalignedclip , id2d1rendertarget::clear() can used "erase" rectangular region. works on windows 7 rtm. https://msdn.microsoft.com/en-us/library/windows/desktop/dd742775(v=vs.85).aspx

javascript - Jquery - how to make this code work? (extracting info from another website) -

i've found nice piece of code seems work, have difficulites adapt needs (never used jquery, basics of java). able figure out part of it, haven't succeed make work. the website i'm trying extract info from: here . want access value of child (h2) present in div class="cash" (the amount of money raised). i'm trying adapt code ( jfiddle ): var url='http://query.yahooapis.com/v1/public/yql?q=select * html url=\'http://stackoverflow.com/\' , xpath=\'//div[@id="question-mini-list"]//h3//a\'&format=json&callback=?'; $.getjson( url, function(data){ $.getjson( url, function(data){ $.each(data.query.results.a, function(){ $('body').append('<div><a href="http://stackoverflow.com'+this.href +'">'+this.content+'</a></div>') }) console.dir(data.query.results) }) i've changed url into: var url='http://que

vb.net - Searching by the Text property in Treeview.Nodes -

i have winform tree view using vb.net (property named " tvwacct ") able search through existing nodes given string (" txtname.text "), , if exists, give user message box warning stop duplicate entries. needs able search parent nodes , child nodes. current tree structure follows: bank account name -> sub-account name 1 -> sub-account name 2 -> sub-account name 3 i have looked @ msdn.microsoft , can see nodes.find method exists. here code: private sub txtname_validating(eventsender object, eventargs canceleventargs) handles txtname.validating dim cancel boolean = eventargs.cancel ' [ other 'if' conditions here ] if tvwacct.nodes.find(txtname.text, b).length > 0 mymsgbox("sorry, cost centre/bank account exists.", msgboxstyle.information) end if whilst debugging using watch feature tvwacct.nodes property, can see code logic works, appears comparing against "name" prope

iOS Swift 3 - UIDatePicker -

i have uidatepicker shows day, month , year. don't know how parameters. so best way day, month , year uidatepicker using swift 3? in swift 3 can use datecomponents way. first add action on datepicker .valuechanged events. datepicker.addtarget(self, action: #selector(datechanged(_:)), for: .valuechanged) then selected day, month , year using datecomponents in action. func datechanged(_ sender: uidatepicker) { let componenets = calendar.current.datecomponents([.year, .month, .day], from: sender.date) if let day = componenets.day, let month = componenets.month, let year = componenets.year { print("\(day) \(month) \(year)") } }

gridview - A blank grid with a random green place in Matlab -

i created 100x100 lattice using code : l=ones(101,1)*(1:101); i=2:101 j=1:101 l(i,j)=10*(i-1)+j; end end m=l; x=randi([1 100]); y=randi([1 100]); m(x,y)=0; i want generate blank 100x100 grid case containing "0" in green. note: tried method doesn't work map1 = [1 1 1]; colormap(map1); pcolor(l) map2 = [0 1 0]; colormap(map2); pcolor(m(x,y)) most of code good. need change last part map2 = ones(max(m(:)),3); map2(1,:) = [0 1 0]; colormap(map2); pcolor(m); you need colormap represents of possible colros in map. si thats first line does, sets colors white. next line changes first element (wich correspond 0) green

c# - Xamarin app sending and receiving data to web api architecture -

i'm new xamarin , question not clear me. going make xamarin forms portable application. normally, i'm separating web app models level, dal, bll , ui. in case of xamarin forms app, right if use appname.xamarin(portable) mix of models, dal , bll , appname.droid presentation level? there di accepted or may strategy pattern purpose?

javascript - Dragable jquery, limit destination by type -

i've got way achieving i'm after in codepen codepen.io/c7borg/pen/zogmdb i'm stuck on conditional drop. i need limit items allowed in each container type instance hot items allowed in 'hot things' container, items allowed in 'anything' container any appreciated here functions: $(function(){ var myarguments = {}; function assembledata(object,arguments) { var data = $(object).sortable('toarray'); // array data var step_id = $(object).attr("id"); // step_id , use property name var arraylength = data.length; // no need explain /* create step_id property if not exist */ if(!arguments.hasownproperty(step_id)) { arguments[step_id] = new array(); } /* loop through items */ (var = 0; < arraylength; i++) { var image_id = data[i]; /* push image_id onto property step_id (which array) */ arguments[step_id].push(image_id); }

swift - How to show activity indicator while passing between view controller -

lets have 2 viewcontrollers , in mainviewcontroller have button performs segue secondviewcontroller. when button tapped, i'm saving initial data coredata, takes time. here thing want do; while passing between viewcontrollers, want show activityindicator , starts after secondviewcontroller opened. me? i'm new swift. here code used in mainvc: override func prepare(for segue: uistoryboardsegue, sender: any?) { if (segue.identifier == "secondviewcontroller") { swiftspinner.show("loading") // act. indicator found on github willrunonce() // here im saving data coredata swiftspinner.hide() } } instead of adding code of activityindicator in prepare(for:sender:) method need call in button action , after call performsegue(withidentifier:sender:) method. @ibaction func onbtnskip(_ sender: uibutton) { swiftspinner.show("loading") // act. indicator found on github will

javascript - Page count function -

every time visit index page need check if record exists in database, if does, need update field 'count' if not add row. i've managed create row on visit, cant seem update count if row exists. // create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_error()); } // check see if record exists $sql = "select * page_tracking name ="index.php""; if (mysqli_query ($conn, $sql)) { $sql= "update page_tracking set count=count+1 name= "index.php")"; } else if { //insert query $sql = "insert page_tracking (name, count) values ('index.php', '1')"; } if (mysqli_query($conn, $sql)) { echo "thanks visiting! visit has been recorded"; } else { echo "unfortunately unable record visit: " . $sql . "<br>" . mysqli_error($conn); }

batch file - WMIC commands to change computer name to BIOS serial number -

i'm new batch file , wmic , after researching stackoverflow i've found few answers overlap not producing expected output when put together. problem: create batch file change computer name (not on domain): use wmic bios serialnumber , assign value variable comp_name , display value of variable; change computer name value of variable comp_name ; so 1.: for /f %%f in ('wmic bios serialnumber') ( set comp_name=%%f ) echo %comp_name% followed 2.: wmic computersystem name="%computername%" rename name=%%comp_name%% edit: got 1. part correct - works expected - fetching serial number , displays variable's value. part 2. still throwing errors: o:\>wmic computersystem name="tom-pc" rename name= invalid named parameter list. hint: <named param list> ::= <named param> | <named param> <named param list> <named param> ::= <param name>=<param value> if understand correctly - name=... part

scala - Should I use type, if my "extends AnyVal" has not methods? -

the internet not able answer question yet. 2 lines seem interchangeable me: type meter = double class meter(val d: double) extends anyval if meter not have methods, should use type instead? what's difference? what's difference? well, obvious thing first type alias, nothing more. latter attempt unroll wrapping class , use underlying primitive directly. but, there cases anyval can't unwrapped stated in documentation . example, assume wanted pass meter polymorphic function: def identity[t](t: t): t = t passing meter in allocate instance: scala> class meter(val d: double) extends anyval defined class meter scala> def identity[t](t: t): t = t identity: [t](t: t)t scala> :se -xprint:typer scala> identity(new meter(1.0)) // shortened brevity private[this] val res0: meter = $line4.$read.$iw.$iw.identity[meter](new $line3.$read.$iw.$iw.meter(1.0)); <stable> <accessor> def res0: meter = $iw.this.res0 on other hand, type

android - How can I swap test doubles at the scope of an Activity or a Fragment using Dagger 2? -

edit: watch out! have deleted old repository reffered in question. see own answer question possible solution , feel free improve it! i refering post here . came little further. refering 2 branches within github project: experimental [branch no. 1] (repository deleted) experimental [branch no. 2] (repository deleted) in old post tried swap components test-components within instrumentation test. works if have applicationcomponent , being in singleton scope. not work if have activitycomponent self defined @peractivity scope. problem not scope swapping of component testcomponent. my activitycomponent has activitymodule : @peractivity @component(modules = activitymodule.class) public interface activitycomponent { // todo: comment out switching old approach void inject(mainfragment mainfragment); // todo: leave witching new approach void inject(mainactivity mainactivity); } activitymodule provides maininteractor @module public class activitymodule {

angularjs - Angular Diference between $scope.arrays and javascript pure array on posting nested objs -

Image
im new angular seems me angular bind new stuff in arrays created , used in controller scope, in way cant send nested array through http post. the problem happens when trying send or without header, using $.param serialize or not. $http({ url: '../routines.php?action=salvarpesquisa', method: "post", data: $.param($scope.pesquisa), headers:{'content-type': 'application/x-www-form-urlencoded; charset=utf-8'} }); on console.log($scope.pesquisa) have: using that, post end without form data. break head trying figure out on headers {undefined, json, form-uyrlencoded etc}, trying fetch json using file_get_contents('php://input') on php when changing headers , on. solution came when used simple javascript object on same code, rebuilding object. lame, worked: var outro = {id:pesquisa.id,titulo:pesquisa.titulo,descricao:pesquisa.descricao,arrperguntas:pesquisa.arrperguntas,arrexcluirperguntas:pes

xml - XSLT Transformation create a soap fault -

i need create xslt transforms response message soap fault. tried creating xslt result not expected.attached input,expected output,xslt , result after xslt transformation. can please help. input: <response> <metadata> </metadata> <message-body> <errors> <transaction-id>12345</transaction-id> <claim-id>124545454</claim-id> <suffix-id>545454</suffix-id> <messages> <message-id>123</message-id> <message-type>e</message-type> <message-description>claim not found</message-description> </messages> <messages>

javascript - About HighCharts -

i want calculate , draw magnitude of complex number using highcharts. code showing real , imaginary values separately in graph. "for loop" used not working. please tell me did wrong? new highcharts. <!doctype html> <html> <head> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/modules/exporting.js"></script> </head> <body> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> <script> function makechart(){ $('#container').highcharts({ title: { text: '', x: -20 //center }, subtitle: { text: '

xmpp - Message lost when client connection lost suddenly in ejabberd -

i'm new ejabberd. problem when wifi connection lost suddenly, messages lost few seconds. according link have enabled stream management , resend_on_timeout set true , enabled mod_ping ping_interval: 10 still im missing messages. here port 5222 settings port: 5222 module: ejabberd_c2s certfile: "/home/salu/ejabberd-16.09/conf/server.pem" starttls: true stream_management: true resend_on_timeout: true ## enforce tls encryption client connections, ## use instead of "starttls" option: ## starttls_required: true ## ## custom openssl options ## protocol_options: - "no_sslv3" ## - "no_tlsv1" max_stanza_size: 65536 shaper: c2s_shaper access: c2s , mod_ping settings mod_ping: send_pings: true ping_interval: 10 timeout_action: kill can tell problem how can solve this?

php - Codeception + PhantomJS: how to open a new tab and switch to it -

i have acceptance test codeception. phantomjs configured webdriver. on page, have link has target="_blank" . problem is, when instruct codeception click on it, not focus on newly opened tab. hence test fails. code: $i->click('my link opens new tab'); what have tried: $i->switchtowindow('title of new window'); // doesn't work $i->see('some text in new tab'); // doesn't work my acceptance.suite.yml: class_name: acceptancetester modules: enabled: - webdriver - \helper\acceptance config: webdriver: url: 'http://localhost' browser: 'phantomjs' port: 5555 window_size: '1024x768' does have idea? i have found solution, in case there other suffering developer soul out there: $i->executeinselenium(function (\facebook\webdriver\remote\remotewebdriver $webdriver) { $handles = $webdriver->getwindowhandles(); $las

vba - Excel macro to pick a number corresponding to a cell value and insert same number of rows -

i new macros , trying create macros lack of syntactical knowledge posing big hurdle, tried recording become mcro specific case only. objective create macro first goes cell f1 of sheet2 , find content(say 'a') , gets value in cell g1 of sheet2 , in sheet1 search value 'a' let in cell k23 of sheet1 , inserts number of rows corresponding sheet2 g1 below k23 , goes , searches f2 , repeats process many values there in column f. when inserts rows in sheet1 column d of these blanks rows should different values values should same 23rd row. tried doing using recording , macro attached below, case specific. here sheet2 pivots , sheet1 team master. sub macro3() ' ' macro3 macro ' ' sheets("pivots").select workbooks("target macro.xlsm").connections.add2 _ "worksheetconnection_team master!$a$1:$l$200", "", _ "worksheet;d:\[target macro.xlsm]team master", "team master!$a

windows - IE11 + drop-down list + focus stolen (Eclipse Mars + GWT 2.5.1 dev mode) freeze entire system -

i issue time time , think know cause (see below) not how fix it. put breakpoint somewhere in client-side code, loads page makes few actions on page, breakpoint hit stops responding. can open task manager (windows 7) out of focus. 99.9% sure happens when there breakpoint (focus stolen ie) when drop-down list clicked on ie side, because it reproducible (i reproduced on pc, same project , breakpoint location, same ie version). each time happens have close entire windows user session because cannot focus back, on newly opened task manager window (this beyond retarded). there workaround issue other avoid breakpoints when drop-down list unrolled on ie side ? if not there @ least way windows s*** , close ie that, when freeze happen, don't have restart entire user session ? thank !

python - how to config pip on osx when installed by brew? -

i install python using brew on mac , add config file in ~/.pip/pip.conf [global] index-url=http://mirrors.aliyun.com/pypi/simple [install] trusted-host=http://mirrors.aliyun.com but doesn't work. when hit command pip install pil , complains: collecting pil repository located @ mirrors.aliyun.com not trusted or secure host , being ignored. if repository available via https recommended use https instead, otherwise may silence warning , allow anyways '--trusted-host mirrors.aliyun.com'. not find version satisfies requirement pil (from versions: ) no matching distribution found pil please advice. all need mark repository trusted run of pip: pip install pil --trusted-host mirrors.aliyun.com

javascript - How to add stringified script tag in express + jade/pug -

i have express using pug view. index.pug has following: script(type='text/javascript'). window.__data__ = !{payload} where payload json object. has been stringified in render function of express: res.render('index', { payload : json.stringify({ "anexample": "<script></script>" }) }) when json object has </script> terminates window.__data = function due ending script tag. how can prevent blowing page? limitation of pug or express or browser? you're going have "break up" string containing script tags. something should work: "anexample": "<script></scr" + "ipt>" this way, </scr" + "ipt> won't interpreted closing script tag.

html - Bootstrap page responsive -

i try create type of sign in page in bootstrap http://v4-alpha.getbootstrap.com/examples/signin/ but before create page not bootstrap code <%@ page language="c#" autoeventwireup="true" codebehind="mainpage.aspx.cs" inherits="project.mainpage" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>system</title> <link href="styles/login.css" rel="stylesheet" /> <link href="styles/main.css" rel="stylesheet" /> <link href="content/bootstrap.css" rel="stylesheet" /> <!-- google web fonts --> <link href='http://fonts.googleapis.com/css?family=raleway:400,500,600,700,800' rel='stylesheet' type='text/css'/> <link href='http://fonts.googleapis.com/css?family=open+sans:400italic,600italic,700italic,400,8

elasticsearch - logstash fails to create an index in ES -

i trying parse log file using logstash.. filebeat-reading sample logs directory , indexed elasticsearch through logstash. ( reading input file directory through filebeat , specifying read logstash output in filebeat.yml, , parsing log file in logstash configuration file, , putting result in index in es. ) filebeat.yml #=========================== filebeat prospectors ============================= filebeat.prospectors: #input_type: log #input_type: log document_type: my_log paths: - c:\logsa\elast.log #----------------------------- logstash output -------------------------------- output.logstash: # logstash hosts hosts: ["localhost:5044"] elast.log : (i trying parse 1 line of log in log file) [2016-11-03 07:30:05,987] [info] [o.e.p.pluginsservice ] [htykfft] initializing... logstash configuration file : input { beats { port => "5044" } } filter { if [type] == "my_log" { grok { match => { "m

amazon web services - Are AWS Security Group Port Ranges Inclusive or Exclusive -

aws security groups allow port range specified permitted traffic, written in form 1234-5678 : inclusive of ports 1234 , 5678 , or exclusive of either/both of ports? the documentation doesn't seem describe this. since example shows 0 - 65535 , 2^16 65536 (otherwise -1 - 65536 ), means inclusively.

android - Add Subnode to resources constants -

i use resource system of android specify strings , other stuff constants. default way access resources using constants generated in r r.string.hello_world . okay basic usage. if include android-library in project can bring resources in pool of own resources. can great thing, can problem if define value same key twice , override existing value. so questen is: possible add kind of parent node strings.xml file so: <resources> <category name="myapp"> <string name="hello_world">hello world</string> </category> </resources> so when access own resources have use r.string.myapp.hello_world instead? or not possible without changing r generator?

php - Row count with PDO -

there many conflicting statements around. best way row count using pdo in php? before using pdo, used mysql_num_rows . fetchall won't want because may dealing large datasets, not use. do have suggestions? $sql = "select count(*) `table` foo = bar"; $result = $con->prepare($sql); $result->execute(); $number_of_rows = $result->fetchcolumn(); not elegant way it, plus involves query. pdo has pdostatement::rowcount() , apparently not work in mysql. pain. from pdo doc: for databases, pdostatement::rowcount() not return number of rows affected select statement. instead, use pdo::query() issue select count(*) statement same predicates intended select statement, use pdostatement::fetchcolumn() retrieve number of rows returned. application can perform correct action. edit: above code example uses prepared statement, in many cases unnecessary purpose of counting rows, so: $nrows = $pdo->query('select count(

wpf - Clicking sound when playing a WAV file -

i'm writing application plays various wav files. i'm using mediaplayer class play sounds. when raising volume there's distinct clicking sound @ beginning of each wav file, , click @ end. also happens when playing files in windows groove or vlc player. playing same files in audacity works - there's no clicking sound. click not found in wav (i know looking @ sound wave in audacity). so there's another, more lowlevel way, of playing wav files. how can play them without these clicks? turns out problem too-loud sample. volume in sample maximal. once reduced sample volume (multiplying each value 0.6 actually), clicking sound disappeared - when turned speaker volume. way up.

python - Django slice string in template doesn't work -

i'm trying slice string doesn't work. works on other variables 1 nothing. {{b.rec_company|slice:":2"}} you use slice pre-django 1.4: {{b.rec_company|slice:'2'}} {{ b.rec_company|slice:":-3" }} if using django 1.4 or greater, you can use truncatechars {{b.rec_company|truncatechars:2}} for more reference use slice-string-in-template

java - How to prevent the function passed to Optional's orElse from being executed when the Optional is not empty? -

if i'm calling function orelse , function executed if optional not empty. there way restrict execution of function when optional empty? optional.ofnullable(somevalue).orelse(somefunction()); somefunction() gets executed since it's argument passed method, , arguments passed method evaluated before method executed. avoid execution, should pass somefunction() within supplier instance. use orelseget instead of orelse : optional.ofnullable(somevalue).orelseget(someclass::somefunction); or optional.ofnullable(somevalue).orelseget(()->somefunction());

javascript - ITHIT WebDAV Ajax library with Anonymous authentication -

we exploring ithit webdav ajax library 1 of our requirements provide ability edit file type in browser. @ moment downloaded 1 month free trail check whether library meets our requirements. created sample application using example provided here . enabled webdav in iis , set authentication anonymous. access file , view contents in it, when try save file asks me sign in , nothing happens once click sign in button. interestingly, when enable windows authentication in site view , save changes. need have configuration/custom code support file editing when anonymous authentication enabled? or limitation? note – i’m using office 2016, win 10, ie 11, webdav enabled @ site root level.

javascript - Can I call commit from one of mutations in Vuex store -

i have vuex store, following: import spreeapi '../../gateways/spree-api' // initial state const state = { products: [], categories: [] } // mutations const mutations = { set_products: (state, response) => { state.products = response.data.products commit('set_categories') }, set_categories: (state) => { state.categories = state.products.map(function(product) { return product.category}) } } const actions = { fetch_products: (state, filters) => { return spreeapi.get('products').then(response => state.commit('set_products', response)) } } export default { state, mutations, actions } i want call mutation: set_categories mutation: set_products , gives me error: projectfilter.js:22 uncaught (in promise) referenceerror: commit not defined(…) what should correct way this. tried store.commit , this.commit , these gave similar errors. when doing mutation, there no way commit mutation. mutation

ruby on rails - wicked_pdf stopped generating pdf files with the correct data -

Image
after updating rails 5, trying generate invoice gave me pdf files ror code written in template.

ios - Data not sent from a background via 3G -

i have application sends data server while app in background. here code responsible data sending: -(bool) sendstats: (mcstatssender*) val{ if(![self checkinternet]){ //using reachability here return false; } nsdictionary *inputdata = [nsdictionary dictionarywithobjectsandkeys: self.propertya.value, "key1", val.data, "key2", nil]; [mynetworkmanager dorequest:[myrequestmanager createwithstringanddictionary:my_url data:inputdata handler:myhandler user:val]]; return true; } so inputdata simple dictionary strings. a method dorequest based on nsurlsession , looks this: -(void) dorequest: (mcrequest*) request{ [tasks addobject:request]; if(m_session == nil){ nsurlsessionconfiguration* config = [nsurlsessionconfiguration backgroundsessionconfigurationwithidentifier:[nsstring stringwithformat:@"key-%lu",reqid]