Posts

Showing posts from March, 2014

c# - Testing Event driven behavior -

there seems ton of advice sorta thing in context of gui application. think particular scenario different enough warrent me asking. sum question how test events? now long winded explanation. i've worked point of service hardware little while now. means had write few opos service objects. after few years of doing managed write first com visible c# service object , put production. tried best unit test entire project found rather difficult, able come unit tests of service object's interface implementation. hardest part event's part. granted scenario biggest , common 1 faced, i've come across similar scenarios in other applications of mine testing event seemed awkward. set scene common control object (co) has @ 5 events person can subscribe too. when co calls method open opos finds service object (so) , creates instance of it, calls it's openservice method. third parameter of reference co. don't have define entire co, have define call method 5 events. example o

copying local file after compile time with file resource in CHEF -

trying copy file locally doesn't exist @ compile time. example: remote_file "/httpfile" source "http://wiki.opscode.com/display/chef/home" mode "0666" end file "/httpfile.bak" content io.read("/httpfile") only_if {file.exists?("/httpfile")} end this code give error: no such file or directory - eventough only_if being used. because io.read happens @ compilation time before file makes system. (4 year old email - http://lists.opscode.com/sympa/arc/chef/2011-08/msg00182.html ) is there way force content io.read("/httpfile") executed @ execution time? or better way now? thanks you should able use lazy evaluation take care of this. believe syntax this: remote_file "/httpfile" source "https://docs.chef.io/" mode "0666" end file "/httpfile.bak" lazy { content io.read("/httpfile") } only_if {file.exists?("/httpfile&

Bash - Reasons for stderr to fill up? -

i wrote script works should, reason stderr being filled something. can go in there , how can prevent happening? here's scripts, gets directory first argument , names of people next x arguments. #!/bin/bash authors=$# args=("$@") ((i = 1; < authors; i++)); echo ${args[${i}]} d in `find $1 -type d`; appearances=`grep -c ${args[${i}]} $d/*.comp` if [ "$appearances" -gt 0 ]; filename=`grep -l ${args[${i}]} $d/*.comp | rev | cut -d '/' -f 1 | rev | cut -d '.' -f 1` results=`get_test_stats $d | grep -w ${args[${i}]} | cut -d" " -f2-3` echo $filename: $results fi done done thank you! commands find , grep may encounter variety of conditions may unexpected or not reflected in output written stdout . inform user of such condition, warning written stderr , example: grep: binary file [...] matches find: `[...]': permission denied in interactive

php - Making a directory based on username? -

i trying create directory mkdir code. when use code : mkdir("test"); then, "test" directory created. when try this mkdir($_session['username']); then, got error saying warning: mkdir(): open_basedir restriction in effect. file() not within allowed path(s) what mean? tried $path = $_session['username']; mkdir($path); and mkdir("".$_session['username'].""); but gives me same error message. supposed do? make sure prefix folder name full path want create folders. ie, if trying create folders under /tmp/users might use code like: mkdir('/tmp/users/' . $_session['username']); you need make sure have configured php allow access path. see open_basedir ini directive: http://php.net/manual/en/ini.core.php#ini.open-basedir

angularjs - I'm having trouble with ngTableParams refreshing -

i can't seem figure out refresh. can intial load of page, when function getactivity() run doesn't update page. @ loss. tried many different things no success. this code below being called factory uaappcommon.tableparams = function(data,sortfieldorder){ var table = new ngtableparams({ //page: 1, // show first page count: data.length, // count per page sorting: sortfieldorder }, { counts: [], //hides page sizes total: data.length, // length of data getdata: function($defer, params) { // use build-in angular filter var ordereddata = params.sorting() ? $filter('orderby')(data, params.orderby()) : data; $defer.resolve(ordereddata.slice((params.page() - 1) * params.count(), params.page() * params.count())); }

cloud9 ide - cloud 9 creating 2 workspaces when I try to create 1 -

i signed (free) c9 account; verified email address etc. i selected create new workspace , selected "ruby on rails", "private people invite" (i'm under impression 1 free private workspace?), name "tprord" (abbreviation of course i'm taking), , select "create" expected behavior: hoped see in left "my projects" pane, adjacent default "demo-project", new project entitled "tprord". observed behavior: there new 'open , discoverable' project entitled "tprord"; , 'greyed-out' project entitled "tprord" listed 'processing'. when "tprord" selected, expected "start editing" button replaced 1 entitled "cancel creation". i have posted question on cloud9ide.zendesk.com , have started going , forth support - long lags due time zones. has else seen this? tks! -rb (may be) solved: appears fixed on it's own - know, litt

How can I add a callback or hook to a Python builtin class method? -

i trying gather information on files being opened , closed can keep track of processes doing what. work users not systematically use custom i/o functions , methods change behavior of builtins. i figured out way change open function. might not optimal, works. import logging import os import sys import io import logging import __builtin__ def custom_open(file_name, access_mode, buffering = 0): logging.debug('opening file ' + file_name) return __builtin__.open(file_name, access_mode, buffering) logging.getlogger('').setlevel(logging.debug) open = custom_open f = open('workfile', 'w') f.write('this test\n') f.close() what change behavior of file close method. tried few things nothing works. to elaborate little on comment, since nobody else seems submitting answer: # create custom file class class custom_file(file): def close(self): # logging super(file, self).close() # create custo

python - Sublime Text 3083 CMD.exe error -

just upgraded 3083 3065, every time run script get: cmd.exe started above path current directory. unc paths not supported. defaulting windows directory. the script still runs makes me uncomfortable seeing every time build. not occuring in 3065, how can elminate issue? because having unc directory default can cause programs started in console crash if console closed. in testing have never seen program crash. it's meant old programs. there registry key allow unc paths. hkey_current_user\software\microsoft\command processor disableunccheck = dword (1 = true, 0 or absent = false) however cmd won't let change one. way make happen start cmd shortcut default directory set unc path (and other command allows default path set program being started). so how starting it? there directory being specified. on network, or specified if on network (ie 127.0.0.1 or localhost or machinename )

c - logic applied to pointer to string array -

i came across question in interview process. need understand logic behind 2nd output of program. #include <stdio.h> char *c[] = {"geksquiz", "mcq", "test", "quiz"}; char **cp[] = {c+3, c+2, c+1, c}; char ***cpp = cp; int main() { printf("%s ", **++cpp); //1st statement printf("%s ", *--*++cpp+3); //2nd statement printf("%s ", *cpp[-2]+3); //3rd statement printf("%s ", cpp[-1][-1]+1); //4th statement return 0; } output:- test squiz z cq what understand above code: for sake of simplicity can consider cp[] {quiz test mcq geksquiz} 1st statement: **++cpp -> cpp points base address of test , dereferencing 2 times gives test fine. but in 2nd statement can't demystify logic: *--*++cpp+3 -> ++cpp points mcq *++cpp address of m , --*++cpp previous address m , i'm stuck here. how it's getting squiz output? (afaik ++(suffix) , * have

python 2.7 - Why won't my nltk classification model persist with joblib? -

i've noticed others have had problems on different operating systems , i've heard there may within module disallows loading persistent classification model. i'm using mac python 2.7 , enthought canopy's editor. this i'm using export , appears work: joblib.dump(classifier, 'nbv1.pkl') and i'm using import via shell: joblib.load('nbv1.pkl') this error get: attributeerror: 'freqdist' object has no attribute '_n' i'm assuming means model not exporting properly. have not been able automate export process within program , must shell. thank advice. i believe due compatibility issue nltk classifiers.

ruby on rails - How to use nested_attribute boolean to change font color in sidebar? -

when user checks off :good in _form how can render font color green of result in sidebar? we made work in index: how change font color based on conditional? . but sidebar logic making trickier rendering additional quantified/result every result when tried (we try address issue furthur here: how stop double rendering in sidebar? ): <% @averaged_quantifieds.each |averaged| %> <% averaged.results.each |result| %> <% if result.good == true %> <div class="green"> <li> <%= raw averaged.tag_list.map { |t| link_to t.titleize, tag_path(t) }.join(', ') %><%= link_to edit_quantified_path(averaged) %> <%= averaged.results.first.result_value %> <%= averaged.metric %> <span class="label label-info"> <%= averaged.results.first.date_value.strftime("%b") %></span><% end %> </li> <% else %> <div class="red"

c# - Xamarin error: Pkcs does not exist in System.Security.Cryptography on Android -

i'm getting error cs0234: type or namespace name 'pkcs' not exist in namespace 'system.security.cryptography' (are missing assembly reference?) when compiling android. the code shared library referenced in android , mono targets. android's target framework 4.4 (tried 5.0 no avail). mono .net 4.5. android's version references mono.android , mono.security (2.0.5.0), mono version - system.security 4.0.0.0. if add conditional compilation directive turn off android , leave mono, builds. http://androidapi.xamarin.com/?link=t%3asystem.security.cryptography.pkcs.signedcms states android supports this. xamarin, however, not offer me system.security.dll , instead there mono.security in case of android. how can system.security.cryptography.pkcs under android? i'm pretty sure system.security.dll not supported xamarin.android (nor xamarin.ios). it's mistake docs exist xamarin.android. i've been maintaining (slight) fork of bouncy cas

php - Accessing a user input field name that contains a space -

i have situation; know can print data query string this; <? $firstname = $_get['firstname']; echo $firstname; ?> issue is, have form firstname , lastname fields space in name, this; <input type="text" class="text" name="name (awf_first)" value="" onfocus=" if (this.value == '') { this.value = ''; }" onblur="if (this.value == '') { this.value='';} " tabindex="500" /> <input id="awf_field-72073394-last" class="text" type="text" name="name (awf_last)" value="" onfocus=" if (this.value == '') { this.value = ''; }" onblur="if (this.value == '') { this.value='';} " tabindex="501" /> so in situation need print first name , last name on success page of form submit. approach should use? i tired these 2 things didn't worked; $firstnam

change style of each item in listbox C# Wpf -

Image
i want change style of each item in listbox this but in case, want change color , font style (italic, bold) of each item, items in listbox added programmatically how change style of each item? you can create view model class data items has necessary properties, like class dataitem { public string text { get; set; } public brush foreground { get; set; } public fontstyle fontstyle { get; set; } public fontweight fontweight { get; set; } } and bind these properties in itemtemplate of listbox. example below assumes items property in view model returns collection of dataitem objects. <listbox itemssource="{binding items}"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding text}" foreground="{binding foreground}" fontstyle="{binding fontstyle}" fontweight="{binding fontweight}&quo

evaluate the car of a list as a function in lisp -

i doing homework , need help. don't want me give me guidance. need write function takes list of 2 numbers , operator written in traditional notation (3 + 2) , yield same function in prefix notation (+ 3 2) , evaluate (5). can convert 1 notation other when need evaluate going force car of list (+) function rather element of list , pass car of list (3 2) parameters function. thing don't know how force + + instead of '+'. again don't want write function me set me on right track. use fdefinition convert symbol function object (optionally) , use apply (if not know number of arguments) or funcall (if do) invoke function.

ios - Latency in plotting microphone input -

i using avfoundation in order microphone input , ezaudio plot microphone input. have stripped down code basic , still latency, weird. code: override func viewdidload() { super.viewdidload() //audio stuff let buffersize: avaudioframecount = 2048 //plot properties bufferplot.color = uicolor(red: 0.5, green: 0.0, blue: 0.0, alpha: 0) bufferplot.backgroundcolor = uicolor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0) bufferplot.plottype = .buffer //instantiate nodes engine = avaudioengine() input = engine.inputnode mainmixer = engine.mainmixernode //put tap on main mixer. mainmixer.installtaponbus(0, buffersize: buffersize, format: mainmixer.inputformatforbus(0)) { (buffer: avaudiopcmbuffer!, time: avaudiotime!) -> void in //change buffer size 2048 buffer.framelength = buffersize //plotting dispatch_async(dispatch_get_main_queue(), { () -> void in self.bufferplot.updatebuffer(buffer

osx - How do I get the line and column number of a character at some index in Text View? -

i have nstextview in have lots of text. how can line , column number of character @ index? lets say, have text in nstextview : "this a\ndummy text\nto show you\nwhat mean." and need line , column number 16th character. in case: line: 2 column: 2 how can calculate/get using swift? another example: "this a\ndummy text\nto show you\nwhat mean." and want line , row number 15th (or 16th, if \n counted too) character, this: line: 2 column: 1 you need break text lines using string method componentsseparatedbystring, need keep count of lines, columns , character position follow: extension string { func characterrowandlineat(#position: int) -> (character: string, line: int, column:int) { var linenumber = 0 var characterposition = 0 line in componentsseparatedbystring("\n") { linenumber++ var columnnumber = 0 column in line { characterposition++

c# - Adjusting column/row width/height based on the number of them -

Image
i have tablelayoutpanel 2 rows , 2 columns called gamegrid . when button1 pressed want: a column , row added, all columns adjusted equal widths, all rows adjusted equal heights. this i've tried far: //add new row , row style gamegrid.rowcount++; gamegrid.rowstyles.add(new system.windows.forms.rowstyle(system.windows.forms.sizetype.absolute, 10)); //change rowstyles entire width / number of rows foreach (rowstyle style in this.gamegrid.rowstyles) { style.sizetype = sizetype.percent; style.height = gamegrid.width / gamegrid.rowcount; } //do same columns gamegrid.columncount++; gamegrid.columnstyles.add(new system.windows.forms.columnstyle(system.windows.forms.sizetype.absolute, 10)); foreach (columnstyle style in this.gamegrid.columnstyles) { style.sizetype = sizetype.percent; style.width = gamegrid.height / gamegrid.columncount; } but doesn't quite work , end this: why last column/row longer rest, , work instead?

"The operating system denied access to the specified file" in Cygwin bash -

d@desktop /cygdrive/c/users/test/otherfolder $ cygstart --action=runas ping -c 1 www.google.com | grep 'bytes from' | cut -d = -f 4 unable start 'ping': operating system denied access specified file . d@desktop /cygdrive/c/users/test/otherfolder $ i trying run scripts on cygwin, can't script running reasons. tried run administrator, tried using cygstart --action=runas , nothing seems work. idea? chmod 755 ping set permissions of file. should work.

javascript - anonymous function vs identical named function -

this question has answer here: jquery callback defined function 3 answers i'm having issues writing of first jquery code. i'm experimenting codecademy stuff, messing around , seeing how works. right i'm pretty confused issue anonymous functions: calling function anonymously works naming function , calling name not. code supposed to, on clicking icon, open menu left side of screen , shift rest of page right; reverse on clicking close icon. first code block works perfectly, second opens , closes menu after page loads , nothing. there i'm missing order of operations in js/jquery or what? anonymous: function main() { $('.icon-menu').click(function() { $('.menu').animate({left:'0px'}, 200); $('body').animate({left:'285px'}, 200); }); $('.icon-close').click(function() { $('.menu')

javascript - AJAX loop, calling function onload vs. manually in the console/code -

i have 2 functions: function find_existing_widgets(){ xmlhttp = new xmlhttprequest(); xmlhttp.open('get', './_includes/check-load-user-settings.php', true); xmlhttp.onreadystatechange = open_existing_widgets; xmlhttp.send(null); } function open_existing_widgets(){ if(xmlhttp.readystate==4 && xmlhttp.status==200) { xmlresponse = xmlhttp.responsexml; root = xmlresponse.documentelement; var widget_id = root.getelementsbytagname('widget_id'); var name = root.getelementsbytagname('name'); var type = root.getelementsbytagname('type'); var value = root.getelementsbytagname('value'); for(i= 0; i< name.length; i++) { nametext = name.item(i).childnodes[0].nodevalue; widgetid = widget_id.item(i).childnodes[0].nodevalue; //var value = name.item(i).firstchild.data; alert(nametext); nam

apache - Why is __FILE__ and DOCUMENT_ROOT returning C:\path\to\webserver -

echoing out __file__ and $_server['document_root'] on apache server returning string(26) "c:/users/me/my sites/pathtofile/" . what's that? it's being used in codeigniter lot (and breaking them) files come out as: <link href="c:/assets/css/main.css?c=" media="all" rel="stylesheet"/> i'm running apache/2.4.9 (win64) if helps. as ariful mentioned, __file__ constant set php , $_server['document_root'] array of settings web server. these used throughout codeigniter , fuel cms handle file includes. if you're looking output css path view, there helper this: echo css_path('main.css'); // outputs "http://example.com/assets/css/main.css" more info , other asset helpers can found here: http://docs.getfuelcms.com/helpers/asset_helper

Subscriber Only Views on YouTube -

i've checked traffic sources on youtube analytics. however, not see checkbox subscriber views i've been reading about. there other way can see views coming subscribers youtube. in analytics user interface, there (currently - i'm sure change ui) dropdown in top left defaults "subscribed & not subscribed" via api, haven't been able find equivalent parameters. the insighttrafficsourcetype dimension give sum of people arrived @ video through various 'subscriber' entry points, isn't same views subscribers.

How to add an image to an object in Java? -

this question has answer here: load image filepath via bufferedimage 5 answers i'm trying add proper images each card object, can't seem work. tried incorporate filldeck() method, not sure best way it, be. here's got: public void filldeck() { iterator suititerator = cardsuit.values.iterator(); while(suititerator.hasnext()) { cardsuit suit = (cardsuit) suititerator.next(); iterator rankiterator = cardvalue.values.iterator(); while(rankiterator.hasnext()) { cardvalue value = (cardvalue) rankiterator.next(); /* problem area :l */ string imagefile = imagelocation + card.getimagefilename(suit, value); imageicon image = new imageicon(getimage(getcodebase(), imagefile)); /* --------------------------- */ card card = new card(suit, value, image); addcard(card); }}} i

c - Where to go from here when manipulating files -

#include <stdio.h> #include <stdlib.h> #include <math.h> struct student { int stdntnum[8]; float homework; float lab; float midterm; float finalgrade; float overall; }; int main() { file *fileptr, *file2ptr; char headers[30]; int string[100]; fileptr = fopen("lab5_inputfile.txt", "r"); file2ptr = fopen("lab5_outputfile.txt", "w"); fgets(headers, 30, fileptr); printf("%s", headers); fprintf(file2ptr, "%s\toverall grade\n", headers); fclose(fileptr); fclose(file2ptr); } hey guys,my assignment manipulate example of file shown here: id homework lab midterm final 1016807 89.0 93.0 78.0 50.0 1211272 84.0 78.0 23.0 59.0 i've gotten headings read , write on new file, i'm unsure how approach second part. need change first few numbers of id column x [e.g: xxx6807] , use following

css - HTML - overflow and position absolute issue -

i have child margin-top . in order apply margin-top correctly need overflow auto parent. unfortunately overflow auto cut off overlapping children had been positioned absolute. there work around? js fiddle html <div class="a"> </div> <div class="b"> <div class="overlap" ></div> <p> lorem ipsum, arula jkasds </p> </div> css .a { position: relative; width: 100%; background-color: #005a73; height: 100px; overflow: auto; } .overlap { width: 50px; height: 80px; position: absolute; background: yellow; top: -60px; left: 20px; } .b { /*overflow: auto; */ position: relative; width: 100%; height: 840px; background-color: #f7f7f7; } p { margin-top: 50px; } here how might solve problem. wrap regular content in separate div ( .wrap ) , specify overflow: auto on it. that way, can still adjust absolutely positioned element want , overflow/sc

mysql - Using SQL Union to perform complex report query that depends on increasingly more relaxed conditions -

i have following schema (part of pertains question): # schema - table * table field # schema - mods * id * title * affiliation * attended - modusergrades * modid * userid * questionvalues * grade * accepted * comments - users * id * projects * location * grade * termid - * email * firstname * lastname * userid * modid * termid once mods have registered event, able attend event (if log in during time, attended set 1). there, able grade number of users , maxusers . if have graded ( questionvalues != null && grade != null ) less maxusers , have started grading, if have graded maxusers have finished grading. now, want able differentiate between following classes of mods : mods have registered, did not attend (i.e. attended = 0) mods have attended event did not start grading (

git - ssh asks for password even though I have my keys generated -

i'm working git repositories in gitlab server inside company. today installed opensuse on machine , when tried clone repos through ssh, gitlab kept asking me password did not have. before opensuse had ubuntu , worked fine. i have generated keys , updated public 1 gitlab server (which have no access to). i tried using gitlab password , nothing but: permission denied, please try again and on third try get: permission denied (publickey,password). fatal: not read remote repository. please make sure have correct access rights , repository exists. this open ssh version: openssh_6.6.1p1, openssl 1.0.1k-fips 8 jan 2015 my suse version: opensuse 13.2 (harlequin) (x86_64) 64-bit and trace sshing gitlab: openssh_6.6.1, openssl 1.0.1k-fips 8 jan 2015 debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: applying options * debug2: ssh_connect: needpriv 0 debug1: connecting gitlab.enterprise.it [10.254.150.

will Spark support Clojure? -

i start learning functional programming , clojure appeals me most, love community, syntax , concept of immutable data structures. interested in bio inspired ml rich data numenta . however, huge concern spark not support yet, , spark rocks!!! there flambo flambo clojure ,but satisfactory solution? my course , job in scala. should defeat , enter scala world or think should focus solely on clojure? being author or sparkling (thanks josh rosen pointing out), can tell use @ our company etl processing. here's what's good: it provides clojuristic way of interacting spark, , can see in presentation "big data style - clojure/spark way" it's optimized performance it's used in production , there others using it here's what's missing: there's no support spark streaming, spark sql, spark dataframes or spark ml. might come in future, i'm happy accept pull requests, it's not main focus (at time of writing, april 2015). i

c# - How do I apply a new group to a user in an OU in Microsoft Active Directory -

my system has users login register/renew accounts. in end set group , check if there. changed our system , move users new ou if renewing (already in ou). what want apply new group user when renew or register. resulting in user being member of 2 groups. directoryentry instructorroot = new directoryentry(ldap_ou_dir); //root binding instructorroot.authenticationtype = authenticationtypes.signing | authenticationtypes.secure | authenticationtypes.sealing | authenticationtypes.fastbind; directoryentry instructor = new directoryentry(ldaproot); //default value instructor.authenticationtype = instructorroot.authenticationtype; /*here im trying testgroup group*/ directoryentry instructorgroup = instructorroot.children.find("cn="+testgroup, "group"); instructorgroup.authenticationtype = instructorroot.authenticationtype; instructor = instructorroot.children.add("cn=" + hfuser.value, "user"); instructor.commitchanges(); instructor.properti

php - Docker: Logging From Both App and Server In One Container -

i want use centralized log catcher logentries, don't want agent running inside of containers. plan each service log container's stdout, passed logentries via docker api or logging container. the question: how handle container needs output 2 logs? how keep them clean , separate without introducing logging mechanism? the scenario: have php app, necessitates 3 components: nginx, php-fpm, , code. can put nginx , php-fpm in separate docker containers, they'll have separate logs, we're there. php has in same container nginx can served, right? when app needs log (using monolog ), can send stdout of container (e.g., make log file link /dev/stdout), can't keep logs nginx , app separate. is there way that? or looking @ wrong? there better way run nginx + php in docker? having not found better solution, ended having laravel/monolog log file in mounted volume. logentries agent collects log container's host. allows container remain clean possible in i

c# - Html.BeginForm not triggering Controller Action -

i'm new programming , c#/asp.net mvc , i've been trying while work , i'm running out of ideas. i've tried find answer online haven't come solution yet (even after reading , trying methods found similar questions). forum little intimidating posting new things i'm stuck right now. figured i'd give shot. i have project i'm making in i'm using bootstrap, asp.net , c# create webpage e-commerce-like site. i'm working on login system. i'm using simplemembership , trying create login form not need new page solely login, it's on shared view. here's view form login partial: @model fakestore.viewmodels.menusuperiormodel <form class="navbar-form navbar-right"> @if (!websecurity.isauthenticated) { using (html.beginform("autentica", "login", formmethod.post)) { <div class="form-group"> @html.textboxfor(m => m.login, new { @class=&quo

PHP OOP Script using Multithreading, terminates unexpectedly -

hi i'm having problem trying threads perform properly. problem php script terminate unexpectedly @ 1 of 2 specific points, during execution, , works rest of time. i've created test scenario produces same result: this script creates 5 threads. each thread adds up, each iteration, of random number ranging 10 20. secondly, summary_thread checks see when threads completed before printing summary... , there in lies issue. the script terminates during summary_thread::run , stack_item_container_stack::compile_summary, indirectly called @ end of summary_thread::run. #!/usr/bin/php <?php ini_set('max_execution_time', 0); ini_set('display_errors', 1); error_reporting(e_all ^ e_notice); ignore_user_abort(); class summary_thread_container { public $stack_item_container_stack; private $summary_thread; function __construct($thread_count, stack_item_container_stack $stack_item_container_stack) { $this->stack_item_container_stack =

javascript - Chrome tab memory keeps growing, heap size stays the same -

Image
i'm working team on single page application quite few timers, , 10 rest api calls per second. we've used chrome memory profiling tools locate of our memory leaks--at point heap size stays same (i.e. in between garbage collections). however, we're noticing longer application runs, more memory chrome tab uses. after few hours, we've seen tab memory grow 350mb, while heap size remains @ 6mb. if run overnight, tab consumes on 500mb , becomes unusable morning. we need application run long periods of time (we're hoping restart once week), problem. here's screenshot of heap timeline on course of hour. @ end, tab's private memory size 350mb, while heap's size remained @ around 5.4mb. we've seen in chrome 40 , chrome 38, on windows 7. have caching disabled, , running application in incognito mode. any idea why tab memory size grow point chrome unusable, while js heap usage remains small? edit: ran app couple days , tab memory size 800m

jquery - FullCalendar: get new start / end times while resizing -

i've been trying solve problem few hours now, can't figure out how. have small popover displayed next fullcalendar (fullcalendar.io) event while resizing / dragging , want display new start / end times inside while resizing, displayed on event (this meant confirm / adjust change popover). thought messy approach try use text of event: $('.fc-helper-skeleton .fc-time > span').text() maybe has idea how this. if fullcalendar default, assume there should easy way these values while resizing? it great if values moment objects while resizing. or there performance reason why feature doesn't exist? this isn't directly supported... there's pretty way of doing it. we utilize eventrender , start/stop drag/resize callbacks. eventrender: function( event, element, view ) { if(event.changing){ // if event being changed, grab render date $("#currenttime").html("start: "+event.start.format("yyyy-mm-dd hh:mma&quo

Sum product by row across two dataframes/matrix in r -

i have 2 data frames, each 2 columns. matrices same dimensions if helps in calculations. what want sum product of these data frames of respective positions/rows. for example solution following in 1 column. 21 = 1*1+10*2 42 = 2*1 +20*2 63 = 3*1 + 20*2 a=data.frame(c_1=c(1,2,3),c_2=c(10,20,30)) b=data.frame(c2_1=c(1,1,1),c2_2=c(2,2,2)) you can try rowsums(a*b) [1] 21 42 63

Capturing groups regex with global flag in JavaScript -

i have use case, need allow processing arbitrary array of strings, arbitrary regex, created either regex literal, or through new regexp() constructor. it works fine, until global g flag used capturing groups. i read few answers on so, , proposed solution use regex.exec(string) in while loop, e.g. how access matched groups in javascript regular expression? , javascript regular expressions , sub-matches i talked on irc, , advised against implementation together: but there's regexes segfault engine, unless you're using spidermonkey. so here corner case, try pasting fiddle or plunker, or console, breaks: var regexstring = '([^-]*)'; var flags = 'ig'; var regex = new regexp(regexstring, flags); var arr = ['some-property-image.png', 'another-prop-video.png', 'y-no-work.bmp']; var result = []; arr.foreach(function(item) { var match; var inter = []; while (match = regex.exec(item)) { inter.push(m