Posts

Ruby on Rails global categories block -

i new ror , don't understand how can make global template put in other template. example have categories module , create sidebar navigation , put @ homepage template. tried way, categories controller method side_nav never called. practice type of problem or should different way? categories/categories_controller.rb def side_nav @categories = category.all end categories/_side_nav.html.erb <ul class="list-unstyled"> <% categories.each |category| %> <li><%= link_to category.title, category.title.downcase %></li> <% end %> </ul> homepage/index.html.erb <%= render 'categories/side_nav' %> you may @ layout/application file. it's global layout in custom project default. , can provide custom layouts in contollers. http://guides.rubyonrails.org/layouts_and_rendering.html

Can Wireshark display info about the size of the data in a POST request? -

as heading states: can wireshark display info size of data in http post request? it better if see size of specific fields submitted in post data. how/can achieved? can wireshark display info size of data in http post request? if "data" mean posted data, then, if post request has content-length: header, yes, can - header. it better if see size of specific fields submitted in post data. that's not easy, although can individual fields of "xxx=yyy" item "urlencoded-form.key" , "urlencoded-form.value" if content-type application/x-www-form-urlencoded.

android - Make scrollbar visible in ionic content when using native scroll -

i using overflow-scroll = "true" make ionic use native scrolling : <ion-content overflow-scroll = "true"> <ion-list> <ion-item ng-repeat="foo in bar"> {{foo.label}} </ion-item> </ion-list> </ion-content> this works great (performances good). problem (vertical) scrollbar disappeared. as per documentation , tried adding scrollbar-y="true" ion-content , didn't work. i tried adding css : ::-webkit-scrollbar { -webkit-appearance: none; } ::-webkit-scrollbar:vertical { width: 11px; } ::-webkit-scrollbar:horizontal { height: 11px; } ::-webkit-scrollbar-thumb { border-radius: 8px; border: 2px solid white; background-color: rgba(0, 0, 0, .5); } ::-webkit-scrollbar-track { background-color: #fff; border-radius: 8px; } ... didn't work either. this article (look "native scrolling") says problem can solved using css, though. ...

javascript - Dependency Injection and Interfaces in Node -

coming c# background, used interfaces base mock objects off of. created custom mock objects myself , created mock implementation off c# interface. how do in js or node? create interface can "mock" off of , interface serve real class able implement interface? make sense in js or or node world? for example in java, same deal, define interface method stubs , use basis create real class or mock class off of. unfortunately you're not going find standard interface part of javascript. i've never used c#, i've used java, , correct me if i'm wrong, looks you're talking creating interfaces , overriding methods both mock testing purposes, being able implement interfaces in other classes. because isn't standard javascript feature, i think you'll find there going lot of broad answers here . however, idea of how popular libraries implement this, might suggest looking @ how angularjs looks @ mock testing (there many resources online, google ...

java - Memory efficient way to initialize a String to be reused inside a loop -

i'm using couple of strings in code going reused within loop , i'm wondering best way initialize string variables improve memory usage: // sample purposes declare map, same thing // applies arraylist, database set, etc. point. map<string, string> samplemap = getmap(); int mapsize = samplemap.size(); // string initialization string a; string b = new string(); string c = ""; for(int = 0; < mapsize; i++){ = samplemap.get(i); b = somefunc(a); c = anotherfunc(a); // stuff strings } after loop, strings no longer used. you cannot optimize initialization or memory usage of strings in snippet of code, several reasons: java strings immutable - cannot change characters inside string, can point new string. in loop, called function (such afunc() or get() ) 1 responsible allocating string, not loop. for advanced programmers: if want optimize memory usage of strings, need use stringbuffer/stringbuilder or raw character array , pass...

objective c blocks - completionHandler definition inside handleEventsForBackgroundURLSession: -

this not trivial question asked here in stackoverflow before, @ least haven’t found similar, of course googled , read of high ranked results. btw, if folks here don't feel comfortable objective c’ s block syntax, visit page please http://fuckingblocksyntax.com , before throwing block related issues. 1st part of question is: the background of declaration of block-parameter, invoking method has block-parameter ( in many cases, completionblock ) the “ callee-method " in myworker class: … ... @implementation myworker -(void) aworkermethodneedsablockinput: ((void)(^)( nsobject *, double )) blockparam { nsobject *anobj=[[ nsobject alloc] init]; double *adouble; [self retrievetimeconsumingresults: anobj withnumberoftry: adouble ]; blockparam ( anobj, * adouble ); } @end the “ caller-method " in mymanager class: @interface mymanager() @property (nonatomic) myworker * mworker; @property (nonatomic, copy) (void)(^mblockproperty)...

console application - load a web page and click a button using c# -

i have requirement automate procedure on web page. open web page find input click on it close web page i achieve of above using c# in console application . dont want open browser, code automate process. i have url web page , id of input element. what c# code should use achieve this.? i think able serve purpose. selenium 1 (selenium rc) : selenium server launches , kills browsers, interprets , runs selenese commands passed test program , , acts http proxy, intercepting , verifying http messages passed between browser , aut. selenium server receives selenium commands test program, interprets them, , reports program results of running tests. the rc server bundles selenium core , automatically injects browser. occurs when test program opens browser (using client library api function). selenium-core javascript program, set of javascript functions interprets , executes selenese commands using browser’s built-in javascript interpreter. the server receives ...