Posts

Comparing the first columns in two csv files using python and printing matches -

i have 2 csv files each contain ngrams this: drinks while strutting,4,1.435486010883783160220299732e-8 , since that,6,4.306458032651349480660899195e-8 state face,3,2.153229016325674740330449597e-8 it's 3 word phrase followed frequency number followed relative frequency number. i want write script finds ngrams in both csv files, divides relative frequencies, , prints them new csv file. want find match whenever 3 word phrase matches 3 word phrase in other file , divide relative frequency of phrase in first csv file relative frequency of same phrase in second csv file. want print phrase , division of 2 relative frequencies new csv file. below far i've gotten. script comparing lines finds match when entire line (including frequencies , relative frequencies) matches exactly. realize that because i'm finding intersection between 2 entire sets have no idea how differently. please forgive me; i'm new coding. can give me little closer such big help. import csv impo...

packages - R Version Compatibility -

are different versions of r belong 3.1 compatible respect packages? that is, under windows , do these versions have same base packages installed in library? does 3.1.0 work package binaries compiled 3.1.1 etc?

javascript - event.preventDefault(); only works some of the time with submit form -

i using mailchimp api submit form. goal prevent default callback provided mailchimp. majority of time event.preventdefault() behaving should. randomly not work: $(function () { var $form = $('#mc-embedded-subscribe-form'); $('#mc-embedded-subscribe').on('click', function(event) { if(event) event.preventdefault(); register($form); }); }); function register($form) { $.ajax({ type: $form.attr('method'), url: $form.attr('action'), data: $form.serialize(), cache : false, datatype : 'json', contenttype: "application/json; charset=utf-8", error : function(err) { alert("could not connect registration server. please try again later."); }, success : function(data) { if (data.result != "success") { // went wrong, notify user. maybe alert(data.msg); var message = data.msg ...

python - Have Flask-AutoIndex serve the children of the app directory but not "/" itself -

i have flask application , want serve files in subdirectories of folder flask application resides. tried doing flask-autoindex so: autoindex(app, browse_root=os.path.curdir ) @app.route('/') def index(): return render_template('index.html'); this serves static content out of /css , /js nicely, can't / route index function. instead, autoindex routes / , displays files, including application source code file. tried setting add_url_rules false allowed index route / but /css , /js no longer served. how can have subdirectories of application autoindexed still allow application handle / ?

Nested list comprehensions in Haskell -

i following haskell tutorial , on higher order functions section. defines function called chain as: chain :: (integral a) => -> [a] chain 1 = [1] chain n | n = n:chain (n `div` 2) | odd n = n:chain (n * 3 + 1) there exercise find number of "chains" have length longer 15. this: numlongchains :: int numlongchains = length (filter islong (map chain [1..100])) islong xs = length xs > 15 i trying come list comprehension instead of giving me number of chains gives me list of chains longer 15 [1..100]. closest attempt far looks like: [ [ | <- chain b, length > 15] | b <- [1..100]] but get: <interactive>:9:14: no instance (integral [a0]) arising use of `chain' possible fix: add instance declaration (integral [a0]) in expression: chain b in stmt of list comprehension: <- chain b in expression: [a | <- chain b, length > 15] <interactive>:9:45: no instance (enum [a0]) arising arithmetic sequence `1 ...

javascript - Colour-coding points on Google Maps -

i'm developing application page of college project display information house price costs , looking implement colour-coded map different years. idea there dot each house sold located on map (google maps example), , colour-coded green red depending on how expensive was. i'm looking way implement using google maps api, have been unable find solution doesn't slow application loading in ~30k datapoints each year , application had 5 years worth of data. would have suggestions on use. i've looked @ google's geocharts , don't offer looking for. i've looked @ heatmaps, , though colouring effect i'm looking for, points weighted colour dependent on proximity rather specified variable, price. 30k points * 5 years = 150k markers. might much. should looking way show 1 year of history @ time and/or use marker clustering . regarding color markers, use svg markers that. can change color of svg path. little bit of calculation, should able process points...

eclipse - Android :: Adding jar in libs vs importing a library -

curious know difference between adding jar file in libs folder vs depending on library project in eclipse. for e.g. google play library can added in libs jar file whereas google doc says import project , require main project depend on play library project. does know difference between two? you want import project library when want use resources project. otherwise, import jar .