Posts

ios - Force Built-in Mic over bluetooth headset's mic? -

i use built-in mic on device input , bluetooth headset output. session category , must avaudiosessioncategoryplayandrecord . have tried using setpreferredinput: built-in mic switches output device's speakers. i've seen this (specifically comments) mention it's possible. you can use code // create , set audio session avaudiosession* audiosession = [avaudiosession sharedinstance]; [audiosession setdelegate:self]; [audiosession setcategory: avaudiosessioncategoryplayandrecord error: nil]; [audiosession setactive: yes error: nil]; // set bluetooth microphone input uint32 allowbluetoothinput = 1; osstatus stat = audiosessionsetproperty ( kaudiosessionproperty_overridecategoryenablebluetoothinput, sizeof (allowbluetoothinput), &allowbluetoothinput ); nslog(@"status = %x", stat); // problem if not 0 // check audio route uint32 size = siz...

javascript - mongodb regex to find two words with exactly n or less words between them -

i want regex can query mongodb in following manner following results a x y b a x b a b in short want regex finds 2 words n words or less between them. here go: /start( \w+){0,n} end/ example /start( \w+){0,1} end/ matches start word word word end // no match start word word end // no match start word end // match start end // match edit you should use /^start( \w+){0,n} end$/ this takes better advantage of mongodb's indexes querys , faster non-indexed fields.

javascript - How to use regex for some specific country character? -

i validating username using regex in js. however, giving me error other country character. found regex other country character. if(/^[a-za-z0-9äöüÄÖÜß\u4e00-\u9faf\u3040-\u3096\u30a1-\u30fa\uff66-\uff9d\u31f0-\u31ff\x30a0-\x30ffñáéíóúü\p{han}\u1100-\u11ff|\u3130-\u318f|\ua960-\ua97f|\uac00-\ud7af|\ud7b0-\ud7ffàâäèéêëîïôœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ\u00c0-\u017f\u4e00-\u9fff|\u2ff0-\u2fff|\u31c0-\u31ef|\u3200-\u9fbf|\uf900-\ufaffzàèéìòóù\u00e0\u00e8\u00e9\u00ec\u00f2\u00f3\u00f9._-]{1,160}$/i.test(text)){ console.log('correct word'); } else { console.log('wrong word'); } but want allow specific country e.g korean: hangul, chosŏn'gŭl japanese: hiragana, katakana (full width), kanji german spanish french italian chinese: simplified chinese russian portuguese. i want can manually remove country character, e.g want remove "simplified chinese", don't can in code because don't know string used country chara...

python - Start a script in background when django project start -

i have script fetches data api , add data mongodb. data necessary django project. script separate project. django project single account only. number of account goes up, have setup individual project each account. (replica of each other different credentials. cannot have multiple on same project.) i thought of cron jobs confusing seperate jobs number of accounts. i searched subprocess.popen think serve purpose of running script in background. i.e. when project server run python script started background process. my script like: func1(): while true: # sleep(30) func2(): while true: # sleep(150) func3(): while true: # sleep(900) func4(): while true: # sleep(7200) if __name__ == '__main__': p1 = process(target = func1) p2 = process(target = func2) p3 = process(target = func3) p4 = process(target = func4) p1.start() p2.start() p3.start() p4.start() i ha...

MySQL MyISAM Table File is now Too Large -

i have mysql myisam table handles medium blob data. reaches 1.09tb. worried now. possible split table multiple files? file.myd01, file.myd01,... etc. or in case, if have better idea alternative path take on, love hear. (added comment:) create table filetbl ( fileid int(11) not null auto_increment, docid int(11) not null, versionid int(11) not null, doccode varchar(30) not null, filedata mediumblob, docsalt varchar(1000) default null, primary key (fileid), key docversion (versionid,docid) ) engine=myisam auto_increment=0 default charset=latin1 please provide show create table , show table status . for long time default limit myisam data size has been 2^48 bytes. indexing, default has been 2^40 rows fixed format, not case -- since have mediumblob . 2^48 limit; 256tb. long way hitting it. pain of doing merge or partition not worth it. , probably gain no performance benefit. more limits . compression suggestion ...

html - Bootstrap Navbar unable to collapse -

i want click button in header expand list of links, expands, , unable hide. should working normally? here code: <!-- navbar --> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <!-- button collapse list --> <a href="#homepage"><img class="icon" alt="brand" src="img/icon.ico"></a> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapsebtn" aria-expanded="false" aria-controls="collapsebtn"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> ...

java - Very Wired thing happens when I compare two elements of the ArrayList -

this question has answer here: why 128==128 return false 127==127 return true when converting integer wrappers? 6 answers why equal operator works integer value until 128 number? [duplicate] 7 answers public static void main(string[] args) { arraylist<integer> mylist = new arraylist<integer>(); mylist.add(2000); mylist.add(2000); mylist.add(2); mylist.add(2); if(mylist.get(1)==mylist.get(0))system.out.println("2000 equal check"); if(mylist.get(1)!=mylist.get(0))system.out.println("2000 not equal check"); if(mylist.get(2)==mylist.get(3))system.out.println("2 equal check"); if(mylist.get(2)!=mylist.get(3))system.out.println("2 not equal check"); } my code shown above. , results shown below....