Posts

python - How do hex escapes correlate with audio in PyAudio? -

i'm playing around pyaudio in attempt make microtonal music, can't seem off ground. found bit of code on using core audio in-program: http://code.activestate.com/recipes/578301-platform-independent-1khz-pure-audio-sinewave-gene/ , i've made small adjustments: import time import pyaudio # open stream stream=pyaudio.pyaudio().open(format=pyaudio.paint8,channels=1,rate=24000,output=true) # amount of time wave played in seconds length = 1 # generate 1khz signal @ speakers/headphone output # sine wave, 8 bit depth start = time.clock() while time.clock() - start <= length: stream.write("\x00\x30\x5a\x76\x7f\x76\x5a\x30\x00\xd0\xa6\x8a\x80\x8a\xa6\xd0") # close open _channel(s)_ stream.close() pyaudio.pyaudio().terminate() from understand, hex escapes raw audio being sent audio output. i've put them hex converter , graphed values. looks sin wave, i'm still no closer intuitive understanding of what's going on. eventual goal write function c...

I want to encode Chinese to \\u5de5\\u4f5c formate in php. -

i want encode chinese \u5de5\u4f5c formate in php. there builtin php function or method ? the function json_encode() can used escape utf-8 encoded strings unicode format. example: <?php echo json_encode('工作'); output: "\u5de5\u4f5c"

css - Parallax Scrolling Imagery on different browsers -

i launched portfolio site , checking out on different browsers. underlying images becomes giant , takes entire screen (mainly on firefox). run ios yosemite on google chrome , looks great , works perfectly. parallax effect pure css. let me know think or how can fix this. thank you. bbennettdesign.com you using keith clark's pure css parallax effect , normally, changed items on parallax structure oneself. please remove styles , html markup , check it. if effect working, test specific codes. because effect work on firefox. browser support firefox, safari, opera , chrome support effect. firefox works there minor issue alignment. ie doesn't support preserve-3d yet (it's coming) parallax effect won't work. that's ok though, should still design content work without parallax effect - know, progressive enhancement , that! or can use this.

.net - How can I cancel Task.WhenAll? -

currenly using following code wait collection of tasks complete. however, have situation want able cancel/abort whenall call, via cancellation token preferably. how go that? dim taskcollection new list(of tasks.task) x integer = 1 threads dim newtask tasks.task = taskhandler.delegates(delegatekey).invoke(me, proxies, totalparams).continuewith(sub() threadfinished()) taskcollection.add(newtask) next await tasks.task.whenall(taskcollection) i'm assuming it's going along lines of next bit of code, i'm not sure go in 'xxx'. await tasks.task.whenany(tasks.task.whenall(taskcollection), xxx) use taskcompletionsource<t> create task asynchronous condition not have asynchronous api. use cancellationtoken.register hook modern cancellationtoken-based cancellation system cancellation system. solution needs combine these two. i have cancellationtoken.astask() extension method in asyncex library , can write own such: <system.ru...

diff - Git show whole file changes -

is there way git show command show whole contents of file when viewing commit? example: if show like foo.cpp +++ int main() { +++ std::cout << "hello" << std::endl; +++ } i want output say: foo.cpp #include <stdio> //assuming earlier commit +++ int main() { +++ std::cout << "hello" << std::endl; +++ } is there simple way this? this kind of hack, git show (like git diff ) has -u option lets specify how many lines of context show. if use number that's bigger region between difference , start or end of file, it'll show whole file. if use big number, it'll work way want on (hopefully) file try on: git show -u99999

java - Other coreference resolution alternatives -

i'm working project requires use of coreference resolution sentences. tried out stanford corenlp's coreference resolution , works fine, though noticeably , expectedly run slower larger pieces of text i'm analyzing. could suggest alternative coreference resolution tools may run faster stanford's? (preferably in java or python) you may want try berkeley coreference resolution system (superceded berkeley entity resolution system or illinois coreference package . of them run on jvm (first 2 in scala).

Writing integers in binary to file in python -

how can write integers file in binary in python 3? for example, want write 6277101735386680763835789423176059013767194773182842284081 file in binary in 24 bytes (unsigned, working positive integers). how can this? tried following: struct.pack("i", 6277101735386680763835789423176059013767194773182842284081) this results in valueerror: cannot fit 'int' index-sized integer i have tried same other formats ("l", "q"), result in errors: struct.error: argument out of range if convert integer 24 bytes, able write file, since know how that. however, can't seem convert integers bytes. also, how make sure 24 bytes written per integer? writing smaller numbers (1000, 2000, 1598754, 12), should take 24 bytes. and how can read integers again file afterwards? with python 3 can following: i = 6277101735386680763835789423176059013767194773182842284081 open('out.bin', 'wb') file: file.write((i).to_bytes(24, byt...