Posts

Showing posts from September, 2012

tinkerpop - Gremlin Scala Neo4j: Search for node, add new node and edge between -

i unable find node via key , add new node , edge between them. movie nodes in graph, use: case class graphbuilder(movieid: int, personid: int) // val ident = key[string]("personid") val itemid = key[string]("movieid") // def applytograph(it: graphbuilder): unit = { val thisperson = graph + ("person", ident -> it.personid.asinstanceof[string]) val movies = graph.v.haslabel("movie").has(itemid, it.movieid) movies.headoption match { case some(v) => v --- "likedby" --> thisperson // tested println("yay" + v) case none => println("youre failure") } graph.tx.commit() } but each time run programmatically, correctly adds person graph via thisperson val, correctly finds movie vertex based on movieid, not create "likedby" edge. have tried without pattern matching on option not work either. what method best find node, add node, add edge between added , found? i'm bit con...

javascript - TypeError: Cannot read property 'split' of undefined | Schema issue? -

i cannot read property 'split' of undefined when following code: router.get("/startup/:id", function(req, res) { // uses id in url find id in // database passes data foundstartup startup.findbyid(req.params.id).exec(function(err, foundstartup){ if(err) { console.log(err); } else { var split = foundstartup.aboutstartup.techstack.split(","); res.render("startup/show", {startup :foundstartup, split: split}); } }); }); it used work went , removed '_' schema , therefore everywhere had schema called. have no idea why error pop now. have gone through every file created project , nothing left old references. have spent 2 ish hours on google , stackoverflow looking @ others solutions , none have worked me code started used work. suggestions on solutions? maybe should add error checking instead of later?

dplyr - Create a new column that displays multi column matches in R -

i want make new column, factors column 'a' have 1 match (value == 1) column 'b' assigned true. a <- c(555, 555, 555, 666, 666, 666, 777, 777) b <- c(1, 0, 0, 0, 0, 0, 1, 0) df <- data.frame(a, b) the result want is b c 1 555 1 1 2 555 0 1 3 555 0 1 4 666 0 0 5 666 0 0 6 666 0 0 7 777 1 1 8 777 0 1 thanks in advance, we can use dplyr package. library(dplyr) df2 <- df %>% group_by(a) %>% mutate(c = max(b)) df2 # tibble: 8 x 3 # groups: [3] b c <dbl> <dbl> <dbl> 1 555 1 1 2 555 0 1 3 555 0 1 4 666 0 0 5 666 0 0 6 666 0 0 7 777 1 1 8 777 0 1 or data.table package. library(data.table) dt <- as.data.table(df) dt2 <- dt[, c := max(b), = a] dt2 b c 1: 555 1 1 2: 555 0 1 3: 555 0 1 4: 666 0 0 5: 666 0 0 6: 666 0 0 7: 777 1 1 8: 777 0 1

ios - Show cell details using core data -

i have uitableview , want show each cell individually. also, have option delete each cell , edit. i'm using core data store users input. here code tableview import uikit import coredata class secondviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { @iboutlet weak var tableview: uitableview! var listathkar = [athkar]() override func viewdidload() { super.viewdidload() loadathkar() // additional setup after loading view. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func numberofsections(in tableview: uitableview) -> int { return 1 } func tableview(_ tableview: uitableview, numberofrowsinsection section: int) -> int { return listathkar.count } func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { let cell:tableviewcell = tableview.dequeuereusablecell(withidentifier: "cell", for:...

Events triggered in FragmentA when FragmentB is popped in android fragments -

what have i have activity mainactivity.java i have added fragment fragmenta mainactivity.java then add fragmentb mainactivity.java now when pop fragmentb land fragmenta what trying know i want know event in fragmenta triggered i want trigger event in fragmenta when pop fragmentb one way of doing use rxbus library https://github.com/anadea/rxbus . use rxbus.subscribe in fargmenta , rxbus.publish inside andother fragment

shoutem - Image not showing on details screen -

i tried tutorial on https://shoutem.github.io/docs/extensions/my-first-extension/using-ui-toolkit previewed on shoutem emulator details.js not showing image. solution? details the <overlay> tag taking builder defined values, in case tag overlay color . setting lower opacity (30%) , possibly black, resolve this. image load, it's default overlay value concealing it.

Redirect adding 1/2 second delay! -- moving from old O365 APIs to Microsoft Graph -

we have existing code uses old office365 api. in api, first step before oauth use discovery api identify appropriate end points api user signing in. different user domains had different end-points (something https://foo.my-sharepoint.com/ .... subseqently, api use rest methods against end-point. now trying move graph api. , find performance worse. root cause seems each api call graph api leads 302 redirect after 1/2 second delay! instead of looking appropriate endpoint, seems happen inefficiently on every single api call. has else seen this? workarounds? making our system way slower. some details requested @baywet ... the original request fetch content of file identified file path (constructed c# sdk): https://graph.microsoft.com/v1.0/me/drive/root:/appsheet//nationalparks.xlsx:/content after 0.6 second delay, gets 302 redirect to: https://1track-my.sharepoint.com/personal/praveen_1track_onmicrosoft_com/_layouts/15/download.aspx?uniqueid=d9019efd-887e-4c6c-80ce-8399afa91...

testing - Selenium ide- how to find a string in a text -

i have page of results (like in google result page) there need find string "testing code , more". if find string success if not fail the string in took whole text in page class above : //ul[@class='list-recent-events menu'] triad store whole text page command store | //ul[@class='list-recent-events menu'] | vari11 string store vari22 what command need use find string in page triad asserttext |${vari11} | ${vari22} allways give me error [error] element "testing code , more"" not found

android - Show different text content on same activity -

i working on first aid app, on main activity have list of around 40 diseases, when clicked on item, moves next activity showing different content related disease. question is, make 40 different activities each disease, or if not how make single activity show different content according clicked disease, , how style text content, because each content may contain different bullets, heading, length of text can different each disease. one activity , when start in intent send text images styles or whatever need intent diseaseintent = new intent(this, diseaseactivity.class) diseaseintent.putstringextra("key", textofdisease); startactivity(diseaseintent); and in diseaseactivity's oncreate use string textofdisease = getintent().getstringextra("key", "value if string null"); yourtextview.settext(textofdisease); you can add more fields to intent here documentation: https://developer.android.com/reference/android/content/intent.html luck ...

angularjs - Angular not reloading the whole window -

i have read answers $route.reload(); , $window.location.reload(); aren't working. want whole page refresh after server sends response. $http.post('/users/upload-dp',formdata,{ transformrequest:angular.identity, headers:{'content-type': undefined} }).then(function(res){ $route.reload(); //doesn't work $window.location.reload(); //doesn't work }); i have included correct cdn , module working fine. , reload mean current url i.e. " http://localhost:3000/home " should fired method.

asp.net - link not working after publishing to web server -

i new asp.net. have link in tree view open file located in web server on folder inside d drive. it's working file when visual studio when publish link doesn't work. foreach (fileinfo file in directory.getfiles()) { //add each file child node. treenode filenode = new treenode { text = file.name, value = file.fullname, target = "_blank", //navigateurl = @"c:/temp/car loan/aub.pdf" // navigateurl = (new uri(server.mappath("~/"))).makerelativeuri(new uri(file.fullname)).tostring() navigateurl = (new uri(server.mappath("~/"))).makerelativeuri(new uri(file.fullname)).tostring() }; directorynode.childnodes.add(filenode); } populatetreeview(directory, directorynode);

bash - Printing lines in which atleast one assignment operator(=) even if a conditional operator(==) exits in that line -

in unix scripting i have file has lines follows: if(a==b || b=c && c==d) if(a!=b) if(a=b) i have print lines having assignment operator i.e if(a==b || b=c && c==d) , if(a=b) anybody pls help so you're looking (simplistically) = on own, no other = abutting it. can done regex [^=]=[^=] (an = other = on both sides). unfortunately, capture things != or >= may want expand bit. start: grep '[^!<>=]=[^=]' inputfile that should catch vast majority although you're in same boat want process xml regexes rather xml processor - there edge case don't because regex far simpler tool language parser. however, stated, should fine weirdest of edge cases. and may still have handle cases (for example) = may @ start or end of line pretty unlikely since coder formatting code insane :-)

javascript - CanvasJS Chart - repeating values on Y-Axis -

Image
i have got issue canvasjs - i'm doing measurments on speed time of apis, problem - while i'm leaving 1 of api charts visible, values on y-axis repeating themselves. how can turn them off , leave 1 instance of each of values? i've attached screenshot , snippet of code used generate chart window.onload = function () { var chart = new canvasjs.chart("chartcontainer", { animationenabled: true, animationduration: 700, zoomenabled: true, title:{ text: "crm response time chart", fontweight: "bolder", fontcolor: "#008b8b", fontfamily: "tahoma", fontsize: 25, padding: 10 }, legend: { fontsize: 2...

VirtualBox Unresolved Error -

while using os x vm on virtualbox paused vm , gave me error. tried restarting , before past initial black screen, gave me error again. tried switching "use host i/o cache" , when started again, cpu halted entirely , vm shutdown during initial black screen on startup. couldn't figure out remade vm scratch , after using day got error again. know error means , how fix without trashing vm every time. way have plenty of hard drive space free on host allocated on vm. an error has occurred during virtual machine execution! error details shown below. may try correct error , resume virtual machine execution. i/o cache encountered error while updating data in medium: "ahci-0-0" (rc=verr_unresolved_error). make sure there enough free space on disk , disk working properly. operation can resumed afterwards. error id: blkcache_ioerr severity: non-fatal error

webpack - webpack3, Can I use watch mode and hot module replacement togerther? -

i use webpack -d -w develop. but want use hmr ,so can develop without using command + r reload whole page. i add hmr plugin new webpack.hotmodulereplacementplugin() when modify source files, webpack generate hot-update.js (1.3ddecfce7816ba3d41d6.hot-update.js) in dist directory. but there nothing change in page, hmr not working expected. i still need reload whole page.

webpack - Handsontable v0.34.0 not working with requirejs -

i using handsontable v0.34.0 , trying integrate using requirejs require config correct can see files loading fine moment, numbro , pikaday. when run call following code require(['jquery', 'handsontable'], function ($, handsontable) { let container = document.getelementbyid('container'); let hot = new handsontable(container, { data: dataset, width: 584, height: 320, colwidths: 47, rowheights: 23, rowheaders: true, colheaders: true, renderallrows: true }); }); i error uncaught typeerror: handsontable not constructor i strongly doubt has webpack code in handsontable.js converting h andsontable h andsontable in code , require-config solved problem. didnt have change distributed file. require(['jquery', 'handsontable'], function ($, handsontable) { to require(['jquery', 'handsontable'], function ($, handsontable) {

php - Codeigniter foreach and Tab trouble -

Image
i use codeigniter not long , knowledge in things php , mysql not good. have 2 problems , hope can me there. on 1 hand, how make open tabs. shows me first id , wants see tab other content. next problem. how display content selected tab? in old version have determined where. view: <div class="panel panel-info"> <div class="panel-heading "><h3 class="panel-title">porto hinzufügen</h3></div> <div class="navi-panael"> <ul class="nav nav-pills "> <?php foreach ($lands $land): ?> <li class="active"><a href="admin/porto/<?php echo $land['tb_land_id']; ?>" data-toggle="tab"><?php echo $land['tb_land_name']; ?></a></li> <?php endforeach; ?> </ul> </div> <div class="tab-content clearfix"> <?php// foreach ($lands $land): ?> <div cla...

javascript - MySQL query, PHP, infinite text and memory optimisation? -

i working on artistic project event. we're using a.i learning custom datasets made 2 pesonal libraries , we're using output sending data (generated texts) on mysql database , function datas, organized id, database when changes occurs. want set web publishing a.i perform writing happening during exhibition - write x words every x hours - hence why fancy design important. result used paper publishing. i'm using generated text testing our wip website i'm experiencing memory issue. after awhile, page slowing down computer, , happen on low end configuration. there way optimise ? here's test website : http://82.223.18.239/ and here's actual code : <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#"> .,,. .. z$$$$$b c$$$l ,,$$$$$$$f,,"?$$ .,,, ,c" z$$$$$$$$",$$$c`f . ,c$$$$,. ,$" d$$$$$...

android - Having a custom view of a 3rd party library view as an inner class within an activity -

i have activity in have referenced custom view 3rd party library . custom view multi-select spinner search extends spinner. i want customize view's performclick() behaviour further loading adapter after completing asynctask. meaning, upon clicking on view, show progress dialog in activity thread user knows adapter loading, run asynctask in background thread , once task completes, update adapter. this, have tried many suggested solutions after thoroughly searching web , so, each of them, i'm facing different challenges. i've explained them below: solution 1-create non-static asynctask , non-static inner class custommultispinnersearch within activity , executing asynctask in performclick() of custommultispinnersearch. challenge i'm not able inflate xml , keep getting "caused by: java.lang.nosuchmethodexception: [class android.content.context, interface android.util.attributeset]" error though have included required constructors , making them public. s...

python - How to generate a new Pandas dataframe where I compress some rows into a new column? -

i new pandas dataframe have been watching tutorials , reading documentation , cannot figure out way want. have dataframe indexed time stamps , want bucket period single row. graphically: # start date of series start_date='20130101' # range of dates dates = pd.date_range(start_date, periods=6) # random dataframe df = pd.dataframe([["(1,1)","(1,2)"], ["(2,1)","(2,2)"], ["(3,1)","(3,2)"], ["(4,1)","(4,2)"], ["(5,1)","(5,2)"], ["(6,1)","(6,2)"]], index=dates, columns=list('ab')) print(df) # range of bucketing periods, in case 3 periods covering 2 days each rng = pd.period_range(start_date, periods=3,freq='2d') this results in b 2013-01-01 (1,1) (1,2) 2013-01-02 (2,1) (2,2) 2013-01-03 (3,1) (3,2) 2013-01-04 (4,1) (...

javascript - Animation to show / hide script using css -

i want add fade in / fade out effect hidden block (id = "help"). how can animate block using pure css? also, want animate link (id = "show) after clicking. please , give me examples. see code: var showelem = document.getelementbyid("show"); var hideelem = document.getelementbyid("hide"); var helpdiv = document.getelementbyid("help"); helpdiv.style.display = 'none'; hideelem.style.visibility = 'hidden'; showelem.onclick = function() { showelem.style.visibility = 'hidden'; hideelem.style.visibility = 'visible'; helpdiv.style.display = 'block'; }; hideelem .onclick = function() { hideelem.style.visibility = 'hidden'; showelem.style.visibility = 'visible'; helpdiv.style.display = 'none'; }; div#help { border: 1px solid black; height: 200px; width: 300px; pad...

php - @yield, @section in Laravel -

hello want load shopreq.blade.php file in master.blade.php , successful in doing this. when load modals.blade.php file in shopreq.blade.php not included. doing wrong here? please help. master.blade.php (in views/layouts): <html> <body > @yield('content') </body> </html> shopreq.blade.php (in views) @extends('layouts.master') @section('content') <h1>hello in shopreq.blade.php @yield(content) @endsection modals.blade.php (in views) @extends('shopreq') @section('content') <h1>hello in modals.blade.php @endsection web.php: route::group(['middleware' =>['web']], function() { route::get('/', function () { return view('welcome'); })->name('home'); }); as user milo526 has said. you have @yield('content') twice. for blade directive (yield, section, component...) if there same name inside br...

c++ - How to store a list of strings -

i want store list of strings generate. don't know amount of strings , don't want store them if there identical string in list. want able count amount of strings in list. thanks! use std::set container automatically keeps elements sorted , allows distinct elements (no duplicates), e.g. : std::set<std::string> s; s.emplace("arthur"); s.emplace("barry"); s.emplace("barry"); s.emplace("barry"); s.emplace("charlie"); std::cout << std::size(s) << std::endl; // outputs '3'. if need fast access , seldomly update container might use std::vector , remove duplicates after every insertion. std::vector<std::string> v; v.emplace_back("arthur"); v.emplace_back("barry"); v.emplace_back("barry"); v.emplace_back("barry"); v.emplace_back("charlie"); std::sort(std::begin(v), std::end(v)); // sort needed 'std::unique' work. v.erase(st...

How can I re-publish an android app on Google play? -

Image
i had unpublished app on google play reason. want give shot , re-publish same app. can't see such option in play console. rolling out new release didn't help. its in pricing , distribution section of google play.

destructor - Parameter "size" of member operator new[] in C++ -

4 classes in following codes: a, b, c , d. they have member operator new[] . besides, b has constructor; c has destructor; d has member operator delete[] . the parameter size of member operator new[] , sizeof of 4 classes output: new[] 40 new[] b 40 new[] c 48 new[] d 48 sizeof(a) 4 sizeof(b) 4 sizeof(c) 4 sizeof(d) 4 what's reason differences of size ? codes(ugly know): #include <iostream> using namespace std; class { int i; public: static void* operator new[](std::size_t size) throw(std::bad_alloc) { cout << "new[] " << size << endl; return malloc(size); } }; class b { int i; public: static void* operator new[](std::size_t size) throw(std::bad_alloc) { cout << "new[] b " << size << endl; return malloc(size); } b() {} }; class c { int i; public: static void* operator new[](std::size_t size) throw(std::bad_alloc) { ...

css - What does (.browser-default).valid mean? -

currently going through code on internet , found part of code input[type=text]:not(.browser-default).valid . in following code know :not used for. have following question: what (.browser-default) part of code , can find more information it? i know :valid not .valid ? , can read exact functionality? both . browser-default , .valid user-defined class names. not part of css selectors module - won't find more information them! in contrast, :not , :valid css pseudo classes , are defined within css selectors module . so basically, selector input[type=text]:not(.browser-default).valid matches text input class valid , without class browser-default

eclipse - Invalid escape sequence \\ is used but it still doesnt work in java for my file path -

i have read other posts , answers , applied them still doesnt work. i brand new java in class it's online , accelerated it's bit difficult me understand @ quick pace please bear me if don't understand. string filename = "c:\\users\\jonathan lee\\eclipse-workspace\myfile.text"; i have , i've tried different amount of backslashes seems create more errors. you have escape each backslash that: string filename = "c:\\users\\jonathan lee\\eclipse-workspace\\myfile.text"

javascript - Is it possible to called angular service in separate js file in chrome extension? -

i create simple chrome extension , can save sentence on database. application written in angular4 using firebase authentication. api set on nodejs server. on home page, user has ability login google or facebook account. if user logged in, page saved sentences displayed him. on page can add sentence manually (by form). user can save sentence page using contextmenu. @ moment, if user mark , try sentence, showing alert. it's implemented in way: part of manifest.json ... "background": { "persistent": true, "scripts": ["home.js", "context-menu.js"] }, ... "permissions": [ "tabs", "contextmenus" ], ... and context-menu.js var addsentence = function(info, tab) { console.log(info, tab); alert(info.selectiontext); }; var parent = chrome.contextmenus .create( { "title": "add \"%s\"", "contexts": ["selection...

How facebook pixel tracking works across devices/browsers? -

i read here "if audience moving between desktop, mobile or tablet devices, wasting budget on wrong audience." how can facebook team identify these people 1 person? example, today visit airbnb office laptop (through browser have never logged facebook), go facebook other device on different network. can facebook identity same user? if yes how that? ip based tracking? (makes sense if pass email/mobile/ip)

node.js - Best way to add helper methods to context object in Koa2 -

i add method such view , json context object passed controllers. in middleware runs before else: async function(ctx, next){ ctx.view = view.bind(ctx); ctx.json = json.bind(ctx); await next() ctx.renderer.render(); } these methods set conventional configuration object (renderer) middleware interprets , renders out actual response setting correct ctx.body . allows me switch template language , have easier time combining api , template requests. except doesn't work because after await next() ctx.renderer default one, not 1 set controllers. suspect it's namespacing issue, not sure comes from. what's best practice attach functions context can reference context without being passed them? ok it's here in docs missed it, docs inside repo , not hosted, makes them hard navigate. tl;dr: use app.context access context prototype. adding functions there attaches them context object , allows use this within access it.

javascript - Splicing a specified user -

i'm trying remove specific user list, i'm trying make when user has id gets spliced list, reason following code doesn't splice user other user, why this? this following test code used: var users = []; users.push({ user: 1, name: 'user1' }); users.push({ user: 2, name: 'user2' }); var interval = setinterval(function(){ console.log(users); }, 1000); settimeout(function(){ users.splice(finduser(2), 1); }, 5000); function finduser(id){ for(var i=0; < users.length; i++){ if(users[i].user === id){ return users[i]; } } } here fiddle . first add 2 people list, have test interval running spitting out every user in list, after 5 seconds remove user id 2, reason doesn't work. splice takes index remove, not value. you can modify finduser function finduserindex function: settimeout(function(){ users.splice(finduserindex(2), 1); }, 5000); function finduserindex(id){ for(v...

Django - Login required redirect url -

if user not logged-in, want redirect admin page , when user logs in, should redirected previous url. this how i'm doing:- login_url = '/admin' login_redirect_url = '/admin' the user redirected admin page after logging in, admin dashboard open, not next url. that's because url not django expecting. this how url looks like. http://127.0.0.1:8000/admin/login/?next=/admin/%3fnext%3d/movies/fav%253fpage%253d1 what missing? tried this. , worked. login_url = '/admin/login/'

php - Send notification from laravel store function -

i have notification system send posts telegram channel created. this source: https://github.com/laravel-notification-channels/telegram my notification system works fine , issue have cannot correct post link, send notification once post has created postcontroller under store function. i have code after $post->save(); $post = \app\post::first(); $post->notify(new \app\notifications\postpublished($post)); as can see send post id 1 telegram channel tried find(1) , got same result. my question now: how same post created send channel? code: $post = \app\post::first(); first row in posts table it means first row in table you dont need use after $post->save(); just send notification without using $post = \app\post::first(); after save for example: $post->save(); $post->notify(new \app\notifications\postpublished($post));

php - Angularjs - Loading $http response item Less than 5 at a time -

i'm working on product catalog application using ionic framework , php retrieve product database , ajax load in frontend, every thing working great, when try filter category response return json more 1xxx items inside , hurt user experience . code -> controllers-> $scope.$on('$statechangesuccess', function() { $scope.loadmore(); //added infine scroll }); // loadmore() called inorder load list $scope.loadmore = function() { str=sharedfilterservice.geturl(); $http.get(str).success(function (response){ window.localstorage.setitem( 'app-name', json.stringify(response)); var appdata = json.parse( window.localstorage.getitem( 'app-name' )); $scope.menu_items = appdata; $scope.hasmore=response.has_more; //"has_more": 0 or number of items left $scope.$broadcast('scroll.infinitescrollcomplete'); }); }; services -> .factory('sharedfilterservice', ...

android - Error locationManager.getLastKnownLocation -

i follow tutorial haversine formula here function lokasi() in mainacitvity private void lokasi(){ location = locationmanager.getlastknownlocation(provider); if (activitycompat.checkselfpermission(this, manifest.permission.access_fine_location) != packagemanager.permission_granted && activitycompat.checkselfpermission(this, manifest.permission.access_coarse_location) != packagemanager.permission_granted) { return; } // permintaan update lokasi device dalam waktu 10 detik locationmanager.requestlocationupdates(provider, 10000, 1, this); if(location!=null){ onlocationchanged(location); calllistvolley(latitude, longitude); }else{ toast.maketext(getbasecontext(), "lokasi device pengguna tidak ditemukan.\nmohon hidupkan gps.", toast.length_long).show(); calllistvolley(-6.894796, 110.638413); } } so when run , error appear fatal exception: main ...

powershell - Get-Service unable to open service control manager -

i have function checks status of particular service on remote machine. when try service status using get-service -computername remoteserver , following error. get-service : cannot open service control manager on computer 'remoteserver'. operation might require other privileges. this error happens in 1 or 2 servers, when use get-wmiobject -class win32_service -computername remoteserver service information. could please identifying problem in here? having administrator privileges on remote machine , running script powershell ise administrator. on investigation, found port 445 in not_listening state. issue caused disabled server service. issue resolved after enabling , starting service. following link useful in resolving issue thank looking error , suggesting edits on question. first question in stack overflow , loving experience.

c++ - Modifying dynamic data like string in binary files -

i have binary file contains records of student each record instance of class student defined as: class student { string idno, sname; int books_issued; vector<string> bname; public: void save(fstream &of); void load(fstream &inf); void modify_student() { cout<<"id no:\t"<<idno<<"\n"; cout <<"modify student's name:\n"; cout<<"enter name:\t"; cin.ignore(); getline(cin, sname); } //some more code here }; i writing record in file using save member function: void save(fstream &of) { unsigned len = idno.size(); of.write((char *)&len, sizeof(len)); of.write(idno.c_str(), len); len = sname.size(); of.write((char *)&len, sizeof(len)); of.write(sname.c_str(), len); of.write((char *)&books_issued, sizeof(books_issued)); len = bname.size(); of.write((ch...

arrays - PHP Dropdown value * Price computation is not accurate it is being doubled -

product - 1 * 19.99 total : 59.97 the computation inaccurate please me code literally don't know i'm new in php appreciated thank you. for loop code on dropdown <td><select name="cboqty[<?php echo($i); ?>]"> <?php for($qty[$i]=0; $qty[$i]<=5; $qty[$i]++) echo '<option>' .$qty[$i]. '</option>'; ?> </select> </td> process button if(isset($_get["cboqty"])) { $mycbo = $_get["cboqty"]; foreach ( $_session["cart"] $i ) { $_session["amounts"][$i] += $mycbo[$i] * $amounts[$i]; } }

mongodb - Aggregate $lookup Total size of documents in matching pipeline exceeds maximum document size -

i have pretty simple $lookup aggregation query following: {'$lookup': {'from': 'edge', 'localfield': 'gid', 'foreignfield': 'to', 'as': 'from'}} when run on match enough documents following error: command failed error 4568: 'total size of documents in edge matching { $match: { $and: [ { from: { $eq: "genedatabase:hugo" } }, {} ] } } exceeds maximum document size' on server all attempts limit number of documents fail. allowdiskuse: true nothing. sending cursor in nothing. adding in $limit aggregation fails. how be? then see error again. did $match , $and , $eq come from? aggregation pipeline behind scenes farming out $lookup call aggregation, 1 runs on own have no ability provide limits or use cursors with?? what going on here? as stated earlier in comment, error occurs because when performing $lookup default produces target "array" within parent...