Posts

Showing posts from February, 2015

antlr - How to strip quotes from a string -

i wrote simple rule match string in antlr grammar: string : '"' (esc | ~["\\])* '"' ; actually need content of string , not quotes, required match string. i found solution antlr 3, which published in antlr wiki . know if there solution achive same without custom code. this should work: string : '"' (esc | ~["\\])* '"' {settext(gettext().substring(1, gettext().length()-1));} ; it simple removes first , last character string. taken https://theantlrguy.atlassian.net/wiki/spaces/antlr3/pages/2687006/how+do+i+strip+quotes

c++11 - c++ auto with overriding signed/unsigned -

in following code: #include <armadillo> using namespace arma; int main() { mat a; auto x=a.n_rows-5; .... x long long unsigned int , want long long int . how can fix problem? it should noticed on different versions of library, different types have been used, cannot mention long long int directly , need use auto . you can use c++11 type traits library signed or unsigned version of numeric type. to unsigned int: std::make_unsigned<int>::type so signed version of a.n_rows , try: std::make_signed<decltype(a.n_rows)>::type x = a.n_rows - 5; for other qualifiers, there corresponding templates convert between types: reference types - http://en.cppreference.com/w/cpp/utility/functional/ref pointer types - http://en.cppreference.com/w/cpp/types/add_pointer etc. (add or remove const, or volatile qualifiers)

c# - Mapping not found -

i've been struggling automapper , nested objects. following error: missing type map configuration or unsupported mapping. adminschema -> schema but doesn't seem right me, because have following mapping configured: mapper.createmap<schema, adminschema>().reversemap(); it should mapping following models: public class adminschema { [required] [display(name = "opeenvolgende weken")] public int consecutiveweeks { get; set; } public list<adminworkday> workdays { get; set; } public bool delete { get; set; } } public class adminworkday { public int dayofweeknumber { get; set; } public string starttime { get; set; } public string endtime { get; set; } public timespan breaktime { get; set; } public bool delete { get; set; } } to public class schema { public int id { get; set; } public int consecutiveweeks { get; set; } public list<workday> workdays { get; set; } } public class workd

Unable to send ALT + Insert using sendkeys in vba -

i send alt+insert in vba. not working please suggest. sendkeys "%[insert]" // work insert. use application.sendkeys sub test1() application.sendkeys ("%{insert}") doevents end sub

ios - Making an Image Picker with UIButton in Swift -

i make image picker uibutton pointing imagepickerview don't know how proceed. we'll want connect viewcontroller "a" (with uibutton) viewcontroller "b" (uiimagepicker). this tried : have storyboard multiples viewcontroller, , don't know why can't make ibaction viewcontroller "a" viewcontroller "b". should make imagepickerview programatically or can use storyboard? thanks in advance ! uiimagepickercontroller can't added in storyboard, must programmatically. first, create ibaction uibutton: - (ibaction)openimagepicker:(id)sender; your class need adopt uiimagepickercontrollerdelegate , uinavigationcontrollerdelegate protocol: @interface myviewcontroller () <uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate> then show image picker in openimagepicker: method: // check if image source available // in case, photo library available. if use // uiimagepickercontrollersourcetypecamera

ios - How to tell if Airplay streaming failed? -

i'm working on video content app features both live stream , vod ads. drm reasons need use different streams when playing vod on device / streaming on airplay. when switch , try start streaming airplay new avplayer , every apple tv display message: an error occurred loading content. i'm observing avplayer status through kvo, doesn't seem change status 'avplayerstatusfailed' when happens, don't know when close video playback or start retry logic. do notification this?

Automatic META-INF/services generation in Scala and SBT for ServiceLoader -

is there way, in scala , sbt, automatically generate meta-inf/services/* resource files later use java.util.serviceloader annotating classes, google auto service java projects? i.e. package foo.bar import my.exported.serviceinterface @autoservice[serviceinterface] class myservice extends serviceinterface{ // … } to automatically generate file meta-inf/services/my.exported.serviceinterface in resources folder. file contain: foo.bar.myservice (i don't think can use google auto service directly, doesn't work scala classes -- see this comment on realm-java github issue .) please consider using https://github.com/nyavro/spi-plugin . the approach used in plugin differs using annotations - uses whole packages source of interfaces , applies packages of interface implementations.

python - pandas - filter dataframe by another dataframe by row elements -

Image
i have dataframe df1 looks like: c k l 0 1 1 2 b 2 b 2 3 c 2 4 c 2 d and called df2 like: c l 0 b 1 c i filter df1 keeping values not in df2 . values filter expected (a,b) , (c,a) tuples. far tried apply isin method: d = df[~(df['l'].isin(dfc['l']) & df['c'].isin(dfc['c']))] apart seems me complicated, returns: c k l 2 b 2 4 c 2 d but i'm expecting: c k l 0 1 2 b 2 4 c 2 d you can efficiently using isin on multiindex constructed desired columns: keys = ['c', 'l'] i1 = df1.set_index(keys).index i2 = df2.set_index(keys).index df1[~i1.isin(i2)] i think improves on @ians's similar solution because doesn't assume column type (i.e. work numbers strings). (above answer edit. following initial answer) interesting! haven't come across before... solve merging 2 arrays, dropping rows df2 defined. here example, makes use of temp

Mercurial push fails with `abort: error: ''` -

i'm pushing bitbucket hg repo. push started failing after enabled rebase extension in .hg/hgrc file (which not related) i'm using hg version 2.8.2 the error (from hg push --debug --traceback -v ) is: http auth: user jorn86, password ****** using auth.bb.* authentication bitbucket.org certificate verified traceback (most recent call last): file "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 133, in _runcatch return _dispatch(req) file "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 806, in _dispatch cmdpats, cmdoptions) file "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 585, in runcommand ret = _runcommand(ui, options, cmd, d) file "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 897, in _runcommand return checkargs() file "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 868, in checkargs return cmdfunc() file &q

Stock Quantity view in mysql inventory database -

Image
uml diagram here database design. plan on calculating quantity of components in view subtracting order_linequantity component_usedquantity. problem having surely elementary, current view doesn't work because summing order_linequantities components , likewise component_usedquantities instead of giving proper difference/quantity each individual component. create view inventory3(componentid, quantity) select distinct(componentid) componentid, sum(order_linequantity) - sum(component_usedquantity) quantity component inner join order_line on order_linecomponentid = componentid inner join component_used on component_usedcomponentid = componentid how can proper quantity each individually different componentid? if use sum() function sum values of table. if want sum related values, have first group values id , sum them. that's below sub query does. here model of table1- order_line here model of table2- component_used i have filled necessary details. can

php - When user logged in it fetches his data only -

i new android development , working on project in want display user data when logs in. here's code after user logged in-: public class userprofile extends activity { arrayadapter<string> adapt ; @override protected void oncreate(bundle savedinstancestate) { setcontentview(r.layout.list_view); adapt=new arrayadapter<string>(this,r.layout.list_view,r.id.textview1); profile pf = new profile(); pf.execute(); listview lv = (listview) findviewbyid(r.id.listview); lv.setadapter(adapt); super.oncreate(savedinstancestate); } class profile extends asynctask<void, void, string[]>{ dialog pd ; @override protected void onpreexecute() { super.onpreexecute(); pd = progressdialog.show(userprofile.this, "loading", "please wait..."); } @override protected string[] doinbackground(void... params) { list<namevaluepair> l = new arraylist<namevaluepair>(); inte

sql - Display all rows of data from both tables even though conditions exist -

i have sql query 2 tables need in expanding results. the query running is: select b.obj_full, b.subj_full, b.act_ytd_ty, sum(a.jnl_value) jnl_total db2adm2.jnlfile inner join db2adm2.tfincatp b on b.obj_full = a.jnl_obj , b.subj_full = a.jnl_subj a.jnl_year ='15' , a.jnl_processed ='n' , obj_full = 'tbbbb' group b.obj_full, b.subj_full, b.act_ytd_ty the data being returned is: obj_full subj_full act_ytd_ty jnl_total ----------------------------------------- tbbbb 9404 -9666.73 -547.78 tbbbb 9405 -13098.05 -24.39 i have split query above 2 separate queries show data being returned each one. query 1 - journal values not processed week on code tbbbb select jnl_obj, jnl_subj, sum(jnl_value) jnl_value db2adm2.jnlfile jnl_year ='15' , jnl_processed ='n' , jnl_obj = 'tbbbb' group jnl_obj, jnl_subj results on quer

android - Nested RecyclerView issue with AppBarLayout -

my activity contains appbarlayout provided design library 23.0.1, hides when scroll up. have recyclerview each child item containing recyclerview too, nested recyclerview going on. my issue when touch on of inner recyclerview's child , scroll up, appbar not hide. however, if place finger somewhere else (not on inner recyclerview) , scroll, app bar scrolls fine. why happening? tried adding appbar behavior inner recycler view, yet app bar scroll when touch somewhere else , scroll. note: inner recyclerview has fixed set of items visible @ times, basically, there no scrolling within recyclerview. there similar question , provided solution intercept touch of inner recyclerview , pass parent recycler view. disables click events of children in inner recycler view, not want that. you need set nested scrolling flag false inner recycler views. msomeinnerrecyclerview.setnestedscrollingenabled(false);

java - Can we put some computation task inside setup method of mapper class in mapreduce code -

i have used setup() method inside mapper class. there user defined method apriorigenk() defined in mapper class , invoked in map() method. now problem is: whatever know map method called each line of input. suppose there 100 lines method called 100 times. map method called apriorigenk method each time accordingly. there no need call apriorigenk inside map method each time when map method called. i.e. result of apriorigenk method common of line of input map method. apriorigenk method cpu intensive increases computation time when called again , again. can manage somehow call apriorigenk single time , use in map method each time. have tried keep apriorigen inside setup method can called 1 time surprisingly slow execution great extent. here code: import datastructuresv2.itemsettrie; public class aprioritriemapper extends mapper<object, text, text, intwritable> { public static enum state { updated } private final static intwritable 1 = new intwritab

asp.net mvc 5 - Textboxes are different sizes -

i created controllers , views using scaffolded item when run view in program can see textboxes different sizes.how same size? view: @model fcproject.models.purchase @{ viewbag.title = "edit2"; } <h2>edit2</h2> @using (html.beginform(new { orderdate = model.orderdate })) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>purchase</h4> <hr /> @html.validationsummary(true) @html.hiddenfor(model => model.purchaseid) <div class="form-group"> @html.labelfor(model => model.customerid, "customer cell", new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.dropdownlist("customerid", string.empty) @html.validationmessagefor(model => model.customerid) </div> </div> <div class="

excel - Getting the string of an external link to another worksheet's cell? -

the worksheet object has paste method has parameter named link . if set true link created range selected cursor, range on clipboard (aka. sorrounded marching ants). resulting link in cells like: ='\\des001\home folder\[the book.xlsx]sheet1'!$a$1 now, there function returns string itself? (without = sign) you can read string. not sure how have link build address , subaddress can this. my link in cell c3. have change whatever cell link in. private sub commandbutton36_click() dim ws excel.worksheet set ws = activeworkbook.sheets("sheet1") dim s string s = ws.range("c3").hyperlinks(1).address 'or s = ws.range("c3").hyperlinks(1).subaddress msgbox (s) end sub

javascript - URL that hide my $_GET parameter -

i have problem url , method form. here's step-1 url : http://localhost/myproject/media.php?module=create and here's current url (step-2) when submit data : http://localhost/myproject/media.php?module=create&code=j-001&year=t-016&dept=p-001&class=kg-a&semester=1&day=monday is possible replace current url (step-2) short url ? or, possible makes url hide $_get parameter? im try editing .htaccess still cant right: options +followsymlinks rewriteengine on #rewriterule ^index.php$ media.php?module=create [l] rewriterule ^test-([0-9]+)/([0-9-0-9a-za-z\w]+)/?$ media.php?module=create&code=$1&year=$2&dept=$3&class=$4&semester=$5&day=$6 [nc] #rewriteengine on #rewriterule ^test-([0-9]+)-(.*)\.html$ media.php?module=create&code=$1&year=$2&dept=$3&class=$4&semester=$5&day=$6 [l] #options -indexes i don't know htaccess far know every part captured (between parenthesis) in regular express

backbone.js - Marionette Router Query String Parameters In URL Fragment Routes -

i'm working on project requires ui state reproducible via url. in traditional (server-side) app, use both url parameters like: /resources/:id and unordered optional query string parameters, like: /resources/:id?page=5&sort=date is there idiomatic way achieve backbone/marionette routing? don't want have configure routes every possible combination of parameters. the fact don't see addressed makes me think may barking wrong tree, approach-wise, think being able represent ui state possible in url pretty important lot of projects. it looks best option now-orphaned backbone-query-parameters project. it supports routes in form i'm looking for: #resources/:id?flag=true

Custom script for git blame from vim -

i want minimum way of using git blame vim (i dont want use whole fugative plugin). have right this: this function vim page , enables me open shellcomands in scratch buffer. function! s:executeinshell(command) let command = join(map(split(a:command), 'expand(v:val)')) let winnr = bufwinnr('^' . command . '$') silent! execute winnr < 0 ? 'botright new ' . fnameescape(command) : winnr . 'wincmd w' setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap number echo 'execute ' . command . '...' silent! execute 'silent %!'. command silent! execute 'resize ' . line('$') silent! redraw silent! execute 'au bufunload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w''' silent! execute 'nnoremap <silent> <buffer> <localleader>r :call <sid>executeinshell(''' . command . ''

javascript - Is there a way to wait for THREE.TextureLoader.load() to finish? -

i'm working release r73. current task fill array materials. content of array supposed used later. usage depends on materials me loaded. by loop through array of json information , call code every element: tloader.load( base_odb_url + jsonmat.pic, function (texture) { texture.wraps = three.repeatwrapping; texture.wrapt = three.repeatwrapping; texture.repeat.set(jsonmat.scaleu, jsonmat.scalev); mat = new three.meshlambertmaterial({ map : texture, side : three.doubleside, name : jsonmat.mname }); threematlist.push(mat); }, function (xhr) { }, //onprogress function (xhr) { mat = new three.meshlambertmaterial({ color : 0xff0000, side : three.doubleside, name : jsonmat.mname }); threematlist.push(

apache - Error 500. .htaccess for laravel routing (line RewriteRule ^ index.php [L]) with AMMPS -

on ammps instalation of apache 2.4.12 trought ammps, error 500 when try use .htaccess routing pourposes (i use illuminate\routing & use illuminate\http, not full laravel) when read apache log, show 127.0.0.1 - - [10/oct/2015:08:29:49 +0100] "get /public http/1.1" 500 528 "-" "mozilla/5.0 (macintosh; intel mac os x 10.10; rv:41.0) gecko/20100101 firefox/41.0" try put more level debug on apache , see. [sat oct 10 08:39:55.862342 2015] [core:error] [pid 41739] [client 127.0.0.1:65261] ah00124: request exceeded limit of 10 internal redirects due probable configuration error. use 'limitinternalrecursion' increase limit if necessary. use 'loglevel debug' backtrace. .htaccess rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] # if comment line not error 500 i

c# - One aspx page to have utf-8 encoding -

what should change 1 aspx page have utf-8 encoding? my web.config has following code: <system.web> <globalization requestencoding="utf-8" responseencoding="utf-8"/> </system.web> tried this: meta http-equiv="content-type" content="text/html; charset=utf-8" doesn't work. try this; <configuration> <system.web> <globalization fileencoding="utf-8" requestencoding="utf-8" responseencoding="utf-8" culture="en-us" uiculture="de-de" /> </system.web> </configuration> to set encoding individual page, set requestencoding , responseencoding attributes of @ page directive: <%@ page requestencoding="utf-8" responseencoding="utf-8" %> or can use location this: <location path="home.aspx"> <system.web> <globalization reques

machine learning - How to optimized input parameters? -

i looking right machine approach optimize 5 program parameters. have growing table past results. which machine learning method serve in scenario? edit: the training data simple table: time | p1 | p2 | p3 | p4 | time elapsed there 200k rows , steady growing. optimization minimize "time elapsed" dependent on other factors parameters parameters biggest influence in every sample taken. i looking recommendable types of neural networks (or other methods). thought propagation or maybe pso lack experience (only ever coded ga) decide start. yes, that's big help. note stackoverflow defined place specific questions. however, one, think, straightforward enough. i don't know how might be; i'm trying start simply. you have large enough data base build prediction model; i'd start logistic regression , see how in predicting own training data. have ann software lets "seed" learning such model? best of both worlds. if incoming data

sockets - Sending a file from local to server using python - the correct way -

probably simple question used play socket module. didn't understand far why can't send simple file. as far know there 4 important steps when send info on socket: open socket bind listen accept ( possibly needed multiple times ). now, want creating file on local machine , fill info. ( been there, done - far ) then, create client flow, following: s = socket.socket() # create socket s.connect(("localhost", 8081)) # trying connect connect on 8081 port f = open("logs.txt", "rb+") # i'm opening file contains want l = f.read(1024) # i'm reading file # i'm sending info file while l: s.send(l) l = f.read(1024) s.close() of course, firstly, i'm creating server (at first, on localhost) open port , create connection allow byte-chunked data sent. import socket import sys s = socket.socket() # create socket s.bind(("localhost", 8081)) # bind s.listen(10) while true: sc, address = s.accept() pr

What is the "underlying type" in Scala? -

recently have stumbled upon scalac error message complaining 2 types not being same though "underlying type" same. regardless of error , specifics, i'm curious "underlying type". ? for singleton type x.type it's type of x . example, if have val x: int underlying type of x.type int .

javascript - JQuery function is working on Dev console, but not in load page -

i'm getting crazy because going good, don't understand why jquery function not working on webpage code when loaded , when put code on developer console working perfectly. here code: $('.changinstate').change(function(){ var id = $(this).attr('id'); console.log(id); }); have test : $(document).on('change', '.changinstate', function(){ var id = $(this).attr('id'); console.log(id); });

java - When using Android Studio's support annotations, should I also provide checks in code? -

i used have code: public final static class googlemapszoomlevel { public static final int min_zoom_level = 0; public static final int max_zoom_level = 21; private int zoomlevel; private static final string error_zoom_level_out_of_bounds = "zoom level should within " + min_zoom_level + " , " + max_zoom_level; private googlemapszoomlevel() { throw new assertionerror(); } public googlemapszoomlevel(int zoomlevel) { if (zoomlevel < min_zoom_level || zoomlevel > max_zoom_level) { throw new illegalargumentexception(error_zoom_level_out_of_bounds); } this.zoomlevel = zoomlevel; } public string tostring() { return string.valueof(zoomlevel); } } today read article on android studio support annotations, , changed code this: public final static class googlemapszoomlevel { public static final int min_zoom_level = 0; public static final int max_zoom_level =

omnet++ - Change the map of Veins -

i want change default map of veins. made map extraction steps openstreetmap , got following files: lyon.net.xml , lyon.poly.xml , lyon.rou.xml , lyon.sumo.cfg~ , typemap.xml , lyon.osm , lyon.rou.alt.xml , lyon.sumo.cfg trips.trips.xml what need change in veins or in statement: /c/users/user/src/veins-3.0/sumo-launchd.py -vv -c /c/users/user/src/sumo-0.21.0/bin/sumo.exe so can simulate veins exemlpe new map? have change in sumo-launchd.py? veins comes small daemon make running coupled simulations easier. daemon, sumo-launchd.py , designed run in background, listening incoming requests. on each incoming connection, receives simulation setup in xml format, launches separate instance of sumo , proxies requests between omnet++ , sumo. omnet++ reads xml file configured in manager.launchconfig . convention file has extension of .launchd.xml , can used. i suggest copy, adapt, modify .launchd.xml file comes veins example match files simulation uses.

Pass by reference to COM object in JavaScript -

trying pass i variable test function must change value: <html> <head> <title> welcome site</title></head> <body> <script language="javascript"> var atl = new activexobject("atl.object.1"); var =6; atl.test(i); document.write(i); </script> </body> but in output still have 6 . how pass value reference? on javascript pass reference not exist. can use object pass , works passing reference. eg : var atl = new activexobject("atl.object.1"); var = { value: 6}; //if activexobject not work object, need make adapter or store value atl.test(i); document.write(i.value);

mysql retrieving all rows while also using summaries -

i have query: select name, apn, bpn, count(apn), min(acost), min(bcost), ceil(avg(aqty)), max(aqty), sum(bshipped), concat(truncate((avg(aresale)-avg(acost))/avg(aresale),2) * 100,'%'), code (select name, apn, bpn, acost, aqty, code table_1 customer = '12345' , adate >= '2013-01-01' , adate <= '2015-12-12') qh inner join (select cpn, bcost, bresale, bshipped table_2 customer = '12345') ih on qh.apn = ih.cpn bshipped > 0 group qh.apn; what need out of each row output, can't figure out how that. right now, i'm getting this: name | apn | bpn | apn count asdf 001 555 3 /*summary of apn 001*/ qere 002 865 1 /*summary of apn 002*/ rtrt 003 123 2 /*summary of apn 003*/ because of group by , i'm getting summary of qh.apn , if don't use group by statement, 1 line in result. i looking have apn count column, while @ same time showing rows

c# - Cross-platform C code and preventing garbage collection -

i have set of c functions need use on arm target, in c++ , in c#. can wrap c c++ dll , c# dll , use c functions i've bound successfully. however, have debug function want able print c# gui , delegate uses being garbage collected rather left in place duration. managed debugging assistant 'callbackoncollecteddelegate' has detected problem in 'c:\utm\pc\utm_win32_app\bin\debug\utm_win32_app.vshost.exe'. additional information: callback made on garbage collected delegate of type 'utm_dll_wrapper_cs!messagecodec.messagecodec_dll+guiprinttoconsolecallback:: invoke'. may cause application crashes, corruption , data loss. when passing delegates unmanaged code, must kept alive managed application until guaranteed never called. here's snippet of c code uses , sets callback mp_guiprinttoconsole : #ifdef win32 static void (* mp_guiprinttoconsole) (const char*) = null; void logmsg (const char * pformat, ...) { char buffer[max_de

php - access session or Yii in config file -

i want access session or yii::$app in config file ( config/main.php or config/main-local.php ) ! possible or not? want check session , make style available! 'components' => [ 'assetmanager' => [ 'assetmap' => [ 'r.css' => yii::$app->session['lang'] ? 'css/styleltr.css' : 'css/stylertl.css' , ], ], or how in assetmanager???? you can't access user session in config file. but, use conditional in layout , register different assets based on session values.

React Native AlertIOS.prompt(args) is called constantly even though it is onPress -

i added code text component this: <text style={styles.text} onpress={ alertios.prompt( 'title', 'defaultvalue', [{text: 'cancel', onpress: this.oncancel.bind(this)}, {text: 'ok', onpress: this.onok.bind(this)}])} > press me! </text> but ran simulator, prompt called after mounting screen , continually displayed on , over, whether clicked ok/cancel button on or not. i have no other alertios.prompt() calls anywhere in code. am doing wrong or bug in react-native?

python - Trying to generate a rolling_sum with Pandas -

i have simple dataframe regular samples: dates = pd.date_range('20150101', periods=6) df = pd.dataframe([1,2,3,4,5,6], index=dates, columns=list('a')) df.loc[:,'b'] = 0 df.iloc[0,1] =10 df out[119]: b 2015-01-01 1 10 2015-01-02 2 0 2015-01-03 3 0 2015-01-04 4 0 2015-01-05 5 0 2015-01-06 6 0 what using rolling_sum function in pandas create values in column b such following table: b 2015-01-01 1 11 2015-01-02 2 13 2015-01-03 3 16 2015-01-04 4 20 2015-01-05 5 25 2015-01-06 6 31 that is, b(i+1) = a(i+1) + b(i) - note there special case @ b(0) there initial value of 10. i've tried using following, gives wrong answer: df.b = pd.rolling_sum(df.a + df.b, 1) try expanding_sum : in [15]: df out[15]: b 2015-01-01 1 10 2015-01-02 2 0 2015-01-03 3 0 2015-01-04 4 0 2015-01-05 5 0 2015-01-06 6 0 in [16]: df.b = pd.expanding_sum(df.a) + df.b[0] in

c# - visual studio copy selected (in designer)control name to paste into text editor -

Image
is there way quick copy selected control name paste text editor? have lot of control have set class property to, have select each 1 click on properties, select name , ctrl+c. there no way select control on designer ctrl+c+someotherkey end voila can paste text editor ? (or maybe there way quick copy of name of selected contols :) ? i use visual studio proffesional 2012 (going change 2015 in near future). what create own custom extention. example want buttons green , "zelda". create following class. public greenzeldabutton : button { public greenzeldabutton() { backcolor = color.green; text = "zelda"; } } then have toolbox, i'm not sure of proper method create new instance in form contructor. so: public partial class form1 : form { public form1() { initializecomponent(); new greenzeldabutton(); } } and press f5 debug in order add new control toolbox. can drag , drop new control toolbox

Array.length is 0 even when it contains values - Javascript -

i have parent array containing child-arrays. length property on parent array displays 0 results, when there child arrays present. here's code: var balances = []; balances['kanav'] = 50; balances['yash'] = 50; alert(balances.length); console.log(balances); what's reason? the length property works array properties numeric values. arrays objects special length property , handy methods inherited array.prototype . when add properties kanav , yash , added plain object properties, not indexes, therefore don't affect length . var arr = []; // add plain object properties arr.foo = 'foo'; arr.bar = 'bar'; document.write(arr.length) // 0 // add numeric properties // since numbers, square bracket notation must used arr[9] = 9; document.write('<br>' + arr.length) // 10

tfs2012 - Is there any way to get a diff of particular fields in TFS? -

i'm working on large software project uses tfs backlog management. we're using scrum 2.2 template in tfs 2012. there tools out there give diffs of particular fields (e.g. description, acceptance criteria) can see how these fields have changed on time , made them ? sort of 'annotate' feature in source control explorer, backlog items instead ? you can create own tool highlight differences between revisions of specific work item field tfs api. need work workitem.revisions property. there 1 tool available can have reference started quickly, see: http://gethistory.codeplex.com/

jquery - Unbind an event from Document with a different seletor -

i have following global click behaviour in app $(document).on("click", ".btnsubmit", function (e) { e.preventdefault(); $(this).parents("form").submit(); }); now have one-off instance need .btnsubmit button on modal window have different behaviour. have 2 workarounds using different class adding data attribute button , adding conditional binding above however, i'd prefer remove binding, $(document).off("click", ".modal.mywindow .btnsubmit") unfortunately doesn't work, guess because selector different original ".btnsubmit" is there way unbind event specific selector without affecting other instances of ".btnsubmit" on same page? i believe you're correct selectors "off" have match ones given in "on", per jquery docs .off() : to remove specific delegated event handlers, provide selector argument. selector string must match 1 passed .on() wh

javascript - Should chrome extensions have access to Tabs content (other websites) -

is there way identify , block js files/events not part of domain? like assume, if i'm writing extension chrome , put following code in js $('div').on('click', function(){ alert("yup"); }); is there way website handle case? edit 1: after discussion @clive, realized extension/application should run in sandbox , should not able access events/elements outside scope. case a chrome extension have keypress event on input[type=text] , input[type=password] . extension runs in background, there js files available. hence if open facebook , login account, extension capture data , can send server. my case two user getting alert messages multiple times. thought part of our code , checked js files. realized, both user had same extension , diagnosed extension's js file , found alert in it. lucky, no damage done, still posses possible security threat. short answer: no. long answer: chrome extensions run code in separate space site&

c# - WPF, MVVM, Navigation, Keeping Dependency Injection In-Tact -

i have simple wpf application utilizes unity framework dependency injection. currently, trying simplify method navigation between views in mvvm pattern implementation; however, many of examples throughout stack overflow not take consideration dependency injection caveat. i have 2 entirely separate views. one, main acts main window content loaded (pretty typical; unnecessary content eliminated): <window x:class="application.ui.main"> <grid background="white"> <contentcontrol content="{binding aproperty}"/> </grid> </window> the constructor receives viewmodel via constructor injection (again, simple): public partial class main { private mainviewmodel _mainviewmodel; public main (mainviewmodel mainviewmodel) { initializecomponent(); this.datacontext = _mainviewmodel = mainviewmodel; } } i have usercontrol , home , want "navi

apache - How do I route all subdomains to index.php using htaccess without 301 redirect -

i set htaccess file routes requests subdomain index.php file in /public_html/ folder. have configured dns accept wildcard subdomains. i plan give users personalised url site , pass username via subdomain, important url remains , hence 301 redirects out of question. my htaccess looks this, not work (server not found): rewriteengine on rewritecond %{http_host} ^(.+)\.mydomain\.com$ [nc] rewriterule . /index.php?subdomain=%1 [l,qsa] my end goal able url such //joebloggs.mydomain.com/foo/bar translate //www.mydomain.com/index.php?user=joebloggs&route=/foo/bar . what need have in htaccess file make work? you can have way # if request subdomain (except "www") rewritecond %{http_host} ^((?!www\.).+)\.mydomain\.com$ [nc] # internally rewrite index.php rewriterule ^((?!index\.php$).*)$ /index.php?subdomain=%1&route=$1 [l]

node.js - yeoman can't edit XML file that was created by other sub generator -

i'm trying make changes xml file in 1 sub generator created one. my main generator prompting , determines subgenerators should used. simplyfied looks this: var maingenerator = module.exports = yeoman.generators.base.extend({ writing: function () { this.composewith('design:setup', {}); if (this.option.get('someoption')) { this.composewith('design:extend', {}); } } }); the setup generator adds files used in every variation of design. example project config.xml var setupgenerator = module.exports = yeoman.generators.base.extend({ default: function () { // ^ default: makes sure vssetup run before writing action // of other sub generators this.fs.copy( this.templatepath( 'project/_config.xml' ), this.destinationpath( 'project/config.xml' ) ); }); now, depending on settings user chose in prompts, different sub generators executed. when every add new folder destination, has updated