Posts

mongodb - Designing a database for querying by dates? -

for example, need query last 6 months earliest instance each day (and last day earliest instances in each hours, , last day minutes). thinking of using mongodb , having nested structure like year:{ month:{ day: { hour: { minute: [array of seconds] but first instance have sort array costly. there easier way? would better have date field. and query like: find(date: {$gt : 'starting_date', $lt : 'ending_date'})

javascript - Automatically translate web page -

how can automatically translate web page when entered it. this translator there connected dropdown. <script type="text/javascript"> function googletranslateelementinit() { new google.translate.translateelement({pagelanguage: 'da', includedlanguages: 'da,de,el,en,es,fi,fr,it,ja,ko,nl,no,pl,ru,sv,uk,zh-cn,zh-tw', layout: google.translate.translateelement.floatposition.top_left, gatrack: true, gaid: 'ua-32978177-1'}, 'google_translate_element'); } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googletranslateelementinit"> </script> i want translate automatically danish (da) english (en). have read function: http://www.blabla.com/#googtrans(da|en) where should implement it? you need create div called google_translate_element mentioned in first script this: <div id="google_translate_element"> here area google fetches...

ruby - Why do I get "FasterCSV::MalformedCSVError: Illegal quoting error"? -

i'm driving myself slight crazy one. i trying import csv file: uploaded_io = file.read("amazon_import.csv") fastercsv.parse(uploaded_io, {:headers => true, :quote_char => '"', :col_sep => "\t"}).each |row_data| new_record = amazonsale.new( 'asin' => row[0], 'title' => row[1], 'barcode' => row[2].match(/\d+/), 'price' => row[4], 'discount' => row[5], 'cost' => row[7], 'active' => row[8], 'product_group' => row[9], 'release_date' => row[10], 'customer_ordered_units' => row[11], 'shipped_units' => row[12], 'shipped_date' => date.today - 1, 'shipped_cogs' => row[14], 'sellable_on_hand_units' => row[15], 'unsellable_on_hand_units' => row[16], 'customer_owned' => row[17], 'total_inventory_uni...

backbone.js - Backbone View returns as a string: function (){ return parent.apply(this, arguments); } -

good day. have next problem. router request view returned "function (){ return parent.apply(this, arguments); }" , have no access methods. router.js: // filename: router.js define([ 'jquery', 'underscore', 'backbone', 'views/page/pageview' ], function($, _, backbone, pageview){ var approuter = backbone.router.extend({ routes: { "": "index", "page": "page" }, index: function() { //console.log(pageview); pageview; }, page: function() { alert("page");//welcomeviewinstance.render(); } }); initialize = function(){ var approuterinstance = new approuter(); backbone.history.start(); }; return { initialize: initialize }; }); view.js: define([ 'jquery', 'underscore', 'backbone...

python 3.x - How do you set up formatting in vim? -

earlier, when used open .py files in vim on ubuntu, formatted, separate colours separate segments of program. now, when using vim on ubuntu, text in .py file appears black. how can correct this? check man vim . in nutshell, find copy of vimrc file, 1 might under /usr/share/vim/ subtree. may named vimrc_example.vim . copy home directory , rename .vimrc .

python - How to use extra arguments passed with Variable file - Robot framework -

in robot framework user guide there section describes how pass variable files , possible variables if needed. example: pybot --variablefile taking_arguments.py:arg1:arg2 my question can use these possible variables arg1 , arg2 in taking_arguments.py file afterwards , if can how? right have this: pybot --variablefile taking_arguments.py:arg1:arg2 taking_arguments.py contents: ip_prefix = arg1 but results in nameerror: name 'arg1' not defined the way use variables in argument file using --variablefile filename.py:arg1:arg2 syntax have variable file implement function get_variables . function passed arguments specify on command line, , must return dictionary of variable names , values. for example, consider following variable file, named "variables.py": def get_variables(arg1, arg2): variables = {"argument 1": arg1, "argument 2": arg2, } return variables this file creates 2 r...

c++ - How to Show Bangla Font(UTF-8) in QTextBrowser / QTextEdit? -

when try output bangla text, turns out in empty box without showing bangla/unicode properly. tried this, it's not showing correctly ui->textbrowser->settext("কেন কেন")); ui->textedit->settext("হয় না ক্যান???")); first, go qtcreator's properties ->text editor->behavior->file encodings , set "default encoding" "utf-8". second, write this: ui->textbrowser->settext(qstring::fromutf8("কেন কেন"))); ui->textedit->settext(qstring::fromutf8("হয় না ক্যান???"))); third, forget wrote , use qt's translation system .