Posts

R - XML of natural language corpus into dataframe -

i handling xml file in r using xml package. final goal create dataframe containing following information. luwpos luwdictionaryform luwlemma orthographictranscription phonetictranscription plainorthographictranscription devoiced moraid toneclass moraid 動詞 ダイスル 題する 題し ダイシ 題し 1 3 accent 1 luwpos, luwdictionaryform, luwlemma atts of luw node. orthographictranscription, phonetictranscriptio, plainorthographictranscription in suw, daughter of luw. devoiced in phone node, descendant of suw. moraid att of mora node, grandmother of phone. toneclass attribute of node xjtobilabeltone, descendant of phone. second moraid closest ancestor of xjtobilabeltone containing toneclass=accent. not phone nodes contain att devoiced. in case, don't need first moraid. when xjtobilabeltone not contain toneclass="accent", don't need second moraid either. so far, following: doc= xmlinternaltreeparse(file="a01f0122.xml") #opens file luw <- xpathsapply(doc, "//luw...

c - Field ' ' could not be resolved -

currently trying compile kernel module in userspace. module is aes_generic.c so far commented kernel headers , started fixing compile errors u8 not available simpyl replaced uint8_t these errors gone now i struggling error field '' not resolved this error appears in various fields here's example: #define loop8(i) { \ loop8tophalf(i); \ t = ctx->key_enc[8 * + 4] ^ ls_box(t); \ ctx->key_enc[8 * + 12] = t; \ t ^= ctx->key_enc[8 * + 5]; \ ctx->key_enc[8 * + 13] = t; \ t ^= ctx->key_enc[8 * + 6]; \ ctx->key_enc[8 * + 14] = t; \ t ^= ctx->key_enc[8 * + 7]; \ ctx->key_enc[8 * + 15] = t; \ } while (0) error: field 'loop8(i)' not resolved more code same error message: int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const uint8_t *in_key, unsigned int key_len) { const __le32 *key = (const __le32 *)in_key; uint32_t i, t, u, v, w, j; if (key_...

latex - Automatically launch a command with Emacs when it's a .tex file -

i want launch command when start emacs .tex file. command is: m-x flyspell-mode is possible , how? perhaps can add hook latex-mode . can add following line .emacs file. (add-hook 'latex-mode-hook 'flyspell-mode) i didn't test this, however, think should work. enable flyspell-mode whenever enter latex-mode .

python - Prioritizing Greenlet workers for parallel read/writes/db access -

i need read 3 csv files of size 10gb each , write parts of file 3 files. in middle, there minor conditions involved , mongo query(6bil collection, indexed) each row. i thinking using gevent pools task not sure how prioritize read tasks on writes,ensuring read finished before writers exit out. i dont want block writers until read finished. i can spawn 3 readers put in queue. i can spawn 20-25 io-processors read queue, mongodb call , write writer queue. i can spawn 3 writers read write queue , write files. i can joinall on pool. now can keep queue timeout in io-processors , writers. ensure of readers have put complete data in queue? or possible put join on readers @ end of io-processors? in short, want learn if there optimal approach use perform task efficiently.

ruby on rails - How can the value get updated in update_attribute -

i have test, needs set database-state: before site.first.update_attribute(:primary_domain, @params[:order][:primary_domain]) end but, reason, modifies @params: before @params[:order][:primary_domain].must_equal "example.com" site.first.update_attribute(:primary_domain, @params[:order][:primary_domain]) @params[:order][:primary_domain].must_equal "example.com" end this fails, second @params[:order][:primary_domain].must_equal "example.com" fails, updates @params[:order][:primary_domain] there. weird, have expected update_attribute(name, value) not touch value , somehow, does. it can circumvented .dup . interested cause this. maybe scope issue? fact normalising site.primary_domain on save , maybe? # override primary_domain setter. # allows normalise domain def primary_domain=(primary_domain) return primary_domain unless primary_domain.is_a?(string) write_attribute(:primary_domain, site.parse_uri(primary_domain.dup).host) end ...

search from json datasource through jsp and servlets -

how search json data source through jsp , servlets. sorry question being broad , not adhering stack overflow rules, yet kindly me if u can. web-links/ links of tutorials helpful. thank ! this blog json jsp & servlets. json-jsp-servlets and if looking particular search functionily json. use ajax , parse json response ajax , easy use , fast too.

javascript - JS drawing a line from the edge of a circle to another circle edge -

i'm trying draw line edges of 2 circles in html5 canvas. so, know coordinates of centers of 2 circles , radius. circles drawn randomly. line should move edge of 1 circle other. please help! p.s. sorry english :) update: i'm trying this, how know angle? from_line_x = circle1.x + circle1.radius * math.cos(math.pi * angle); from_line_y = circle1.y + cirlce1.radius * math.sin(math.pi * angle); to_line_x = circle2.x - circle2.radius * math.cos(math.pi * angle); to_line_y = circle2.y - circle2.radius * math.sin(math.pi * angle); update2: i think found how find angle. circle drawn randomly, line drawn not true. how should algorithm? sorry english again. here's solution achieve you've asked for. i've declared 3 'classes' make things clearer read. first, define generic shape class. next, define basic circle class. finally, define vec2 class. extend have done, , add other shapes inherit shape class - i.e square triangle, etc. i cr...