Posts

is there a way to record audio in mp4 using ruby on rails / web / html5 -

i find way record audio (not video) in mp4 format on web. reason ios/android both generating in format, , want able consistent audio format. (android mediarecorder example not mp3, thats reason why preferred format) is there recorder records mp4 audio web/html5/rails? update: i found out recorderjs https://github.com/mattdiamond/recorderjs im guessing if change encodewav encodempeg4 in here: https://webaudiodemos.appspot.com/audiorecorder/js/recorderjs/recorderworker.js this target audio outcome im trying achieve: type: audio codec: mpeg aac audio (mp4a) there example uses web audio api . think front-end(html , javascript) should handle audio recording generate mp4 file can save in rails app via carrierwave or else.

java - can i use an if statement to append to a string? -

right have following code, , i'm trying code append string instead of system.out.println. know worded oddly, not sure how put it. char[] c = inputstring.tochararray(); for(char ch : c) { if(ch <=88 && ch>=65 || ch<=120 && ch>=97) system.out.print(character.valueof((char) (ch+2))); else if (ch =< 1) system.out.print(character.valueof((char) (ch-24))); else if (ch == 2) system.out.print(character.valueof((char) (ch-24))); else system.out.print(ch); all need defining string next c[] array and add characters operator += , @ end have complete string of want, char[] c = inputstring.tochararray(); string str = ""; for(char ch : c) { if(ch <=88 && ch>=65 || ch<=120 && ch>=97) { str += character.valueof((char) (ch+2)); } else{ if (ch =...

sql - is it possible to order by column based on values, in sqlite? -

suppose table name status ab 1 cd 4 ef -2 mn 3 pq -1 xy 2 defination of status: 1,2 = success 3,4 = failure -1,-2 = error expected results after order (order status based on success, failure, error) ab 1 xy 2 cd 4 mn 3 ef -2 pq -1 while simple order status gives this ab 1 xy 2 mn 3 cd 4 pq -1 ef -2 is there way sort in expected way, without adding column maps similar status value? you can use case statement: order (case when status in (1, 2) 1 when status in (3, 4) 2 else 3 end) if have reference table, can join information well.

jquery - Adding placeholder attribute to input HTML -

i'm attempting add placeholder attribute multiple input tags unique classes in form. form generated plugin can't add attribute in manually. unfortunately nothing have tried has worked. because each placeholder different i'm address each 1 separately... here's html <input class="name-field" type="text" id="yourname_38_1" name="yourname" value=""> the jquery i'm using $(".name-field").attr("placeholder", "name"); when in console following referring line jquery on. uncaught typeerror: $ not function my understanding of jquery basic. please help thank in advance. dave you need load jquery plugin. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> please add line above <script></script> tag.

node.js - Cookie not accepted while web-scraping with NodeJS -

i'm making script web-scrape response post request in form. thing page asks cookie jsessionid on it, before that, script makes request same page rescue cookie sent use in post request, page response 'error 400: invalid path /salidaaplicacion requested' var request = require('request'); var async = require('async'); request = request.defaults({ jar: true }); var url = "http://civil.poderjudicial.cl/civilporweb/atpublicodaction.do"; var headers = { 'host': 'civil.poderjudicial.cl', 'user-agent': 'mozilla/5.0 (x11; ubuntu; linux x86_64; rv:44.0) gecko/20100101 firefox/44.0', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'accept-language': 'en-us,en;q=0.5', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive' } var options = { url: url, followredirect: true, forever: true...

jquery - Can not get values from a form in javascript -

i'm trying values of different inputs of form: <form class="form-horizontal" role="form" id="form_newcours"> <div class="form-group"> <label class="control-label col-sm-2" for="discipline">matiere:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="discipline" placeholder="matiere"> </div> </div> <div class="form-group" align="left"> <label class="control-label col-sm-2" for="datetimepicker">date:</label> <div class="input-group col-sm-4"> <input type="text" class="form-control" id="datetimepicker"/> <span class="input-group-addon"...

javascript - What's the proper way to test SPA angular application which relies heavily websockets? -

i'm using protractor jasmine test our angular 1.5 based application. page uses reactjs handle streams sources websockets. protractor responsible angular based events/states. problem is, have wait data arrive websockets. right doing manual waits, that's unstable , lame. i'm guessing somehow have listen websocket manually, i'm not sure. what best way wait data coming websockets?