Posts

Showing posts from May, 2010

python - Multiple concurrent fsm Fysom -

i writing code in python operations , these operations has concurrent reason why draw fsm 2 concurrent fsms. while using fysom in python thought of having definition of 2 fsms. @ point thinking how transition happen; confused little bit here , that's why asking support. if 1 can please , grateful .. way defined fsms please tell me if makes no sense in fysom or no fsm1 = fysom({ 'initial':'idle', 'events':[ {'name':'sc','src':'idle','dst':'percent30'}, {'name':'sc','src':'percent30','dst':'percent60'}, {'name':'sc','src':'percent60','dst':'percent90'}, {'name':'sc','src':'percent90','dst':'idle'} ], 'callbacks':{ 'onidle':onidle, 'onread':onpercent30, 'onturnon':onpercent60, 'ondisplay':onp

polymer - Computed property isn't recomputed when array dependency is mutated -

i'm using computed property items dom-repeat . <template is="dom-repeat" items="{{double(values)}}"> <span>{{item}}</span> </template> when dependency values changes, property isn't recomputed. addvalue: function() { this.push('values', this.values.length+1); this.async(this.addvalue, 1000); }, if, instead of mutating values , set new array, work: this.set('values', this.values.concat(this.values.length+1)) is bug or expected behavior? demo: http://plnkr.co/edit/smahkmhhspwgmbhbbzav?p=preview i spoke scott miles, member of team behind polymer, , got back: in order computed property bind properly, must use [[double(values.*)]] . the parameter passed double function object properties path , value , , base , in path observation. path refer path string specifies if length or splices updated in array, value value of length or splices , and base refer array. example: &l

usage of istream in class constructor c++ -

i have text file contains list of students , marks , looks this: name_of_student 78 4; 98 5; 90 5; 63 3; ... i have assignment create class read , store data. i've done far. group.h class subject { public: subject(int mark0, int mark1); subject(); int get_m0() { return mark0; } int get_m1() { return mark1; } private: int mark0; int mark1; }; class student { public: student(string name); student(); vector<subject>my_marks; string get_name() { return name; } private: string name; }; class reading { public: reading(vector<student>, istream& ); istream& read_student(); private: vector<student>group; istream& is; }; text.cpp subject::subject(int m0, int m1) : mark0(m0), mark1(m1) {} subject::subject() : mark0(1), mark1(1) {} student::student(string n0) : name(n0) {} student::student() : name("null") {} reading::reading(vector<student>group0, istream& is0) : grou

c# - Possible consequences of duplicate ProgId for different classes -

in software i'm maintaining i've observed com classes marked identical [progid] s. afaik progid human readable identifier component , should map 1-to-1 component's clsid . so i'm wondering: is there reason have same progid different classes? what possible consequences? (except not being able reach component using convenient way) thanks in advance. a progid provides friendly name clsid guid of coclass. important scripting languages, no way know guid. used languages support late binding, vb.net , c#. conversion string guid happens @ runtime. usual name of factory function createobject(), language runtime implements looking @ registry entry stored in hklm\software\classes. which cue go wrong when duplicate them. actual object client program creates random. whichever 1 happened registered last. client program calls different method 1 intended call. might trigger disp_e_xxxx error return that's no guarantee. in general nasty , quite

javascript - debounce not firing inside $scope.$watch -

this question has answer here: lodash debounce not debouncing 2 answers i'm trying run function when model variable updates in ui i'm trying throttle how function executed via debounce requested function fires ajax call. debounce function below doesn't seem firing @ all. i wrote own debounce service , have resorted using underscores debounce method test whether wrote incorrect or not turns out angular isn't liking below... using angular's ng-model-option debounce method in html not option. $scope.$watch('filters.monthlycost', function () { _.debounce(function () { console.log('lol'); }, 1000); }); there no console errors, console.log('lol') never happens. note: $watch does execute. since debounce returns function ( (function): returns new debounced function. ) return value of debounc

jquery - Bootstrap calendar not accessible through class -

i have table have use bootstrap calendar in particular columns in rows. using id calendar cumbersome. decided assign class calendar , tried accessing calendar unfortunately doesn't pop-up. while same code when hard-coded id's work perfectly. here code snippet using:- <script> $(document).ready(function() { $(".datepicker").datepicker({ autoclose: true, startdate: new date() }); }); </script> <td> <div class="form-group"> <div class="input-group datepicker date"> <input type="text" class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </td> this code works absolutely fine copy code , save xhtml page , ca

R language: how to write for loop similar to java? -

i'm used writing for loops in java using: for (ii=10; ii<length(myarray); ii++) { } if length(my array) less 10, loop not execute. how in r language? if try in r language: for (ii in 10:length(myarray)) { } the loop execute if length(myarray) less 10, example. how write loop not execute in case? use if . if (length(myarray) >= 10) { (ii in 10:length(myarray)) {...} } if clear, can use while try make r more java-like ii = 10 while (ii < length(myarray)) { ... ii = ii + 1 } but i've never seen r programmer this. does, say, replace if , for single while , adds need initialize ii , increment inside loop.

sql - Three columns in two tables to four columns in one table -

i'm trying combine 2 tables, each has 3 columns , 2 of common. income table has location , date , amt_recd , expense table has location , date , amt_spent . want combine these 2 tables there 1 table 4 columns, , common dates combined 1 row. i've tried this: select location, date, amt_recd, null amt_spent income union select location, date, null amt_recd, amt_spent expense and gets me 1 step away, since not combine dates 1 row, has 2 rows amt_recd null in 1 , amt_spent null in other. better way construct result more condensed? i've tried various joins instead of union, , haven't been able result i'm looking for. i basing answer on line original post: i want combine these 2 tables there 1 table 4 columns, , common dates combined 1 row. the second half of suggests need not join, aggregate. select coalesce(i.location, e.location) location , coalesce(i.[date], e.[date]) [date] , sum(i.amt_recd) amt_recd , sum(e.amt_spent) a

c# - VS2013 Update 4, can't open CSHTML files -

i have machine can no longer edit cshtml files in vs2013 update 4. exact manifestation of varies. in cases modal appear saying "the operation not completed." in cases activitylog.xml file populated errors: system.nullreferenceexception: object reference not set instance of object. @ microsoft.html.editor.htmleditordocument.fromtextview(itextview textview) @ microsoft.html.editor.codebackgroundtextadornment..ctor(iwpftextview view, iclassificationformatmapservice classificationformatmapservice, iclassificationtyperegistryservice classificationtyperegistry) @ microsoft.html.editor.classification.razorcodebackgroundtextadornmentfactory.textviewcreated(iwpftextview textview) @ microsoft.visualstudio.text.editor.implementation.wpftextview.<>c__displayclassc.b__9() @ microsoft.visualstudio.text.utilities.guardedoperations.callextensionpoint(object errorsource, action call) system.nullreferenceexception: object reference not set instance of object. @ micro

java - Apache Commons Math: get derivate/integrate function -

i'm working polynomialfunction. derivate/integrate function f in next way: // derivation ... new polynomialfunction(vector).value(x).getpartialderivative(derivationorder) // integration ... univariateintegrator integrator = new iterativelegendregaussintegrator(pointsnumber, relativeaccuracy, absoluteaccuracy, miniterations, maxiterations); integrator.integrate(128, f, from, to); but how derivation/integration result function f without specifying real values? i.e. derivate (8 + 3x + x^2) => 3 + 2x for polynomial functions, can derivatives directly (as polynomials) using polynomialderivative method of polynomialfunction class. there more general setup differentiation described in analysis section of commons math user guide.

javascript - Cant find dynamically created ids with jquery -

i create ids following: var plant_counter = 0; $('.plant-name').attr('id', 'plant-name-' + plant_counter); after try change html code of element: $('#nav-btn-test').click (function () { $('#plant-name-0').html('hello'); console.log('clicked); }); the html code not change. why? the code setting ids not work because variable plant_counter not being updated (it 0). use jquery's .each method (see documentation here ), this: $('.plant-name').each(function( index ) { $(this).attr('id', 'plant-name-' + index); }); aside : in click handle registration, you're missing closing single quote (') @ end of logging statement. here working example jsfiddle copy.

node.js - http endpoint for a heroku worker -

i start process in worker upon payload receive through message queue power ironmq. ironmq it's possible create push queue requires http endpoint. is possible set http endpoint heroku worker or have pull queues worker? there few options: 1) if you're using heroku worker, you'll have poll ironmq messages. easy, in loop ruby example: while true msg = queue.get if msg != nil process_message(msg) else sleep 1 # sure sleep don't waste api calls , cpu! end end 2) use ironmq push queues hit endpoint on heroku app, instead of using heroku worker , put process_message code endpoint. 3) use ironworker .

c++ - Using zlib with mingw -

i trying read test.zip file using zlib library , extract contents. requirement read each file , output content (unzipped) first memory , file. i tried below code: #include <iostream> #include <zlib.h> using namespace std; #define line 1024 int main() { const char *filename = "hello.zip"; gzfile infilez = gzopen(filename, "rb"); if (infilez == null) { printf("error: failed gzopen %s\n", filename); return -1; } unsigned char unzipbuffer[8192]; unsigned int unzippedbytes; std::vector<unsigned char> unzippeddata; while (true) { unzippedbytes = gzread(infilez, unzipbuffer, 8192); if (unzippedbytes > 0) { cout << unzippedbytes << endl; (int = 0; < unzippedbytes; i++) { cout << unzipbuffer[i]; } } else { break; } } gzclose(infilez); return 0; } i got abov

swift - making an image the full size of a scrollview -

i have set image background in scrollview can zoom in pan around it, however, when image zoomed out creates white borders left , right of image can assume scrollview margins. any way rid of these image fills screen? edit: here picture show mean, white bars along sides of grey background edges of scrollview, want grey background fill screen apart iad bar. http://i.stack.imgur.com/qx0kk.png many thanks! // 1 let image = uiimage(named: "photo1")! imageview = uiimageview(image: image) imageview.frame = cgrect(origin: cgpointmake(0, 0), size:image.size) // 2 scrollview.addsubview(imageview) scrollview.contentsize = image.size // 3 var doubletaprecognizer = uitapgesturerecognizer(target: self, action: "scrollviewdoubletapped:") doubletaprecognizer.numberoftapsrequired = 2 doubletaprecognizer.numberoftouchesrequired = 1 scrollview.addgestur

java - Edit ViewGroup outside onCreate -

i create viewgroup programatically. add 2 views, game , seekbar. however, if try change seekbar properties within game (which has pointer androidadapter) using, example, parent.seekbar.setvisibility(view.visible) app crashes. the parent filed set follows, inside game class: public class simulation extends applicationadapter implements gesturedetector.gesturelistener{ androidlauncher parent=null; public void setparent( androidlauncher nparent ){ parent = nparent; } public void something(){ if( parent != null ) parent.layout.removeview( parent.seekbar ); } } i'm missing permission change view? have set/change before editing seekbar? thanks! public class androidlauncher extends androidapplication { simulation simul; viewgroup layout; seekbar seekbar; shapedrawable thumb; layoutparams lp; @override protected void oncreate (bundle savedinstancestate) { simul = new simulation(); simul.setpar

DocumentDB paging with many collections -

lets have 2 collections , there 10 documents in each collection. recommended way paging if want retrive max 15 documents? when run code below 20 results. begins requesting first collection returnes 10 , second returns 10 should return 5 since maxitemcount 15. var batches = new list<ienumerable<t>>(); var feedoptions = new feedoptions { maxitemcount = 15 }; var docquery = client.createdocumentquery<t>(database.selflink, feedoptions) .where(predicate).asdocumentquery(); { var batch = await docquery.executenextasync<t>(); batches.add(batch); } while (docquery.hasmoreresults); var docs = batches.selectmany(b => b).take(maxitemcount.value); return docs; maxitemcount controls number of results per page, not total results returned. reduce total number of results, change while clause check e.g., (docquery.hasmorere

c# - EntityFramework Include -

this domain use entity framework public virtual currency currency { get; set; } public int defaultcurrency { get; set; } public virtual currency funcurrency { get; set; } public int defaultfuncurrency { get; set; } by default if put .include(c => c.currency); bind currencyid , in case need link property defaultcurrenncy help

Cannot connect to cassandra through pycharm python console, but can connect via python in a terminal -

Image
i trying connect cassandra 2.1.5 using latest python driver. works charm if run python on terminal, or if run python code pycharm. from cassandra.cluster import cluster; k = cluster(); k.connect('mykeyspace'); however, if try python console inside pycharm (or if use debug mode , step through code), last line: k.connect('mykeyspace'); throws me operation timedout error: traceback (most recent call last): file "<input>", line 1, in <module> file "/home/rajee/workspace/bemoss_os/env/local/lib/python2.7/site-packages/cassandra/cluster.py", line 755, in connect self.control_connection.connect() file "/home/rajee/workspace/bemoss_os/env/local/lib/python2.7/site-packages/cassandra/cluster.py", line 1868, in connect self._set_new_connection(self._reconnect_internal()) file "/home/rajee/workspace/bemoss_os/env/local/lib/python2.7/site-packages/cassandra/cluster.py", line 1903, in _reconnect_interna

node.js - Want To Established RPC Connection B/W Two Mobile Devices? -

i developing 8 pool games.for send/receive position using rpc package.the connection establishing connection b/w 2 different devices when connected same network (same ip).but when trying establish connection 3g data/different wi-fi network not working. i used stun server public ip address of device still not working.please let me know how can establish connection b/w 2 different device 2 different network.

javascript - How can I start the node red with forever in my linux server? -

i installed node-red npm , able run node red typing 'node-red' in terminal thats it. how can run the node red in linux server forever command ? want node red running continuously. you can start script daemon. first install forever globally: npm -g install forever (you'll need root privileges that). issue command forever start /path/to/node-red red.js .

Nesting dynamic parameters in PowerShell -

i working on function insert row sql database. simple change log me track changed on various sql instances. part of this, want have following parameters: timestamp server instance change i've got timestamp, change, , server figured out, instance giving me trouble. server parameter dynamic, pulls list of sql servers inventory. want value of parameter used in dynamic parameter, pulls list of instances on server (also inventory). here have dynamic portion: dynamicparam { if (!(get-module sqlps)){ pop-location; import-module sqlps -disablenamechecking; push-location } $inventoryinstance = 'servername' $newparams = new-object system.management.automation.runtimedefinedparameterdictionary $server_query = 'select [name] [serverinventory].[dbo].[servers] [typeid] = 1 order [name]' $servers = invoke-sqlcmd -serverinstance $inventoryinstance -query $server_query -connectiontimeout 5 # populate array $serv

python - Sphinx: How to insert something between classes using automodule? -

i'm using sphinx auto-document django based models https://djangosnippets.org/snippets/2533/ . the problem have classes listed 1 one. there way add subsection before each class? for example: <obj._meta.db_table> --------------------- class models.actor(*args, **kwargs) parameters:... <obj._meta.db_table> --------------------- class models.dog(*args, **kwargs) parameters:... because receiving that: class models.actor(*args, **kwargs) parameters:... class models.dog(*args, **kwargs) parameters:...

Liferay - Deleting folders in Document Library does not delete filesystem files -

we have issue liferay: when delete folder document library, documents inside, corresponding disk files not deleted. still in place when folder removed liferay trash can, , size still full file's size. when delete documents directly, issue not happen: files removed disk document moved trash inside liferay. this great issue since not able free disk space (a procedure find deleted documents , remove files disk useful). the similar issue found one: https://www.liferay.com/it/community/forums/-/message_boards/message/3399338 ; checked user running tomcat has correct filesystem permission. this issue occurs on 2 different environments (staging , production) same configuration. our configuration uses advancedfilesystemstore document library , our liferay version liferay portal community edition 6.2 ce ga2 (newton / build 6201 / march 20, 2014). edit: still haven't found solution problem, able find , remove deleted files filesystem app: https://www.liferay.com/it/ma

unix - strip words after matching character -

i have file there lines in pattern. want remove text after _ . how do in unix? x y z 1_2 3_4 5_6 i tried command: $ sed 's/_.*//' but returns: x y z 1 however want x y z 1 3 5 thanks just remove every _ + character: $ echo "x y z 1_2 3_4 5_6" | sed 's/_\w//g' x y z 1 3 5 or, if want remove space, remove nonspace characters: sed 's/_[^ ]*//g'

Excel Userform Iframe Autoscroll -

what have user form image iframe multiple input fields. have created scrollable region input fields not fit on userform. happens when click part of image iframe scroll downwards input box applicable set foceu. works great using script below, question how set go horizonatal instead of vertical now sub scrollframe(topvisiblecontrol object) ' declares sub named scrollframe , (procedure scoped) variable named topvisiblecontrol frame10.scrollleft = scrolltop = topvisiblecontrol.top end sub i call function with call scrollframe(comboboxga37) trial error figured out if sels interested here script below sub scrollframe(leftvisiblecontrol object) ' declares sub named scrollframe , (procedure scoped) variable named topvisiblecontrol frame10.scrollleft = leftvisiblecontrol.left end sub

I run an EXE program from a Windows Service but I can't see form C#? -

i run program windows service private process runapp(string _applocation) { //create process process _ret = new process(); _ret.startinfo.filename = _applocation; //run administrator. _ret.startinfo.verb = "runas"; //window = normal _ret.startinfo.windowstyle = processwindowstyle.normal; _ret.startinfo.createnowindow = false; _ret.start(); return _ret; } i see in task manager. working can't see window. (if can not see can change parent , see it)i try this: create new midichildwindow project and: [dllimport("user32.dll", setlasterror = true)] static extern intptr setparent(intptr hwndchild, intptr hwndnewparent); [dllimport("user32.dll")] static extern bool showwindow(intptr hwnd, int ncmdshow); private void getlisteners() { process[] memory = process.getprocesses(); foreach (process _prc in memory) {

Change controls style with CSS in OpenLayers 3.5.0 -

my question simple: possible change controls button styles css ? , if that, can don't load css of openlayers ? and answer simple: .ol-control button{ background-color: rgba(40, 40, 40, 0.85) !important; } the !important overwrite default style. and no, load css. substitute.

Python: Finding a negative number in a line of text from a file -

i have program polls servers current wi-fi status every minute, , saves info .txt file. output is: *****current wifi signal strength*****: link quality=57/70 signal level=-53 dbm the text file contains many of these lines. i'm trying accomplish is: -find signal dbm values in lines, , append them array can can other functions such sort , average. can't seem working quite right. does know how this? thank you! i go through each line in file , split line @ = , last value, split @ space, , first value yield -53 . strengthvalues = [] f = open("input.txt", "r") filelines = f.readlines() line in filelines: linesplit = line.split('=') strengthvalues.append(linesplit[-1].split()[0]) print strengthvalues or list comprehension: f = open("test.txt", "r") filelines = f.readlines() strengthvalues = [line.split('=')[-1].split()[0] line in filelines] print strengthvalues

nsis - How can I use multiple icon size in same wizard? -

how can use multiple icon size in same wizard? have 16x16, 32x32, 48x48, 64x64 , 256x256 icon's size , want know if can use them in nsis? to use small, medium , large icons. if change view in windows explorer icon of setup becomes distorted. a windows icon can contain multiple images different sizes, icon should ideally contain 16x16, 24x24, 32x32, 48x48, 128x128 , 256x256 pixel images. you need use icon editor create .ico. there multiple free icon editors , converters out there ...

python - Continue loop after exception is excepted -

i have loop try...except : try: sqlcommand in sqlcommands: cursor.execute(sqlcommand) except psycopg2.programmingerror err: print "programming error spotted. message -->" print err this loop creates tables in sql. want here if there table(programming exception generated), print message under exception continue loop, not stop it. can it? you need change order of try statement: for sqlcommand in sqlcommands: try: cursor.execute(sqlcommand) except psycopg2.programmingerror err: print "programming error spotted. message -->" print err in case while iterating loop, each query try except block run , if error found main for loop iteration still working.

SAS: Calculating sum within each group -

this question has answer here: sas difference between sum , +? 2 answers data cumsum; set temp; group; if first.group sum = 0; sum + x if last.group output; run; the code above calculates sum within each group, if change sum + x sum = sum + x , result not correct. explain difference between sum + x , sum = sum + x ? the sum+x; notation has implicit retain statement added when code runs. if use sum = sum + x; notation, must explicitly state retain statement manually. ie. data cumsum; set temp; group; retain sum 0; if first.group sum = 0; sum = sum + x if last.group output; run;

sql - Union and order by a column not selected -

let's have table a, columns a_1 , a_2. i interested in column a_1 , can write : select a_1 a; however want ordered column a_2 , write : select a_1 order a_2 desc; now want union : select a_1 <some filters> union select a_1 <some other filters> order a_2 desc; this doesn't work anymore ( "a_2": invalid identifier ), change : select a_1, a_2 <some filters> union select a_1, a_2 <some other filters> order a_2 desc; the select a_2 part bothers me : don't want show in results, how can hide information ? conceptually, doesn't make sense order a_2 after you've done union on a_1 . oracle's perspective, entirely possible distinct a_1 value in either query, there may many different a_2 values returned. there many possible sort orders. you can, of course, nest query a_1 in results select a_1 (select a_1, a_2 <some filters> union select a_1, a_2 <some other filters>) s

android - How to set the GLSurfaceView.Renderer class to show the object into surfaceView or the FrameLayout? -

today, i've made 3d object opengl es in android , thinking of displaying other layouts such surfaceview or framelayout in xml or in possible way. in code below i'm setting gl object oncreate's setcontentview display object. if display glsurfaceview somewhere else how can ? great if can have tips or example! glsurfaceview oursurface; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //setting gl surface view oursurface = new glsurfaceview(this); oursurface.setrenderer(new glcuberender()); setcontentview(oursurface); } first should create class extends glsurfaceview constructor see in following example package com.ball.views; import android.content.context; import android.opengl.glsurfaceview; import android.util.attributeset; public class myglsurfaceview extends glsurfaceview { public myglsurfaceview(context context, attributeset attrs) {

c# - Rotating a circle with mouse with direction -

i rotating circle mouse want there limit on how far circle can rotated. (lets 3 full times). when reaches it's limit can no longer turned in same direction, opposite direction can be. got stopping after max turns i'm trying find direction , every time mouse passes x-axis of circle direction changes because atan2 gives me angle relative x-axis. new mouse position in 1 quadrant , last position in quadrant subtracting these angles doesn't give me want. did explain well? suggestions? private void helmpb_mousemove(object sender, mouseeventargs e) { if ((e.button != mousebuttons.left) || _dontturn) return; double angle = offsetangle(); point temp = mouseposition; float degrees = convert.tosingle(angle - _offsetangle); float diff = _lasthelmangle - degrees; float absdiff = math.abs(diff) % 360; if (absdiff > 180) absdiff = 360 - absdiff; double angle1 = math.atan2(_lasthelmpoint.y, _lasthelmpoint.x);

visual studio - Can deploy to Windows phone on one machine but not another? -

i have been developing windows phone app on lunch breaks @ work , spare time @ home. project stored in dropbox it's same on both pcs. @ work when debug/deploy device fine , dandy. @ home following. error : dep6100 : following unexpected error occurred during boostrapping stage 'connecting device': smartdeviceexception - deployment failed because no windows phone detected. make sure phone connected , powered on. error : dep6200 : boostrapping 'device' failed. device cannot found. deployment failed because no windows phone detected. make sure phone connected , powered on. now in both cases i'm using same version of sdk , of vs on same microsoft account on same phone on same project. doesn't work. i have reinstall sdk twice no avail. when run device registration following message. unable connect phone. make sure windows phone ip on usb transport service running i'm not sure i'm doing wrong here, has run before? ideas of fix

Spark streaming creates one task per input file -

i processing sequence of input files spark streaming. spark streaming creates 1 task per input file , corresponding no of partitions , output part files. javapairinputdstream<text, customdatatype> myrdd = jssc.filestream(path, text.class, customdatatype.class, sequencefileinputformat.class, new function<path, boolean>() { @override public boolean call(path v1) throws exception { return boolean.true; } }, false); for example if there 100 input files in interval. then there 100 part files in output file. what each part file represents? (output task) how reduce no of output files (2 or 4 ...)? does depend on no of partitioners? each file represents rdd partition. if want reduce number of partitions can call repartition or coalesce number of partitions wish have. https://spark.apache.org/docs/1.3.1/programming-guide.html#transformations

node.js - Marklogic|NodeJS API facet query by geolocation -

so, have structure like { city: "city", geolocation: { lat: 55, lng:55 } } and want count geolocation return city cannot facet geolocation work. created geospatial element index, geospatial element pair index , query tried following: qb.facet("count", qb.property("geolocation")) qb.facet("count", qb.geopropertypair("geolocation", "lat", "lng")) qb.facet("count", qb.geoproperty("geolocation")) qb.facet("count", qb.geoelement("geolocation")) and of these facet query empty or inexistent. doing wrong? i'm able reproduce bug. while geospatial queries on json documents work, geospatial facets on json documents not working in rest api. the workaround can see write custom constraint executes cts:geospatial-boxes() in xquery or cts.geospatialboxes() in javascript, install module on server, , refer custom constraint in query. more in

c++ - Create multiple objects in class -

i have class use make linked lists. in main want create more 1 lists. mean without overwriting previous one. how can without having give new name create object of class. if example had 1000 lists couldn't give 1000 different names them. tried using array of objects don't seem work. edit:sorry inconvenience i'm not allowed use vector. here's code: list **root; root=new list*[m]; (int i=0;i<m;i++) { root[i]=null; root[i]=new list(); } this in main use (*root[pos]).addnode(b,a); no matter pos use go same list. if created linked list class linkedlist create std::vector of lists. can iterate on them , whatever you'd like. #include <vector> int main() { std::vector<linkedlist> lists(1000); (auto& list : lists) { // each list } } if know how many linkedlist objects want make, , value fixed, use std::array #include <array> int main() { std::array<linkedlist, 1000> lists;

MongoDB Architecture Optimization: Nested Object List versus Dynamic Collection -

i building multi-product application using mean stack , love have feedback on optimising mongo database architecture. basically building online course platform, similar - lot simpler - udemy.com, teachers can create multiple courses , students can sign individual courses. 1 of big difference when student signs course, he/she can access course. , he/she have sign again join course. there no relationship between courses. in nutshell, students collection must specific each course, unique username per course. question is: should create dynamic mongodb collection each course? if "course1" created teacher, "course1id-students" collection created. using mongoose quite easy love have feedback on dynamic collections. option create single courses collection. within collection, add studentlist array of object. schema similar to: courses: { id, coursetile, studentlist: [ { id, email, password, ...

Overriding mutable variable in child class in Scala -

i have abstract class , child class extends abstract class user{ var name : string = "test" } i have class class student(name : string) extends user{ } now whenever try pass name making object of student , prints value on console instead of showing me name passed in constructor shows test parent class object main extends app{ val st = new student("ahsen") var name = st.name println("name " + name) } it outputs name test please help you can't override var. maybe assign it? class student(n: string) extends user { name = n } alternatively can define name var in student , if superclass declares variable, not defining it: abstract class user { var name: string } class student(var name: string) extends user

mysql - How do i join 2 queries? -

select a.nume_echipament, a.producator, a.seria, b.uc, b.port , a.durata_aprovizionare durata_aprovizionare, ( select sec_to_time(count(starea)*5) echipamente inner join aprovizionari on echipamente.nume_echipament=aprovizionari.nume_echipament ( echipamente.ora>aprovizionari.ora_aprov , echipamente.data>aprovizionari.data_aprov) , starea='1' , echipamente.nume_echipament='automat_imbuteliere') durata_functionare, a.durata_viata durata_viata, ( select data_aprov aprovizionari nume_echipament='automat_imbuteliere' order date(data_aprov) desc, time(ora_aprov) desc limit 1) data_aprov, ( select ora_aprov aprovizionari nume_echipament='automat_imbuteliere' order date(data_aprov) desc, time(ora_aprov) desc limit 1) ora_aprov, (select sec_to_time(count(starea)*5)) durata_totala date_tehnice inner join echipamente b on a.nume_echipament=b.nume_echipament i

visual studio - VS2013 and Azure - deployment template validation failed, although I haven't edited neither template nor project properties -

i'm trying deploy website azure visual studio. it's pretty standard website, nothing tricky it, , i'm using "one click" (ha!) method of deployment visual studio 2013 express. however, don't far creating web-app. "create web-app on microsoft azure" dialog fails when click create after naming application, creating resourcegroup , selecting dbserver , service plan, following message: request https://management.azure.com/subscriptions/8ffb8793-a03d-45d4-88b5-647f5baf0fa0/resourcegroups/raocresourcegroup/deployments/website_deployment?api-version=2014-04-01 put failed badrequest 400 (bad request) deployment template validation failed: 'the provided value template parameter 'sku' @ line '16' , column '17' not valid.'. my main problem have no idea visual studio talking about. googled "deployment template validation failed" , couldn't find error. googled "deployment template" see is

c++ - How to write structure to file using fwrite without unnecessary characters (Null) -

i can't user imputed data, stored in file. tried: #include<iostream.h> #include<string.h> #include <fstream> struct persons { char name[10]; int dd, mm, yyyy; } a[30],b[30],p; int n,i; int main() { file * pfile; pfile=fopen("data.int","w"); cout<<"number of persons: ";cin>>n; for(i=1;i<=n;i++) { /*cout<<"person: "<<i<<": "<<endl; cout<<"name: "; cin>>a[i].name; cout<<"day (dd): "; cin>>a[i].dd; cout<<"month (mm): "; cin>>a[i].mm; cout<<"year (yyyy): "; cin>>a[i].yyyy; fwrite(&a, sizeof(a),1, pfile);*/ cout<<"persoana: "<<i<<": "<<endl; printf("enter name, day(dd), month(mm) , year(yyyy)\n");

javascript - localStorage and boolean 'string' -

storing boolean value in localstorage, value converted string. trying converting value localstorage boolean, need use json.parse() method, more handy !! doesn't work. code sample: var test = false; localstorage['test'] = test; console.log("json.parse returns: ", json.parse(localstorage['test']), "expected: ", test); console.log("'!!' returns: ", !! localstorage['test'], "expected: ", test); -jsfiddle- i'm quite confused why behaviour. explaination? ps: using getter/setter localstorage methods doesn't matter here, same result. local storage stores strings , i'm afraid, whatever input (if feed object, converted automatically standard tostring() method)... you're doing !! test on string, true . you should use json.stringify() , json.parse() when dealing store in dom storage

python - How to recv large files using socketserver? -

server side recv , send data client: import socketserver class threadedtcprequesthandler(socketserver.baserequesthandler): def handle(self): try: data = b'' while true: package = self.request.recv(4096) if not package: break data = data + package self.request.sendall(data) except connectionerror conerror: print(conerror) class threadedtcpserver(socketserver.threadingmixin, socketserver.tcpserver): pass if __name__ == "__main__": host, port = "localhost", 50007 print('server start work!') server = threadedtcpserver((host, port), threadedtcprequesthandler) ip, port = server.server_address try: server.serve_forever() except keyboardinterrupt: print('server stop keyboard

sockets - How to receive an object on a socketServer in java -

i want send object(array) client server. use objectinputstream , objectoutputstream. however, invokes error, these methods not defined in serversocket class. how resolve situation ??` public int[] readresponse() throws ioexception, classnotfoundexception{ int[] x = new int[5]; objectoutputstream co = new objectoutputstream(serversocket.getoutputstream()); //here error objectinputstream ci = new objectinputstream(serversocket.getinputstream()); // here error co.writeobject(x); x = (int[]) ci.readobject(); (int = 0; < 5; i++){ system.out.println(x[i]); } return x; } a java.net.serversocket not meant used actual input , output; socket listening on server incoming connection requests accepted, resulting in java.net.socket 1 reading , writing. socket socket = serversocket.accept(); objectinputstream ci = new objectinputstream(socket.getinputstream()); on client side, java.net.socket created calling construct

android - No incoming transition animation for Activity -

i trying animate transition of activity. need activity animate when goes backstack i.e. call activity. i using : overridependingtransition(android.r.anim.fade_in, android.r.anim.fade_out); the arguments resource integers is there integer no animation? integer value or resource identifier there no fade_in fade_out. it looks 0 . lucky guess.

unix - How to mount file system without root access using C program? -

i facing 1 problem. requirement is, need mount nfs directory normal user. don't want use root . that, have developed below simple program achieve this. but, not working expected. my program : #include<stdio.h> #include<stdlib.h> #include<unistd.h> void usage( char *progname ) { printf("usage : %s {mount|umount}\n",progname); } int main( char argc , char *argv[] ) { if ( argc != 2 ) { usage( argv[0] ); return exit_failure; } if ( strcmp(argv[1] , "mount") == 0 ) { execlp("mount", "mount", "192.168.12.3:/home/share", "/home/share", null); } else if( strcmp(argv[1] , "umount" ) == 0 ) { execlp("umount", "umount", "/home/share", null); } else { usage( argv[0] ); return exit_failure; }

python - App Engine MapReduce performance optimization -

Image
performance difficult subject, let me try anyway. i'm using app engine mapreduce straightforward analysis , feel i'm not getting kind of performance expect. i have app engine module dedicated running single mapreduce pipeline. the module instances use basic scaling, instance class b4_1g , 16 maximum instances. the pipeline uses queue allows 100 concurrent requests. the pipeline uses 64 shards. as example of kind of performance i'm seeing, here 1 of map functions: map(data): """data handle cloudstorage file""" line = data.readline() while line: val in creates_values(line): yield val line = data.readline() data.close() the create_values function yields 1-5 strings, each forming single line in output. particular run i'm doing, each input file cloudstorage ~3mb or ~19k lines , each output ~14mb. have 64 of these files (one each shard) , processing time 4-10 minutes each shard. now,

array of submit buttons in different forms generated with php -

i dynamically create html forms loop in php , each submit button assigned name part of array. how can check submit button set , value? tried code doesn't work. <?php if($count_eksp){for($i=0; $i<$count_eksp; $i++){ $fusha_eksp = mysql_fetch_row($query1); echo "<br>$fusha_eksp[2] $fusha_eksp[3]<form method='post' action='<?php echo $_server['php_self']; ?>'><input name='eksp_edit[]' type='submit' value='$fusha_eksp[0]' height='20' width='20' ><input id='eksp_fshi[]' type='image' src='fshi.png' height='20' width='20'></form>"; }} ?> <?php if(isset($_post['eksp_edit[]'])){ foreach($_post['eksp_edit'] $id){ $query = mysql_query("delete `fusha_ekspertizes` `id`='$id'", $db_server); } } ?> you have error in if condit

Using iTunes Search API unable to find existing resource using iTunes ID -

the specific case: https://itunes.apple.com/gb/movie/112-weddings/id889327105/ movie id 889327105 . however, neither of following able find resource: https://itunes.apple.com/lookup?id=889327105&entity=movie https://itunes.apple.com/lookup?id=889327105 https://itunes.apple.com/lookup?isbn=889327105 https://itunes.apple.com/lookup?amgvideoid=889327105 https://itunes.apple.com/lookup?upc=889327105 i have been able reproduce id have tried: https://itunes.apple.com/lookup?id=593941435 https://itunes.apple.com/lookup?id=834624061 https://itunes.apple.com/lookup?id=519376363 https://itunes.apple.com/lookup?id=875243978 https://itunes.apple.com/lookup?id=594248614 i found resource : https://itunes.apple.com/search?term=112+weddings and able info id ( 988581839 ) : https://itunes.apple.com/lookup?id=988581839

c# - Change Notification Balloon Size -

Image
i have here windows forms application using notifyicon everything works fine in win 7 environment, until win10 came... the content of notification balloon has 9 lines. but when run app in win10, lines of notification content not shown in balloon. how can resize balloon in win10? [correct] win 7 notification: [not good] meanwhile in win 10: [update] notification balloon won't show in 64-bit os. 😴 i don't believe possible without hacking, if want examples on doing written here: http://www.codeproject.com/articles/37912/embedding-net-controls-to-notifyicon-balloon-toolt i advice you, if possible, move wpf (or use mix). wpf there component allows use custom popups. information on can found here: http://www.hardcodet.net/wpf-notifyicon

c++ - Unable to create multiple data files -

i trying create multiple file purpose , store different set of data them. code does't seems work. there trouble. not able enter teacher name in output window.please me correct code. here function using this. #include<iostream> #include<fstream> using namespace std; struct teacher{ int id; char name[50]; char subject[50]; char qualification[50]; char experience[50]; }; teacher teacher; void addition(int a) { char ans='y'; { teacher.id=a; fstream sfile; sfile.open("id.dat",ios::app|ios::out|ios::binary); cout<<"\n enter teacher name"<<endl; gets(teacher.name); cout<<"enter subject taught teacher"<<endl; gets(teacher.subject); cout<<"enter qualification "<<endl; gets(teacher.qualification); cout<<"enter experience"<<endl; gets(teacher.experience); sfile.write((char*)&teacher,sizeof(teacher)); c

How can I submit a Django formset within python code? -

background. want our users check if metadata read out of several images correct. therefore, show retreived data in formset let user check everything. in case metadata has errors (that happens) display them form errors here. problem. obtain error messages need bound forms. feeding our various data bound modelformset , taking care of managementform ... not simple. unbound version works fine. idea. if produce unbound form , submit within python code , simple way post data need create bound form.

Scala: pass Seq to var-args functions -

given function takes variable number of arguments, e.g. def foo(os: string*) = println(os.tolist) how can pass sequence of arguments function? write: val args = seq("hi", "there") foo(args) obviously, not work. foo(args:_*) trick. instead of applying sequence 1 single argument, each element in sequence used argument.

how to read data stored in output of findcontour function in opencv using c++ -

Image
i want label objects in binary image using find contour , drawcontour function. i want know data stored in output array of findcontour function. further, there other suitable methods above? @berak's comment answered already. i'll add part of how output like. consider 35x62 image 5 times enlarged version below. image has 6 blobs or objects each of has corresponding contour. the above image stored in mat object im . findcontour applied as cv::findcontours(im.clone(), contours, cv_retr_external, cv_chain_approx_none); the output of findcontour vector<vector<point>> object contours looks like: so, has 6 elements each corresponding 1 contour. let's take contours[0] example. looks like: contours[0] has 5 elements, each of stores coordinates of pixels form contour.

angularjs - php stdClass/object build -

i want build object (for angular) so user:{ {education: {high school:'some school'}, {faculty:'faculty of science'} }, {skills: {skill1:'sk1'}, {skill2:'sk2'} } } and php , mysql query: $testarr = array(); $user = new stdclass(); $params = db::select( db::raw("select param.*, sys_param_values.*,param_value.*,type_user.*, param.name paramname, doc_param.name docparamname param left join doc_param on param.doc_param_id = doc_param.id left join sys_param_values on param.id = sys_param_values.param_id left join param_value on sys_param_values.value_ref = param_value.id left

ruby on rails - Property from attr_accessor does not show when I render json -

in rails, have user model. added attr_accessor :score to model. if render json 1 user, not see "score" attribute. why this? user = user.find(3) user.score = 55 render json: user render json: user, methods: [:score] attr_accessor alternative getter , setter method method , have mentioned can call above

git - How to get Jenkins to perform deletes on remote server -

i trying started automated build process using jenkins. so far have managed jenkins build project bitbucket, run tests , upload files production server using publish on ssh plugin. when delete files git repo, files deleted on remote server. there few ways have thought doing already. wipe files on production server, upload latest build release. seems bad solution me, cause more downtime like. create script lives on remote server clean files after new build process. need find out git (somehow?) deleted files on commit were. instead of having jenkin use publish on ssh plugin, have git installed on production server, after successful build, can jenkins (somehow?) push project git production server. this seems common task developers, , feel missing here. there standard practice this.