Posts

Showing posts from June, 2010

javascript - jQuery validation on dropdown and form repeater -

i've got form wizard form repeater , need validate dropdown before accessing next step. i've tried different solutions , managed validation on first form doesn't work repeated form. javascript code if ($("body").data("title") === "admin_new_user") { var formwizard = function () { return { //main function initiate module init: function () { if (!jquery().bootstrapwizard) { return; } var form = $('#submit_form'); var error = $('.alert-danger', form); var success = $('.alert-success', form); // regex pe rla validazione del campo email $.validator.methods.email = function( value, element ) { return this.optional( element ) || /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0...

python - Timestamp with utc and any other timezone is coming out to be same with arrow -

import arrow print arrow.utcnow() print arrow.utcnow().timestamp print arrow.utcnow().to('asia/kolkata') print arrow.utcnow().to('asia/kolkata').timestamp i need timestamp (in int) of 'asia/kolkata' timezone, +5:30 utc. arrow.utcnow() , arrow.utcnow().to('asia/kolkata') coming out different , second 1 +5:30 first, expected. however, arrow.utcnow().timestamp , arrow.utcnow().to('asia/kolkata').timestamp still coming out same. i sure missing basic here, can explain this? i think "timestamp", definition, in utc: the unix time (or unix epoch or posix time or unix timestamp) system describing points in time, defined number of seconds elapsed since midnight proleptic coordinated universal time (utc) of january 1, 1970, not counting leap seconds. if take localized time string, convert utc date time (that is, 5pm kolkata time becomes 5pm utc), can timestamp corresponds local clock time. example: i...

debugging - Attach debugger to ASMX service on Azure app service -

Image
i have old service have deployed azure using app service (type: web app). publish asmx direct visual studio 2015 professional. works accept cannot attach vs 2015 pro debugger instance of asmx. i have set correctly (so think) in azure , deploying debug configuration: but when attach debugger vs - no errors shown, appears successful until set new breakpoint, (i have confirmed attached w3wp.exe): i "hollow" breakpoint , error: the breakpoint not hit. no symbols have been loaded document. i error is, don't how can attach debugger asmx service on azure? is attaching debugger asmx on azure not supported? figured out. despite looking attached, wasn't. had go debug > attach process > , specify website. using remote debugging option on both cloud explorer , server explorer not work in scenario. for better walk through: https://msdn.microsoft.com/en-us/library/dd434211(v=vs.100).aspx the real issue: azure not play nice < ....

python - pandas minute data column to 60 minute columns -

i've seen related topics using transposition or pivot, can't make work. i've got data frame 2 columns, timestamp , minute-like data. i want transpose data frame end 61 columns, follows; old df looks like date value 0 2017-01-01 16:45 12 1 2017-01-01 16:46 22 ... ... n 2017-03-01 11:45 12 i want new df be dayhour ... minute45 minute46 ... 0 2017-01-01 16 ... 12 22 ... ... ... ... ... ... n 2017-03-01 11 ... 12 ... ... i somehow managed via groupby , loop on 60 minutes, wonder if there more compact way of doing this. you can create new columns dayhour , minute , pivot table. df.assign(dayhour = df.date.dt.floor('h'), minute=df.date.dt.minute)\ .pivot(index='dayhour', columns='minute', values='value')\ .add_prefix('minute') ...

Sketch layout to android XML -

Image
i have created simple cardview in sketch , want insert inside android-studio. options have? can export sketch , import android-studio or have redesign xml or java code? make png , use in android project. or make redesign in xml .

ios - How to add a floating button in UITableViewController which does not scroll when table is scrolled? -

currently there uitableviewcontoller many sections , rows. what best way add button floats on top of table view. button should not scroll when cells scrolled. currently have following code , button still scrolls: override func viewdidload() { super.viewdidload() self.view.addsubview(viewforfooter) } the viewforfooter separate view contains button needs floating. thank you. appreciated. here option if don't want use uiview subviews... override func viewdidload() { super.viewdidload() if let app = uiapplication.shared.delegate as? appdelegate, let window = app.window { print("adding view-with-button keywindow") window.addsubview(viewforfooter) viewforfooter.topanchor.constraint(equalto: window.topanchor, constant: 120).isactive = true viewforfooter.leftanchor.constraint(equalto: window.leftanchor, constant: 40).isactive = true } // other stuff... } this add view subview of "keywindow...

Why Google sitelinks does not work with my WordPress website? -

i have xml in wordpress root directory few months now: <?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://example.com/</loc> <lastmod>2017-08-10</lastmod> <changefreq>monthly</changefreq> </url> <url> <loc>https://example.com/about</loc> <lastmod>2017-08-07</lastmod> <changefreq>monthly</changefreq> </url> <url> <loc>https://example.com/portfolio</loc> <lastmod>2017-08-07</lastmod> <changefreq>monthly</changefreq> </url> <url> <loc>https://example.com/contact</loc> <lastmod>2017-08-07</lastmod> <changefreq>monthly</changefreq> </url> </urlset> but do...

hadoop - Hive Could not set permission for staging directory -

my hive job fails below error set exec directory , scratch directory before run job , not sure why default properties not getting updated. set hive.exec.scratchdir=/domain/usecase/warehouse/hive_scratch_tmp; set hive.exec.stagingdir=/domain/usecase/warehouse/.staging; exception: 17/09/13 11:30:42 [thread-126]: error mr.execdriver: yarn java.io.ioexception: not set permission /var/mapr/cluster/yarn/rm/staging/usecase/.staging/job_1503499283269_761069/job.jar @ com.mapr.fs.maprfilesystem.setpermission(maprfilesystem.java:2100) @ org.apache.hadoop.mapreduce.jobresourceuploader.copyjar(jobresourceuploader.java:248) are there other property need set? thanks there similar issue here , property using. try below configuration property in hive shell override hive-mapreduce stage directory. use full uri yarn.app.mapreduce.am.staging-dir http://doc.mapr.com/display/mapr/default+mapred+parameters

ios - show UIView with an overlay -

in app, have uiview uibutton in it. now, when user touches button, i'd blurred overlay appear uiview in it. added code below in uiview subclass that: uiblureffect *blureffect = [uiblureffect effectwithstyle:uiblureffectstylelight]; self.overlay = [[uivisualeffectview alloc] init]; [self.overlay setframe:[[uiscreen mainscreen] bounds]]; cgrect newframe = [self convertrect:self.bounds toview:self.overlay]; nslog(@"newframe.origin.x: %f", newframe.origin.x); nslog(@"newframe.origin.y: %f", newframe.origin.y); self.frame = newframe; nslog(@"self.frame: %f", self.frame.origin.x); nslog(@"self.frame: %f", self.frame.origin.y); [self.overlay.contentview addsubview:self]; nslog(@"self.frame: %f", self.frame.origin.x); nslog(@"self.frame: %f", self.frame.origin.y); self.frame = newframe; [self.overlay.contentview addsubview:self.dropdown]; [[[uiapplication sharedapplication] keywindow] addsubview:self.overlay]; [uivie...

django rest framework - created new custom user model, having error while inserting values -

i developing app in angular , django. backend developing backend in django rest_framework. , have written custom user model because have own field used in app. while sending json data api, getting error while saving data. i wrote own manager.py, getting error while inserting data database exception type: keyerror exception value: 'groups' exception location: /home/mayur/documents/codematrix/backend/venv/lib/python3.5/site-packages/rest_framework/fields.py in get_attribute, line 101 code here models.py class user(abstractbaseuser, permissionsmixin): email = models.emailfield(_('email address'), unique=true) first_name = models.charfield(_('first name'), max_length=30, blank=true) last_name = models.charfield(_('last name'), max_length=30, blank=true) date_joined = models.datetimefield(_('date joined'), auto_now_add=true) objects = usermanager() username_field = 'email' required_fields = [] class meta: ...

node.js - Creating a project with react front end and nodejs backend -

i have create react project front-end , backend nodejs , want send json data react front end nodejs backend , cet other data react. okay, have been better if you'd started google, get this: https://scotch.io/tutorials/react-on-the-server-for-beginners-build-a-universal-react-and-node-app

cmd - Input form for batch with HTA -

Image
how can make simple input form in hta , read batch in simple variable, , button proceed. don't know other way make decent gui batch file. this any appreciated. in short, need is get reference standard output stream inside .hta file , write output content of field execute .hta batch file using for /f command process data sent standard output. the "problem" need explicitly call mshta.exe executable full path .hta file. serialnumber.hta <html> <head> <hta:application id = "serialhta" applicationname = "serialhta" version = "0.1" navigable = "yes" showintaskbar = "yes" singleinstance = "yes" windowstate = "normal" border = "normal" borderstyle = "normal" inn...

reporting services - The ConnectionString property has not been initialized. SSRS -

an admin account ssrs password changed encryption key had problem , no longer getting encryption error. when try access reports prompted again creds datasource. creds use access report doesn't work datasource. 'an error has occurred during report processing. (rsprocessingaborted) cannot create connection data source 'xxxxx'. (rserroropeningconnection) connectionstring property has not been initialized. if try delete folder or edit datasource 'could not connec server. please check network settings , tray again later. the problem chrome , using report manager. creds cache/saved , when in chrome not make changes, deletions or adds. went firefox never used connect report manager , allowed me create new shared datasource , point reports them. after issue gone.

android - Recyclerview Horizontal span and spacing issues -

Image
so im trying achieve, recycler view 3x3 grid , when items exceed 3x3 ,they spill next screen/page. so ive used recyclerview horizontal scrolling this ive achieved far and current code work when count of items 7 , above. when count below 7 im facing issues need help. listing issues questions question 1: why recyclerview items populated in vertical fashion? 1 4 2 5 3 6 i've set recyclerview scroll horizontally, new gridlayoutmanager(this, span, gridlayoutmanager.horizontal, false); question 2: when item count 6 , how avoid space between rows? question 3: when items 4 ,i want show items 1 2 3 4 or 1 3 4 2 currently shows if set span 1,ill have grid as 1 2 3 4 causing 4 go off-screen so 1 2 3 |4 which want avoid. ============== code ive used layout: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=...

c++ - Why is the contents of the vector being printed wrong here? -

Image
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int test=0; vector<int>v{1,2,3}; for(auto i=v.cbegin();i!=v.cend();++i) { ++test; if(test==2) { v.push_back(4); } cout<<*i<<endl; } return 0; } i expected output 1 2 3 4 received output shown below: the push_back can change begin , end iterators if new item doesn't fit in vector-capacity (the internal size). in example push_back implies reallocation of internal buffer , begin , end iterators new values. problem in example end-iterator evaluated each step , gets new value begin iterator still keeping old(invalid) value , causes undefined behavior. following changes illustrate happens: #include<iostream> #include<string> #include<vector> using namespace std; int main() { int test=0; vector<int>v{1,2,3}; for(auto i=v.cbegin();i!=...

amazon rds - Unable to restore SQL Server bak file from S3, says file too large -

i'm trying run restore query bak file stored in s3 bucket rds sql server web edition, , kept getting error: [2017-09-13 20:30:22.227] aborted task because of task failure or concurrent restore_db request. [2017-09-13 20:30:22.287] there not enough space on disk perform restore database operaton. the bak file 77 gb , db has 2tb, how come still not enough? this query aws docs: exec msdb.dbo.rds_restore_database @restore_db_name='database_name', @s3_arn_to_restore_from='arn:aws:s3:::bucket_name/file_name_and_extension'; source: http://docs.aws.amazon.com/amazonrds/latest/userguide/sqlserver.procedural.importing.html#sqlserver.procedural.importing.native.using there not enough space on disk perform restore database operaton. ... the bak file 77 gb , db has 2tb, how come still not enough? you need 2tb of space able restore backup. the fact restore operation reconstruct original database 2tb. backup ...

url - Browser caching the 404 error status responses is not working properly -

i tried use browser cache 404 errors , have found few weird scenarios. when type in url "testsite.com/testblabla.png", getting 404 response e-tag , when refresh same browser tab not using browser cache if open same url in new tab getting browser cache. weird, firefox not using browser cache 404 status @ all. guys, please let me know if face same issues.

javascript - Update applicationBadgeCounter dynamically on IOS -

i'm using react-native , i'm trying update badge counter each time new remote notification gets phone. im using package 'react-native-push-notification' https://github.com/zo0r/react-native-push-notification how can that? here pushconfig file: import react, {component} 'react'; import pushnotification 'react-native-push-notification'; export default class pushcontroller extends component{ componentdidmount(){ pushnotification.configure({ onnotification: function(notification) { console.log( 'notification:', notification ); datamio= notification console.log( 'datamio:', datamio ); }, requestpermissions: true, permissions: { alert: true, badge: true, sound: true }, onregister: function(token) { console.log( 'token:', token ); tokenmio=token }, }); ...

How can I add a restriction like clients can't add elements to Redis List if size of the redis list is greater than number? -

my use case redis client should not allowed add new elements in redis list if size of redis list greater number. basically, want make bounded list. i can 2 redis commands. first, execute llen command length of list , allowed add element if length not maxed. can using 1 command (atomic operation) instead of two?

c# - Unity Multiplayer Car : networking particles and sound -

i making unity game player controlling car , want game multiplayer. using standard assets' vehicule package car. the structure of default car prefab controls separated between "user control" script handles user inputs, , "car controller" handles physics ( movements, acceleration, turning, steering etc). you can find below sources of 2 scripts, modified carusercontrol.cs networking. networking position not problem , works fine (i attached networktransform component car , networktransformchild wheels). the thing car controller script handles particle effects when car steering (smoke generated , steering track appears), , sounds (acceleration, steering, skidding), , have absolutely no idea on how network that... so right have multiplayer car movement, local car generates steering/skidding tracks, smoke, , sounds. any idea on how it? sources: modified caruserinput.cs : added networkbehavior instead of monobehavior , added islocalplayer check ...

http - Preflight request not being handled by apache (CORS) -

general: request url:x/site.php request method:options status code:302 found remote address:x.x.x.x:80 response headers: view source access-control-allow-headers:content-type access-control-allow-origin:* access-control-max-age:300 cache-control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0 content-length:0 content-type:text/html; charset=utf-8 date:thu, 02 mar 2017 14:27:21 gmt expires:thu, 19 nov 1981 08:52:00 gmt location:y pragma:no-cache server:apache/2.4.25 (ubuntu) request headers: view source accept:*/* accept-encoding:gzip, deflate, sdch accept-language:en-us,en;q=0.8 access-control-request-headers:authorization access-control-request-method:post cache-control:no-cache connection:keep-alive dnt:1 host:x origin:http://127.0.0.1:3000 pragma:no-cache referer:http://127.0.0.1:3000/ user-agent:mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/54.0.2840.90 safari/537.36 apache virtualhost config looks so: <ifmodule mod...

c++ - putting a code-block-like control from App Inventor in desktop app -

Image
i'm trying make simple program allows click , drag item 1 window, child window, another, parent window. it's going game level editor of sorts i'm working on video game need school project. have months it, i'm in no rush. the thing i'm curious how i'll item child window parent window during runtime. can have buttons in child window place objects in parent window. original idea - having drag , drop functionality isn't necessary. want know if can images, in format similar app inventor - how writes code in background while fiddle around building window, placing various blocks down. version app inventor, it's in desktop application , there no words, pictures. does winapi have control built in? if so, love know name or find information it. i'm not sure how begin search that, except site. my original idea use picturebox controls, i'd either have litter entire window them , allow user click , drag them "move" them around while sets ...

googletest - Google Test is not finding my user defined stream operator -

i've tried making minimal working example, haven't been able make issue show within mwe, i'll describe problem , has run across before. i did see teach google-test how print eigen matrix seems similar issue, not quite because i'm not using custom matcher or templates. my issue types (std::chrono, enum class s:i:ssk, etc), when google mock assertion fails, doesn't find correct stream operator , defaults byte dump. e.g. assert_that(st, eq(s::i::sk::required)); generates output: test.cpp(262): error: value of: st expected: equal 4-byte object <02-00 00-00> actual: 4-byte object <03-00 00-00> (of type enum s::i::sk) however, if provide additional output chaining stream operators so: assert_that(st, eq(s::i::sk::required)) << "expected: " << s::i::sk::required << " received: " << st; i this: test.cpp(262): error: value of: st expected: equal 4-byte object <02-00 00-00> actual: 4-byte...

reload / autoload module in jupyter notebook with julia kernel -

in jupyter python kernel, there nice reloading feature ( %load_ext autoreload %autoreload 2 ) re-import saved changes notebook's imported sub-modules (as seen here ). how can julia kernel? is, how can re-include myfile.jl automatically each time save myfile.jl , in: using dataframes include("myfile.jl") ...automatically reload... i tried using reload("myfile.jl") command here , didn't seem work me.

python - When I try to sum csv file using pandas it does not work -

i new pandas , try sum csv file. have created csv has country , count column , use pandas sum total count of each country. not sure csv format wether converted correctly or not. code import pandas pd df =pd.read_csv ("/users/mani/desktop/finalgeocount.csv") print df.groupby(['country']).sum() this raw csv file data country count china 1 china 1 china 1 china 2 ireland 1 china 3 moldova 1 i need output this: china 8 ireland 1 moldova 1 but output showing below: unnamed: 2 unnamed: 3 unnamed: 4 country albania nan nan nan algeria nan nan nan angola nan nan nan anguilla nan nan nan the raw data you've posted tab delimited, form of csv. when reading fil...

java - Unit testing encrypt/decrypt with some salt located in different code bases -

first of shall mention have seen unit testing of encrypt/decrypt , , unit testing encryption , decryption in java . i want protect library validating license. license contains information such maximum users , expiration time , on. the problems encounter are: the encryptor , decryptor in 2 different code bases. decryptor packaged library, encryptor not, hard have them both in same test suite! a random salt used within encryptor, same input encryptor produces different output each time, again can not assertion on result. for sake of purpose decryptor (to make harder inject class it) final class, , of methods private, except few package accessible entry points. i don't want test jce, want test code does: extracting salt encrypted license, deciphers encrypted license, deserializes output data structure containing license data, shall create clone of the code, softer access constraints , test that? problem not testing real code run on client systems. are there b...

c++ - already defined in persontype error -

i keep error saying membershiptype functions declared created in persontype class wondering how fix error first error message says membershiptime::membershiptype defined in person type object not,and second error message says second construcor defined in persontype how fix error? #include <iostream> #include <string> using namespace std; class addresstype { //class defintions , prototypes member variables public: addresstype(); string streetaddressnum, streetname, streettype, city, stateinitials; int zipcode; }; class persontype { public: persontype(); string firstname; string lastname; int personnum; char gender; int personid; addresstype address; void setinterest1(string interest1);//mutator void setinterest2(string interest2); void printperson(); string getinterest1() const; // accessor string getinterest2() const; private: string setinterest1; string setinterest2; }; //define membershiptype...

algorithm - How to optimise storage size and performance when generating a large list of sequences in python? -

problem i generating possible sequences of form, given integer n: the sequence has length n the sequence must contain numbers n , n-1 , n-2 , ... , n-k ≥ 1 k < n . numbers can repeated. for example, n = 3 , possible sequences are: 1, 2, 3 1, 3, 2 2, 1, 3 2, 3, 1 3, 1, 2 3, 2, 1 2, 2, 3 2, 3, 2 3, 2, 2 2, 3, 3 3, 2, 3 3, 3, 2 3, 3, 3 in other words, sequence must contain n , numbers counting down n without jumps, in no particular order , repetitions allowed. given n , number of such sequences given ordered bell numbers or fubini numbers, grow extremely fast. here code using generate sequences: from sympy.utilities.iterables import multiset_permutations def generate_sequences(n): sequences = [] unpermuted_seq in unpermuted_sequences(n,n): permutation in multiset_permutations(unpermuted_seq): sequences.append(permutation) return sequences def unpermuted_sequences(number,remaining_slots): # generates list of possible unpermut...

What is the purpose of @Rule in Android Espresso UI Test? -

new android unit testing espresso, under @rule, purpose of creating member variable? name of variable matter? inkling need tell test unit activity (or service, class) i'm testing, variable , scope used anywhere need care about? @rule public activitytestrule<menuactivity> mactivitytestrule = new activitytestrule<>(menuactivity.class); after doing more practice , reserach android ui testing espresso, got many of use cases @rule variables. of of testing idling resources (view , data happen async). using activitytestrule object (ex. mactivitytestrule) can reference resources, fire public methods tag @visiblefortesting in class. ex. // in activity @visiblefortesting @nonnull public simpleidlingresource getmsimpleidlingresource() { if (msimpleidlingresource == null) { msimpleidlingresource = new simpleidlingresource(); } return msimpleidlingresource; } // in test class // test run....

java - How to send a title in Forge 1.12.1 -

my current way of sending titles player placing redstone torch next command block (which contains title commands), not work: blockpos blockpos = new blockpos(675, 236, 457); iblockstate iblockstate = world.getblockstate(blockpos); material material = iblockstate.getmaterial(); world.setblockstate(blockpos, blocks.redstone_torch.getdefaultstate(), 1);

express - Keep getting this error: Error: Route.post() requires callback functions but got a [object Undefined] -

i trying set react express application mongo db database. in preliminary stages , keep coming across error: error: route.post() requires callback functions got [object undefined] here app.js const express = require('express'); // const http = require('http'); const bodyparser = require('body-parser'); const morgan = require('morgan'); const app = express(); const mongoose = require('mongoose'); mongoose.promise = global.promise; //db , name auth mongoose.connect('mongodb://localhost/auth', { usemongoclient: true, /* other options */ }); // app setup //server setup const port = process.env.port || 4000 // const server = http.createserver(app); app.listen(port); console.log(`sever listening on ${port}`) const authroutes = require('./routes/auth_routes'); app.use('/',authroutes); my routes right here. testing see if there correct connection. const authcontroller = '../controllers/auth_con...

ruby watir - get all divs inner contents from search -

i attempting scrape website (respectfully). tried nokogiri, mechanize, because website scraping loading form dynamically, forced use webdriver. using ruby's watir. what trying do, fill out dynamic form select , clicking submit, going results part of page (form renders result on same page), , collecting divs information (traversing through sub-divs looking hrefs). def scrape browser = watir::browser.new browser.goto 'http://www.website-link.com' browser.select_list(:id => 'city').select('cityname') browser.link(:id, 'btnsearch').click # part; results search in div w/ id # however, iterating through list not work way expected browser.div(:id, 'resultsdiv').divs.each |div| p div end browser.close end right returns #<watir::div: located: true; {:id=>"resultsdiv", :tag_name=>"div"} --> {:tag_name=>"div", :index=>0}> #<watir::div: ...

node.js - Get random line from .txt file then remove the line from .txt file -

need on one. i'm creating discord bot in node.js. what do: read random line local .txt file. then forward discord (i know how) then delete exact line got, local .txt file. almost array. but, local one, can fast edit. i'm still new node , javascript, learn trying , reading, got stuck here, that's why need professional :-) chart hope made understand problem, , can me. i have following: let fs = require('fs'); let randomnumber = fs.readfilesync('./resources/array.txt').tostring().split("\n"); let item = randomnumber[math.floor(math.random() * randomnumber.length)]; which outputs random number file. as long file isn't big , isn't being appended during running of script, take data, store in memory, make change array, remove data text file, , rewrite data array file const fs = require('fs'); // use const ** const data = fs.readfilesync('./array.txt'); const splitdata = data.split(...

javascript - not able to get result length from ms crm web api call output in js -

below code snippet. trying fetch referenced entities manytoone relationship of annotation entity. in result, able object when i'm trying length of it, giving "undefined". please provide valuable suggestions on , how can assign referenced entity variable result. or is there possibility retrieve entities associated annotation entity, using web api call ( dynamics 365). function fetchit() { var req = new xmlhttprequest(); var webapicall = xrm.page.context.getclienturl() + "/api/data/v8.2/entitydefinitions(logicalname='annotation')?$select=logicalname&$expand=manytoonerelationships($select=referencedentity)"; req.open("get", webapicall, true); req.setrequestheader("odata-maxversion", "4.0"); req.setrequestheader("odata-version", "4.0"); req.setrequestheader("accept", "application/json"); req.setrequestheader("content-type", ...

vb.net - Best data structure to store key value pairs when the following operations are required -

i need store list of key value pairs. key value pair used multiple classes, ideally list of structure define. public structure person public id integer public weight decimal end structure 'all use person class census class importpeople class determinebestdiet etc i need sort value i need remove person (by person.id) or add new key value pair (and re-sort after each add) i need sum total of values seems people use dictionaries , hack around. you can use list<person> work using list.sort method: thelist.sort(function(x, y) x.age.compareto(y.age)) using orderby extension method: thelist = thelist.orderby(function(x) x.age).tolist() details can see post: https://stackoverflow.com/a/11736001/1050927 just remove list , call sort or orderby . depends on want do, can use orderby skip , take specific nth person after sort. just sum it personlist.sum(function(per) per.weight) and believe dictionary can same too, ca...

datetime - Find objects between two dates MongoDB -

i've been playing around storing tweets inside mongodb, each object looks this: { "_id" : objectid("4c02c58de500fe1be1000005"), "contributors" : null, "text" : "hello world", "user" : { "following" : null, "followers_count" : 5, "utc_offset" : null, "location" : "", "profile_text_color" : "000000", "friends_count" : 11, "profile_link_color" : "0000ff", "verified" : false, "protected" : false, "url" : null, "contributors_enabled" : false, "created_at" : "sun may 30 18:47:06 +0000 2010", "geo_enabled" : false, "profile_sidebar_border_color" : "87bc44", "statuses_count" : 13, "favourites_count" : 0, "description" : "", ...