Posts

Showing posts from July, 2010

javascript - Unit testing html label -

i have label populated through angular data binding: <label class="my-heading">{{mybinding}}</label> returns: <label class="my-heading">some value</label> how can write unit test confirm value within label i.e some value if mock binding?

Is it possible to configure an NServiceBus endpoint (on Azure transport) to accept a simple string as input? -

we have nservicebus endpoint monitors azure service bus queue (using azure transport). not clients send messages queue .net-based. can nservicebus endpoint configured accept simple string input? i've tried intercepting messages class implements imutateincomingmessages, @ point deserialization azure transport has failed. i can inspect message coming in in class implementing imutateincomingtransportmessages, i'm not sure if right place. what best way configure nservicebus handle message being published in following format (keep in mind can come via java or node sdks, or via azure rest endpoint): var brokered = new brokeredmessage("this plain string represents data."); queueclient.send(brokered); deserialization of message fail, because contains string, not byte array expected azure transport deserializer. ps: know possible expose endpoint wcf service, have nservicebus.host processes pull queue , wcf solution not feel right solution me. as m...

Terminate python based on printed output -

in here, limit tweepy stream specific number , tried stop streaming script using tweepy kept getting error. tried fixing error people may have suggested no luck. i thought of method of possibly terminating script based on number of printed outputs. did take previous code , put function: def streamer(location): ## same code here ## twitterstream.filter(locations=[\location) ## changed match function## then call function (i.e. streamer(la) ) la predefined set of coordinates. my question: possible terminate function streamer based on number outputs without changing function (due persisting error)? you use quit() terminates whole session. you need add streamdata variable somewhere. if correct constant stream of json items, add them list , use length of list. use twitterstream.disconnect() if got amount of outputs.

php - Email body is blank when receiving it in GMAIL - Swiftmailer -

Image
i have been having issue, since started using swiftmailer. know new @ might doing wrong. appreciated. issue is: receive blank body in gmail receive expected in outlook/yahoo. i not sure issue is. in advance answering. here call function send email attributes $subject = "croct admin - evaluate performance of participant project - '".$result2['project_name']."'"; $from = array('test@test.com' => 'tasty'); $to = $result4[$i]['email']; $body = 'hello, have got invitiation participate work in project '.$result2['project_name'].' accept invitation , start participating in it.' .anchor('https://example.org/'.$project_id_url.'/'.$result4[$i]['user_id'], 'accept invitation'); $addpart = 'best,team croct'; $this->**send_email($subject, $from, $to, $body, $addpart)**; here function send_mail function send_email($subject, $f...

java - Unsupported major.minor version 52.0 Error -

this question has answer here: unsupported major.minor version 52.0 [duplicate] 26 answers i have codes compiled on jdk 1.8. created war file , deployed on tomcat8 in ubuntu server running jre 1.8. have error when opening main page: java.lang.unsupportedclassversionerror: com/dash/io/web/bind/homectrl : unsupported major.minor version 52.0 $ java -versionjava version "1.8.0_45" java(tm) se runtime environment (build 1.8.0_45-b14) java hotspot(tm) 64-bit server vm (build 25.45-b02, mixed mode) $ javac -version javac 1.8.0_45 $ echo $jre_home /usr/local/java/jdk1.8.0_45/jre $ /usr/local/apache-tomcat-8.0.22/bin/catalina.sh version using catalina_base: /usr/local/apache-tomcat-8.0.22 using catalina_home: /usr/local/apache-tomcat-8.0.22 using catalina_tmpdir: /usr/local/apache-tomcat-8.0.22/temp using jre_home: /usr/local/java/jdk1.8....

javascript - Regular expression for email id to avoid email input in a textfield -

problem : having textarea in want restrict users entering email id. so,that when type email id text area should turn red , pop-up message saying "you can't enter email address in field". my solution: here simple html code textarea: <textarea class="replytoclient" placeholder="message"></textarea> i using below mentioned javascript code detect email id , replace null. <script type="text/javascript"> //email id detection , replacemnet $(function() { $(".replytoclient").change(function() { $(this).val( function(idx, val) { return val.replace(/\b(\w)+\@(\w)+\.(\w)+\b/g, ""); }); }); }); </script> what replaces "example@gmail.com" written in textarea blank. expectation: trying build strong regexp here can detect email id in form such "example@gmail" or "e...

wpf - Change TabItem's Header FontWeight -

i change tabitem 's header fontweight bold when isselected = true resourcedictionary . some code <setter property="template"> <setter.value> <controltemplate targettype="{x:type tabitem}"> <grid> <border name="border" background="white" borderbrush="white" borderthickness="1,1,1,0" margin="0,0,0,-1" > <contentpresenter x:name="contentsite" height="25" verticalalignment="bottom" horizontalalignment="center" contentsource="header" ...

linux - How to control the thread of child process -

i'm trying implement following function in debugger: want use debugger control thread in process being debugged. debugger parent process , uses ptrace() function debug child process, don't know how control thread (other main) of child process parent process. want make target thread halt or continue. there way this? code below #include<pthread.h> #include<stdio.h> void *runner(void *param); int main(int argc,char *argv[]) { int pid; pthread_t tid; pthread_attr_t attr; pid=fork(); if(pid==0){ pthread_attr_init(&attr); pthread_create(&tid,&attr,runner,null); pthread_join(tid,null); printf("child value=%d",value); } else if(pid>0){ wait(null); printf("parent value=%d",value); } } void *runner(void *param){ int count = 0; while(1) { printf("%d\n",count); count++; sleep(1); } pthread_exit(0)...

ios - How to retrieve Parse object created by a User -

user i'm integrating parse in application , @ point have login function , running. i'm trying understand/learn how create , connect objects in class unique current logged in user , how retrieve objects. so need figure out. found this question , it's same thing want achieve can't figure out "connection" speak, , if need add parameters user class and/or object class want retrieve from. so simplicity let's have logged in user unique objectid has been created parse user class. when i'm logged in this: pfobject *list = [pfobject objectwithclassname:@"lists"]; list[@"name"] = @"my list"; [list saveinbackgroundwithblock:^(bool succeeded, nserror *error) { if (succeeded) { // object has been saved. nslog(@"success"); } else { // there problem, check error.description nslog(@"fail"); } }]; the list created , stored ...

arraylist - Adding a RadioButton to a itemView adapter within a ListView -

i wonder if can , please? this code below listview adapter enable single itemview works well. iam able show adapter barcode number , time of item read barcode reader in listview. my question how add radio button each item ? public view getview(int position, view convertview, viewgroup parent) { inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); map<string, object> result = arrayc.get(position); textview txttime; textview txtbarcode; view itemview = inflater.inflate(r.layout.bay_items, parent, false); txtbarcode = (textview) itemview.findviewbyid(r.id.barcodelbl); txtbarcode.settextcolor(color.blue); txttime = (textview) itemview.findviewbyid(r.id.timelabel); txttime.settextcolor(color.blue); if (result.get("warehouse").tostring().equals("1")) { view warehouse = itemview.findviewbyid(r.id.bayscan); warehouse.setbackgroundcolor(color.yello...

java - Joda api not return proper islamic date -

i converting gregorian dates islamic dates. setting leap year pattern indian leap year not working. i make loop , gregorian date takes current month , count days , convert islamic date. what want here code for(int i=0;i<maxday;i++) { eng.add(string.valueof(i+1)); datetime dtiso=new datetime(currenty,currentmonth+1,i+1,0,0); datetimezone asia= datetimezone.forid("asia/riyadh"); datetime dtislamic = dtiso.withchronology( islamicchronology.getinstance( asia, islamicchronology.leap_year_indian)); string islamicdatearr=""; split=dtislamic.tostring().split("t"); split=split[0].split("-"); if(i==0 || integer.parseint(split[2])==1) { isl.add(string.valueof(split[2]+" "+islamicmonths[integer.parseint(split[1])-1]))...

unit testing - Can I pass type parameters to a testcase in DUnitx? -

i'm writing testcases fastcode project. i've written generic tester so: ttest<t> = record private class var def: system.generics.defaults.icomparer<t>; class var f: fastdefaults.tcomparison<t>; strict private class function slow(const left, right: t): integer; static; class function fast(const left, right: t): integer; static; class constructor init; public class procedure test(const left, right: t); static; end; a typical test case looks like: [test] [testcase('single', '100.0,100.0')] ...many more testcases... procedure testsingle(const l,r: single); [test] [testcase('double', '100.0,100.0')] ...many more testcases... (identical 1 above). procedure testdouble(const l,r: double); the testing code typically follows (repeated every single type): procedure testdefault.testsingle(const l, r: single); begin ttest<single>.test(l,r); end; what do: [test] [testtypes('si...

unit testing - readable substitution of IEnumerable of Interfaces -

i have following interfaces public interface iribboncommandsprovider { ienumerable<iribboncommand> getribboncommands(); } public interface iribboncommand { string group { get; } string tab { get; } string name { get; } string image { get; } void execute(); } and follwing substitution code: public class tabsviewmodeltests { [fact] public void initialize_buildscorrectribbontree() { var commands = substitute.for<iribboncommandsprovider>(); commands.getribboncommands().returns( new[] { new ribboncommand { tab = "tab1", group = "group1", name = "name1" }, new ribboncommand { tab = "tab1", group = "group1", name = "name2" }, new ribboncommand { tab = "tab2", group = "group1", name = "name3" }, new ribboncommand { tab = "tab2", group =...

python - How to use cocos2d's collision_model -

recently, used cocos2d python make game. had trouble collision_model . read documentation still can't use collisionmanager add collidablesprite in example . in fact, had change actorsprite collidablesprite avoid error. problem be? import cocos.euclid eu import cocos.collision_model cm class collidablesprite(cocos.sprite.sprite): def __init__(self, image, center_x, center_y, radius): super(actorsprite, self).__init__(image) self.position = (center_x, center_y) self.cshape = cm.circleshape(eu.vector2(center_x, center_y), radius) class actormodel(object): def __init__(self, cx, cy, radius): self.cshape = cm.circleshape(eu.vector2(center_x, center_y), radius) the documentation showed example initialising collidable sprite. actorsprite come from? have change collidablesprite make class work. , state collision manager add sprites. returns none when call function collisionmaneger.known_objs() . def __init__(self): super(...

Specify the SELECT and use the built in mechanism for the WHERE in Rails 3 -

is possible ( rails 3 ) specify select part of rails query, , use regular in order write conditions? something like: model.find_by_sql("select blah blah table1 join table2 on...").where([conditions, params]) i think looking for: model.select('table_name1.field1, table_name2.field2') .joins('join table_name2 on (table_name2.table_name1_id = table_name1.id)') .where([conditions, params])

Importing C library into Xamarin console project -

Image
so have simple project possible. entire thing looks like: main.c #include "main.h" int testdejef(int i) { return i+1; } main.h #ifndef __main_h__ #define __main_h__ int testdejef(int i); #endif program.cs using system; using system.runtime.interopservices; namespace testclib { class mainclass { [dllimport("libclibjef.a",entrypoint="testdejef")] private static extern int testdejef(int i); public static void main (string[] args) { console.writeline (testdejef (1).tostring ()); } } } based on various xamarin examples on web, seems right. isn't, right compilation causes "system.dllnotfoundexception". note compiling causes no issues, debugger does. i've read trough pages these: http://developer.xamarin.com/guides/ios/advanced_topics/native_interop/ but documentation seems related android or ios code , issue seems console-application related. knows ...

spring security - How to conditionally use AuthenticationProvider in SpringSecurity -

we using 2 different authenticationprovider in springsecurity authenticate users: 1 custom authenticationprovider, other 1 activedirectoryldapauthenticationprovider. however, configure app based on httpservletrequest, allow/disallow use activedirectoryldapauthenticationprovider. way implement this?

Pandas/Python: How to match rows of 2 dataframes together based on close but not equal values? -

i'm new python , pandas , use on one.. background- i'm trying extract unsynchronised dual-doppler measurements scanning lidar taking ppi scans. have data (from mysql) loaded pandas dataframes, , need apply matching function rows matched if time of measurement within limit (time < 8s apart). here example of contained in dataframes: https://gist.github.com/anonymous/b0cc61b461c9e2d8f7bf column dt_stop (from labview ) measured in seconds , want match based on. in example, row 0 of df1 have no match since there 20 seconds between , row contained within df2 . row 1 of df1 match row 0 of df2 since there 0.5 seconds apart. matches concatenated horizontally can perform calculations along same row. i hope makes sense. appreciated! here current code: https://gist.github.com/anonymous/6dee303f4f8260600fdd i took mr. f's advice , solved inside query. here did future reference.. hope helps someone! select wk.gw_id, wk.scn_id, wk.dt_start, wk.dt_st...

echo textarea in php -

please let me know how echo textarea, tried several versions dint work. whole page in php. using codeigniter framework echo "<textarea name='openletter' id='openletter' style='width: 565px;' rows='8' cols='60'>"; <?php echo "$data['openletter']"; ?> </textarea>"; you're missing basic php functionality , knowledge, i'd advice read coursework on beginner php. also, should fix problem <textarea name='openletter' id='openletter' style='width: 565px;' rows='8' cols='60'><?php echo $data['openletter'];?></textarea> if want inside echo : echo "<textarea name='openletter' id='openletter' style='width: 565px;' rows='8' cols='60'>". $data['openletter'] ."</textarea>";

javascript - Svg brush as slider. How to set slider scale graduation frequency -

in http://bl.ocks.org/mbostock/6452972#index.html slider example there seems no explicit assignment scale graduation frequency. what if want graduete scale 10 , not 20. how can achieve that? at moment graduation like: 0 20 40 etc. i want: 0 10 20 etc. how can achieve explicitly in javascript file? call axis.ticks() set number of ticks want. in example below i've added ticks(20) <!doctype html> <meta charset="utf-8"> <style> .axis { font: 10px sans-serif; -webkit-user-select: none; -moz-user-select: none; user-select: none; } .axis .domain { fill: none; stroke: #000; stroke-opacity: .3; stroke-width: 10px; stroke-linecap: round; } .axis .halo { fill: none; stroke: #ddd; stroke-width: 8px; stroke-linecap: round; } .slider .handle { fill: #fff; stroke: #000; stroke-opacity: .5; stroke-width: 1.25px; cursor: crosshair; } </style> <body> ...

loops - C# Find visible button by tag name and perform click (Compact Framework) -

i developing application windowsce device. within application have 5 panels, in 1 of them visible @ time. each panel has many different components, however, 1 of many components button has unique tag property set btnok . keeping in mind each panel has 1 of unique buttons, , each of buttons has different function: how can "enter" keypress event find visible ok button , perform click? try creating function: private control findcontrol(control parent, string ctlname) { foreach(control ctl in parent.controls) { if(ctl.name.equals(ctlname)) { return ctl; } findcontrol(ctl, ctlname); } return null; } use function this: control ctl = findcontrol(this, "btnok"); if (ctl != null) { btnok_click(this, new buttoneventargs()); } this assumes button click event looks this... button1_click(object sender, buttoneventargs e) { }

javascript - angular-translate-based custom filter -

i'm using pascal precht's angular-translate module. i've got translations namespaced, e.g. { "customer.account.header.main": "stgsdefghdsf", "customer.account.column.name": "sdfszdfs" "customer.account.column.address": "dsghfg", "customer.account.enum.value1": "dfsgsdf", "customer.account.enum.value2": "sdfgsdfg" } and i'm using them in templates way: {{ "customer.account.enum.value1" | translate }} it's working fine, need make custom translation filter, use translate beneath. need pass namespace prefix, e.g. {{ enumvalue | translateenum:"customer.account.enum" }} where enumvalue value1 , value2 , coming directly api. unfortunately, following not solution, because mechanism used several higher-level mechanisms , needs accept filter (and possibly filter parameters), not expression such ... + ... | filter {{ "cu...

python - pandas: how to sort results of groupby using a pd.cut categorical variable -

i have data frame output groupby using categorical variable created pd.cut. import pandas pd import numpy np di = pd.dataframe({'earnings':pd.np.random.choice(10000, 10000), 'counts':[1] * 10000}) brackets=append(np.arange(0,5001,500),100000000) di['earncat']=pd.cut(di['earnings'], brackets,right=false,retbins=true)[0] di_everyone=di.groupby('earncat').sum()[['counts']] di_everyone.sort_index(inplace=true) di_everyone.to_string and output, [0, 500) 83,005,823 [1000, 1500) 11,995,255 [1500, 2000) 13,943,052 [2000, 2500) 11,967,696 [2500, 3000) 10,741,178 [3000, 3500) 9,749,914 [3500, 4000) 6,833,928 [4000, 4500) 7,150,125 [4500, 5000) 4,655,773 [500, 1000) 9,718,753 [5000, 100000000) 26,588,622 i'm not sure why [500, 1000) appears on second last line. decided not label earncat because want see breakdown. how can sort on earncat? thanks in advance you ...

java - Why did my application stop connecting using HTTP, and how can I debug it? -

i have program includes http connection plm application runs on sql server. program scheduled run daily. collects data few sources, issues query plm store data, , reads plm's reply verify if data stored. the application ran ok, until upgraded both db (into sql server 2012) , plm. since upgrade, when program establishes connection receives ok status; however, data setting query not affect data base, , there no answer received. there no error messages - malfunction. my major question - how debug it. know whet send , receive. how can more data on happens in between? i attach code review. didn't add here query itself, wml-like string. plm should fire answer regardless query receives, if error message. however, null. public boolean amlarascommunication (string data , int targetdbtype, string password) { final string url = "http://plm-srv/innovatorserver/server/innovatorserver2012.aspx"; final string schemeurl = "'http://schemas.xmlsoa...

batch file - Filtering with Multiple Coloumn Variable List -

we using simple query command list of variable, , format quite similar (i.e- 004852 (space) e (space) stk@6.0, 004879 (space) blank (space) stk@6.0, 004883 (space) e (space) stk@6.0, 004892 (space) blank (space) stk@6.0 ) that, , using simple line | c:\windows\system32\find "e" sort variables marked “e”, how sort list marked “blank space”? this 1 working far, above mentioned problem. | c:\windows\system32\find /v "e"

Google maps api : infowindow background transparent -

my website use google maps , display popup (infowindow) when clicking on markers. don't know why , since when, popup background transparent. can me understand? update after answer of dr.molle wrong code : var infowindow = new google.maps.infowindow({maxwidth: '500px'}), mapsmarker, i; good code : var infowindow = new google.maps.infowindow({maxwidth: '500'}), mapsmarker, i; the source of issue seems maxwidth - setting of infowindow . api expects number, provide string 500px . set maxwidth 500

javascript - Background triangle instead of circle JS -

i trying implement following effect on site: animatedheaderbackgrounds but instead of circles want triangles go upwards. have searched stack overflow , tried couple things, did not quite work. (function() { var width, height, largeheader, canvas, ctx, triangles, target, animateheader = true; var colors = ['72,35,68', '43,81,102', '66,152,103', '250,178,67', '224,33,48']; // main initheader(); addlisteners(); function initheader() { width = window.innerwidth; height = window.innerheight; target = {x: 0, y: height}; largeheader = document.getelementbyid('large-header'); largeheader.style.height = height+'px'; canvas = document.getelementbyid('demo-canvas'); canvas.width = width; canvas.height = height; ctx = canvas.getcontext('2d'); // create particles triangles = ...

sql - Calculate working shift giving current datetime in sybase -

i need sql script in sybase or @ least ansi sql giving current datetime, can current working shift. working shift '1' begins @ 08:00 , ends @ 15:30 working shift '2' begins @ 15:30 , ends @ 23:00 working shift '3' begins @ 23:00 , ends @ 08:00am of next day i having trouble third shift, because of change between 1 day , next day set @fechaactual = convert(datetime, 'jun 11 2015 11:00am', 100) --getdate() set @horacomienzoturno1 = convert(datetime,convert(varchar, @fechaactual, 101) + " 08:00:00 am") set @horafinturno1 = convert(datetime,convert(varchar, @fechaactual, 101) + " 03:29:59 pm") set @horacomienzoturno2 = convert(datetime,convert(varchar, @fechaactual, 101) + " 03:30:00 pm") set @horafinturno2 = convert(datetime,convert(varchar, @fechaactual, 101) + " 10:59:59 pm") set @horacomienzoturno3 = convert(datetime,convert(varchar, @fechaactual, 101) + " 11:00:00 pm") set @horafinturno3 ...

wget - Saving images with the HTML Alt text description rather than the file -

i want download selection of images (about 300) supplier, have used wget download images , didn't have issues, however, files numerically named , want product names. have checked html console , there alt text description. question is: can wget recognised alt text , use file name when downloading image? if not can? thank in advance help

Android RelativeLayout placing 2 views next to eachother one view is variable? -

i looking @ placing 2 views next each other. 1 view has fixed width while other should take rest of space (variable). i have set layout fixed width view alignparentright="true" fine overlaps variable width view. i them side-by-side. maybe horizontal linearlayout best task? what have is: <listview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent"/> <selector android:id="@+id/side_selector" android:layout_width="30dp" android:layout_height="match_parent" android:layout_alignparentright="true" android:layout_alignparentend="true" /> you have use linearlayout layou_weigth, : <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <listview android:id...

dictionary - Python: find difference in dicts -

dicta = {'a':1, 'b':2, 'c':3} dictb = {'a':2, 'b':2, 'c':4} if dicta == dictb: print "dicts same" else: # print diffs key in dicta.iterkeys(): try: if dicta[key] != dictb[key]: print "different value key: %s" % key except keyerror: print "dictb has no key: %s" % key this gets inefficient if number of items in dicta , dictb huge any faster way this? i thinking somehow using sets not sure. -- this might duplicate seems people iterating in answers in other similar questions you can use dict view objetcs : keys views set-like since entries unique , hashable. if values hashable, (key, value) pairs unique , hashable, items view set-like. (values views not treated set-like since entries not unique.) these set operations available (“other” refers either view or set): dictview & other return intersection of dictview...

authentication - Is a SecurityContext shared between requests when using Spring Security? -

i'm seeing strange behaviour when using stateless token-based authentication on rest api written using spring boot. the client includes jwt token each request, , custom filter i've written extends genericfilterbean adds authentication object based on claims in token security context using following : securitycontextholder.getcontext().setauthentication(authentication); and clears context after processing request doing : securitycontextholder.getcontext().setauthentication(null); however when simple app i've developed performs range of operations, see security context isn't being set correctly - it's null request has supplied token. filter being called correctly, setauthencation() being called, request fails authentication, , throws 403 denied. if explicitly turn off http session management setting session creation policy stateless, behaviour stops. any ideas happening here? security context being shared between threads dealing requests in way? ...

JAVA: ImmutableSet as List -

i returned immutableset function call (getfeatures()) , due structure of rest of code executed later on- easier change list. have tried cast produces runtime exception. have looked around function call convert list no avail. there way this? recent [failed] attempt shown below: immutableset<featurewrapper> wrappersset = getfeatures(); list<featurewrapper> wrappers = (list<featurewrapper>) wrappersset; i have found wrapperset.aslist() give me immutablelist rather prefer mutable list you can't cast set<t> list<t> . entirely-different objects. use copy constructor creates new list out of collection: list<featurewrapper> wrappers = new arraylist<>(wrappersset);

ios - How to convert from ModelIO MDLMesh to SceneKit SCNGeometry and back? -

apple have announced model i/o framework and, understandably, documentation quite sparse many classes still not documented. model i/o talk suggests two-way link between scenekit classes , model i/o classes, can't find way in practice. scngeometry has convenience init accepts mdlmesh object, i'm not sure how go other way , generate mdlmesh object pre-existing scngeometry . the init mdlmesh is: init(vertexbuffer vertexbuffer: mdlmeshbuffer, vertexcount vertexcount: int, descriptor descriptor: mdlvertexdescriptor, submeshes submeshes: [mdlsubmesh]) or, alternatively, same vertexbuffers: [mdlmeshbuffer] (where vertex buffer corresponds scenekit geometry source), can't figure out go here. (it looks mdlmeshbuffer has method takes filldata: nsdata parameter, , know scngeometry.geometrysources gives array of scngeometrysources each .data provides these geometry sources nsdata object, i'm not sure if right way go doing it.) any guida...

css3 - Responsive WordPress Themes -

does know of responsive wordpress themes have great deal of control on css , structure of website? want of functionality of wordpress blogging features, want have total control on design , implementation. some of favorite starter themes are: http://themble.com/bones/ , http://underscores.me/ you can @ frameworks like: http://themeshaper.com/thematic/ or http://my.studiopress.com/themes/genesis/ you can grab theme like, , create child theme: https://codex.wordpress.org/child_themes

mongodb - Nosql database design for complex querying -

a nosql question: let's have scenario: a user status change (let's every seconds), has different characteristics such country (up 10k characteristics per user)... user can post messages have different types. the issue: the scenario in opinion rds oriented join used lot querying. however, not option (for sake of exercise). therefore, not looking solution pseudo rds hive or other solution have pseudo join. looking mongodb can use mapreduce or aggregation . my solution (using mongodb): let's have 3 collections: user => user characteristics (a large number of differents characteristics such age/sex..) message => message specific field status => status specific field the possible way tackle problem (as far know) are: denormalize data duplicating user field , embed in message , status (or putting in 1 collection) => not seem optimized have lot of characteristics per user , reach 2mb limit of documents (you use gridfs worried perf of ,...

javascript - codemirror: detect when last character in line is deleted -

how mode "know" when last character in line deleted? say, type something, , mode object receives calls token(stream, state) type. if delete characters 1 one, say, pressing backspace, token method gets called every time except when delete last character (in case blankline called). this not convenient if build ast tokens. need delete part of ast represented last deleted character. use blankline if associate deletion of last character, cannot find way. please help. a mode doesn't , shouldn't know changes document. parses stream given. can have other code listen "change" events, , update data structures used mode in response them.

php - Profile/account REST API naming convention -

i have tried search net, haven't found example of best practice url naming convention following requests. api allows user log system, retrieve secure token can used access private data on https. so there following features support api : auth. simple authentification. /api/auth used log system first time , token in response or refresh expired token if required. view profile data (first name,last name, phone number ....). best way form url resource. have several ideas : /api/users/me/profile or /api/users/{id}/profile . in first case our client (rest api consumer) doesn't need know exact id of user, when user tries access resource checks if token valid,if passed user name exists , tied token, , returns data based on information. in second case have know exact id of user, of course id can returned in response auth. also other methods /api/user/me/orderlist, /api/user/me/someuserspecificinfo . what making order. have read if need create new resource have us...

python - Setting containers within a loop -

this question has answer here: do python loops work reference? 2 answers dicta = {'a':1, 'b':2, 'c':3} prea = {} print hex(id(prea)) preb = {} print hex(id(preb)) dicts = [prea, preb] #<---- looks can't save this? d in dicts: print hex(id(d)) d = dicta print prea print preb output: 0x13348b0 0x13357f0 0x13348b0 0x13357f0 {} {} looks has same memory address when set prea or preb via variable ' d ' , getting value prea or preb , it's if never set. can explain whats going on here? d set current dictionary @ iteration of each loop. setting d = dicta pointless because d change next dictionary first step.

python - How to find the first common number from a dictionary of lists -

i have dictionary of lists. each list contains many numbers. lists can have different lengths. looking find first common number in lists . the answer has function . for example in case: d = { 'case1' : [18, 17, 497, 298, 57, 82, 1], 'case2': [128, 184, 497,298,57, 1, 82], 'case3':[104,2828,3881, 497, 1, 38], 'case4': [392, 497, 573, 1]} the expected output is: 497 . don't want catch 1. looking 497. all have : def find_first_common_number(dictionary_of_lists): list_name in dictionary_of_lists: #list name e.g. 'case1' num1 in dictionary_of_lists[list_name]: #this going have find first common # number lists in dictionary # order number appears in each list not matter i appreciate on this. looked through list methods, couldn't new python. if explain/comment method great. can try way: #!/usr/bin/python d = { 'case1' : [18, 17, 497, 298, 57, 82], '...

weblogic11g - Oracle Weblogic server - get logs of requests served -

i using oracle weblogic server 11g. came know logs created @ location "oracle\middleware\user_projects\domains\base_domain\servers\adminserver\logs" i want following logs. all requests received weblogic server. count of requests served , requests not served. i not find these logs.

node.js - Mean Stack MissingSchemaError: Schema hasn't been registered for model "User" -

i have tried many solutions given on stack overflow nothing worked in case... here code... server.js entry point of application. process.env.node_env = process.env.node_env || 'development'; var config = require('./config/config'), mongoose = require('./config/mongoose'), passport = require('./config/passport'), express = require('./config/express'); var passport = passport(); var db = mongoose(), app = express(); app.listen(config.port); module.exports = app; console.log(process.env.node_env + ' server running @ http://localhost:' + config.port); my config.js is module.exports = require('./env/' + process.env.node_env + '.js'); mongoos.js var config = require('./config'), mongoose = require('mongoose'); module.exports = function() { var db = mongoose.connect(config.db); require('../app/models/user.server.model'); return db; }; passport.js var ...

java - Why is my char printing as a number instead of a character? -

as per java ternary operator expression ? statement1 : statement2 , if expression true statement1 executed, if expression false statement2 executed. but when run: // unnecessary codes not displaying char y = 'y'; int = 0; system.out.print(false ? : y); i expecting print y printing 121 , why? edit per manouti answer, compiler interprets int , if case why seeing dead code @ i ? if system.out.print(false ? 0 : x); getting y , why in case doesn't compiler interpret int ? the short answer question value printed based on type conditional expression evaluates to. so question boils down to, why type of conditional expression differ between char y = 'y'; int = 0; system.out.print(false ? : y); // prints 121 and char y = 'y'; system.out.print(false ? 0 : y); // prints y to answer that, we'll need take @ section §15.25 of java language specification . there 3 types of conditional expression in java: boolean conditional ...

c# - How to store values from .h files? -

i need read .h file , store values. example, .h files contain lines so: #define mbbh 5 #define gbnn 90 #define mkoll i wrote code read .h file (where use string array, search #define , value of name i.e., ( mbbh, gbnn)- arrayname [1] ). the problem have is, if of these lines doesn't have value arrayname[2] throws exception. #define vkol how value of #define when not in position arrayname[2] ? #define gbbn 90 this define statement has value, how can it? change string[] lineparts = string.split(line, ' '); to string[] lineparts = string.split(line, ' ', stringsplitoptions.removeemptyentries);