Posts

Showing posts from August, 2012

Manage bootstrap carousel with media queries -

i have unique carousel used in different pages different height. when try manage carousel control , icons used in different screen sizes use media queries following css instructions: @media screen , (min-width : 1224px) { #carouseli .carousel-control .icon-prev, .carousel-control .icon-next, .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right { font-size: 24px; line-height: 24px; margin-top: -35px; } #carouselr .carousel-control .icon-prev, .carousel-control .icon-next, .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right { font-size: 24px; line-height: 24px; margin-top: -35px; } } but when modify settings of carouselr, affects both carousels. don't know why if select object # symbol. anybody can me issue? thank in advanced post updated html code: <div class="col-xs-6 col-xs-offset-3 col-md-4 col-md-offset-0"> <div class="container-fluid">

python - How do I disable OPTIONS method on Django Rest Framework globally? -

i want disable options method on api built django rest framework (drf) globally (on api endpoints) currently options call returns, { "parses": [ "application/json", "application/x-www-form-urlencoded", "multipart/form-data" ], "renders": [ "application/json" ], "name": "login oauth2", "description": "" } which don't want peek into. want return blank character github on api or else. i tried @api_view(['post']) def my_method(request): if request.method == 'options': return response() on function based view, returns inspecting headers show, allow →post, options, options which has repeated options . how achieve it? thanks. in settings, add like: rest_framework = { 'default_metadata_class': none, } if debug: # default value rest_framework['default_metadata_class']:

javascript - Parameter encoding (quotes and space character) -

so i'm sending string parameter javascript function, , problem space characters and/or quotes. can have either 1 working, can't figure out how both ways work @ same time. i left encodeuricomponent , decodeuricomponent example use them deal spaces. javascript: function alerttitle(title){ alert(decodeuricomponent(title)); } php: //...fetching mysql $title = $row['title']; //if $title content wrapped in single or double quotes, do: $title = str_replace("\"","&quot;",$row['title']); //but if it's not, , has spaces, have wrap in quotes encodeuricomponent: $title = '\''.$row['title'].'\''; //and gives error in encodeuricomponent if $title happens have // single quotes //..and sending $title javascript: echo '<a onclick="alerttitle(encodeuricomponent('.$title.'));" href="#">alert</a>'; so somehow need escape single quotes also, or come

c# - Newtonsoft.Json.Linq.JArray' to type 'System.Collections.Generic.IEnumerable -

i calling web api c# desktop client. this code on client: public ienumerable<model.print> get() { var print = new list<model.print>(); using (var client = new httpclient()) { client.baseaddress = new uri(shared.url); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue(shared.headertype)); var response = client.getasync(route + "?" + generaltags.customer_ref + "=" + new guid().tostring()).result; if (response.issuccessstatuscode) { string strjson = response.content.readasstringasync().result; var jobj2 = (ienumerable<model.print>)jsonconvert.deserializeobject(strjson); } else { everror(new exception(string.format("{0}: {1}", (int)response.statuscode, response.reasonphrase)), errortags.print_get); } } return print; } but error

ruby - How to find two elements that have smallest difference in an array? -

how find 2 elements in array have smallest difference? in other words, how find 2 elements have smallest standard deviation. for instance, if have array like: arr = [158,2,15,38,17,91] the result 15 , 17. i assume question is, "for 2 elements of array absolute value of difference minimum?". arr.combination(2).min_by { |a,b| (a-b).abs } #=> [15, 17] see array#combination , enumerable#min_by .

Cordova Google Fit plugin authorization failure -

i'm trying connect fitness api using cordova plugin: https://github.com/2dvisio/cordova-plugin-googlefit i've enabled fitness api in google console developer, genereted sha-1 using keytool -list -v -keystore degub.keystore , added fingerprint list in developer console. after calling window.plugins.googlefit.getstuff1 nothing happens, no error or success callback called. i've noticed in logcat message: v baseauthasyncoperation: access token request failed: com.google.android.gms , suppose reason of failure. is plugin issue or setup mistake? will greatful help

c++ - C4473 warning for structure assignment -

i working on assignment , curious warning when compiling , how remedy it. build when debug error screen. below warning comes up. 1>c:\users\cesteves\documents\c programming\inventory\inventory\inventory.cpp(48): warning c4473: 'scanf_s' : not enough arguments passed format string note: placeholders , parameters expect 2 variadic arguments, 1 provided note: missing variadic argument 2 required format string '%s' note: argument used buffer size #include "stdafx.h" #include <stdio.h> void main() { struct date { int day; int month; int year; }; struct details { char name[20]; int price; int code; int qty; struct date mfg; }; struct details item[50]; int n, i; printf("enter number of items:"); scanf_s("%d", &n); (i = 0; < n; i++) { printf("item name: \n"); scanf_s(&qu

file - How to print a value from output -

i know how print value instead of whole output, ex.: ping google.com -t output - reply xxx.xxx.xxx.xxx: byt=32 time=35 ttl=52 and have: "time=35" or number - "35" if know how me please me :d p. from command line for /f "eol=p skip=2 tokens=5 delims= " %# in ('ping google.com -t -n 10') @if "%#" neq "=" @if "%#" neq "in" @echo %# from batch file: for /f "eol=p skip=2 tokens=5 delims= " %%# in ('ping google.com -t -n 10') @if "%%#" neq "=" @if "%%#" neq "in" @echo %%# if not set -n 10 you'll have wait until for /f buffer full.

asp.net - MVC C# Session Project -

i posted question no 1 answered comments/errors had. how text entered in @html.textbox("searchstring") in index viw welcome view using session variables? homecontroller.cs using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using system.data.entity; using newproject.models; namespace newproject.controllers { public class homecontroller : controller { public actionresult index() { return view(); } [httppost] public actionresult gender(welcomevm model) { model.genders = new list<selectlistitem> { new selectlistitem { value="male", text="male"}, new selectlistitem { value="female", text="female"} }; return view(model); } [httppost] public actionresult welcome(welcomevm model) { return view(model); } public object final { get; set; } } } index.cshtml @{ viewbag.titl

angularjs - how to stop click event on ion-item for conditional items ionic -

i trying disable click on ion-item items. code this <ion-item class="item (app.app_id==='isdivider')?'item-divider':'' no-border padding-20-10" collection-repeat="app in apps" item-width="(app.app_id==='isdivider')?5000:90" item-height="(app.app_id==='isdivider')?70:105" ng-click="(app.app_id==='isdivider')||listdetailsofapps();item.clicked = true" stop-event="click"> it not calling if app.app_id isdivider still clickable. how make not clickable header , should not clickable put inside $scope function in controller detect , run other actions clickable item: controller: $scope.clickcheck = function(app){ if(app.app_id==='isdivider'){ //action divider. (should nothing) }else{ //action clickable item. (set item.clicked=true) } } view : repeat item inside <div> tag ,

angularjs - custom directive to add ng-click then draw input element -

i have directive returning followings : what trying here : 1- add click event . 2-this click draw input field , so far , ng-click being added dom doesn't call add function, can see tried use compile whole element gone when used what doing wrong ? return { link: function($scope, element, attrs) { $scope.add = add; $scope.remove = remove; el = element.attr('ng-click', 'add()'); // $compile(el); function add(){ console.log("inside addinput<<<<<<") var element = '<div>\ <input type="text"/>\ <button ng-click="remove()">save</button>\ <button ng-click="remove()">close</button>\ </div>'; newelement = $compile(newelement)($scope); element.append(newelement) } function remove(){ newelement.remove(); } } }

image - How to segment blood vessels python opencv -

Image
i trying segment blood vessels in retinal images using python , opencv. here original image: ideally want blood vessels visible (different image): here have tried far. took green color channel of image. img = cv2.imread('images/healthyeyefundus.jpg') b,g,r = cv2.split(img) then tried create matched filter following this article , output image is: then tried doing max entropy thresholding: def max_entropy(data): # calculate cdf (cumulative density function) cdf = data.astype(np.float).cumsum() # find histogram's nonzero area valid_idx = np.nonzero(data)[0] first_bin = valid_idx[0] last_bin = valid_idx[-1] # initialize search maximum max_ent, threshold = 0, 0 in range(first_bin, last_bin + 1): # background (dark) hist_range = data[:it + 1] hist_range = hist_range[hist_range != 0] / cdf[it] # normalize within selected range & remove 0 elements tot_ent = -np.sum(hist_range * np.lo

html - What's the difference between `overflow` properties `overlay` and `scroll` -

what's difference between overflow properties overlay , scroll . both adding scrollbar overflowing content. scroll show scroll bars irrespective of if content being clipped or not. overlay webkit proprietary property depreciated. same thing auto does. display scroll bar when necessary. just side note current possible values overflow auto hidden scroll visible great article here css tricks documenting difference. https://css-tricks.com/the-css-overflow-property/

ruby - Store stops working when upgrading to Rails 4.0 from 3.2 -

i upgrading rails application v3.2 v4.0 . in user model have json coded store: store :settings, accessors: [ :confirmed, :receive_marketing_emails, :receive_reply_emails ], coder: json this works expected, serializing user.settings , providing accessors. however when move rails 4.0 store stops working. following error when attempt user: json::parsererror: 795: unexpected token @ '--- :confirmed, :receive_marketing_emails, :receive_reply_emails ' can provide insight? there statement in rails upgrade guide : rails 4.0 has changed activemodel::serializers::json.include_root_in_json default value false. now, active model serializers , active record objects have same default behavior. i'd suggest when accessing user instance, json field cannot deserialized since expects no root, while serialized data has it. to revert rails 3.2 behaviour, put in config/initializers/wrap_parameters.rb : activesupport.on_load(:active_record) self.inclu

D3.js v4 - set padding for bar chart -

i'm trying add padding bar chart in d3.js v4. in v3, done in following way: var x = d3.scaleordinal() .domain(["a", "b", "c"]) .rangeroundbands([0, width], 0.1); however, in v4, rangeroundbands eliminated. know equivalent code in v4 (without padding) is: var x = d3.scaleband() .domain(["a", "b", "c"]) .range([0, width]); according this , should use band.padding set padding. tried this: var x = d3.scaleband() .domain(["a", "b", "c"]) .range([0, width]) .padding(0.1); but doesn't seem make impact. doing wrong? in d3 v4. this how define axis: var x = d3.scaleband() .range([0, width]) .round(true) .padding(.1);//set padding //set domain x.domain(data.map(function(d) { return d.letter; })); //define x axis var xaxis = d3.axisbottom() .scale(x); working bar chart d3 v4 sample here

java - How do I parse multiple integers from a string -

i have following string: "b:0123eh:0234et:0444" , need parse integers "0123; 0234; 0444" separate integers. regex might useful: string numbersstr[] = "b:0123eh:0234et:0444".split("[a-z]+:0"); int numbers[] = new int[numbersstr.length - 1]; (int = 1; < numbersstr.length; i++) { numbers[i - 1] = integer.parseint(numbersstr[i]); system.out.println(numbers[i - 1]); } now have array of integers. , @cricket_007 's comment. can replace pattern [^0-9]+ . ps; work if pattern mentioned above recurring

android - How to play a Mp3 file using MediaPlayer when touch a Button -

i error below every time try play song, play song when add code in main activity although when try playing in other of activity app crash , want know why happen , how solve issue. error: e/mediaplayer: error (1, -2147483648) d/mediaplayer: create failed: java.io.ioexception: prepare failed.: status=0x1 @ android.media.mediaplayer._prepare(native method) @ android.media.mediaplayer.prepare(mediaplayer.java:1158) @ android.media.mediaplayer.create(mediaplayer.java:944) @ android.media.mediaplayer.create(mediaplayer.java:915) @ com.example.android.phaseup.aviationsongactivity.oncreate(aviationsongactivity.java:19) @ android.app.activity.performcreate(activity.java:6251) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107) @ android.app.activitythread.performlaunchactivity(activitythread.java:

update table sql based on two criterias -

ok have seen few posts on reason code doesn't update trnid field table information on lasttrnid table b, appreciated. if base inner join on 1 field update works, know can done inner join on 2 fields can assume not doing correctly. table , table b created on fly @ beginning of query , have put both sets 1 table. final table should include person , each person first , last transaction per day why doing inner join on crdid , lasttrndate day portion of field. update table_a set table_a.trnid = table_b.lasttrnid table_a inner join table_b on (table_a.crdid = table_b.cardholderid) , (table_a.trnd = table_b.lasttrndate) your query looks ok (beside # on #table_a) so error on data. first check query bringing results try select see if fields want update , new value correct. select table_a.trnid, table_b.lasttrnid table_a inner join table_b on table_a.crdid = table_b.cardholderid , table_a.trnd = table_b.lasttrndat

ios - How to create Onboarding through SpriteKit? -

Image
i'm creating app have onboarding page, in application of telegram . how can create such page without cocoapods? came conclusion possible implement through spritekit view in view controller animation image. i'm having problem connection between sprite kit view , view controller. how can correctly add sprite kit scene view controller? i write on application in objective c . suggestions! first app , i'm excited hear suggestions.

html - How to bind scope data to model that is generated dynamically using Javascript? -

Image
the scenario have create dynamic table using javascript passing data passed script tag. javascript code parses provided json , generates table header , table body. table body generated along tags required angular binding method {{variable_name}} . but after dom created need re-apply scope ng-repeat of table. <html> <head> <title>dynamic table</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <script src="js/angular.min.js"></script> <script src="js/jquery.min.js"></script> <script type="text/javascript"> var orderbyfield = "impressions"; var reversesort = "false"; var mylist = [{firstname: 'john',lastname: 'doe',age: 30,etc : 'heelo'},{firstname: 'frank',lastname: 'burns',age: 54,etc: 'world'},{firstname: 

node.js - Node Error When Downloading Cordova/Ionic Mac -

i have been trying download cordova or ionic on new macbook pro past 2 days keep getting error: npm warn engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.2.1","npm":"2.14.7"}) have tried wondering if else coming across error or there new have not figured out yet? when install cordova use terminal command: sudo npm install -g cordova this stuff comes after error: /users/user/.node/bin/cordova -> /users/user/.node/lib/node_modules/cordova/bin/cordova cordova@5.3.3 /users/user/.node/lib/node_modules/cordova ├── underscore@1.7.0 ├── q@1.0.1 ├── nopt@3.0.1 (abbrev@1.0.7) └── cordova-lib@5.3.3 (valid-identifier@0.0.1, unorm@1.3.3, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, semver@4.3.6, dep-graph@1.1.0, shelljs@0.3.0, rc@0.5.2, xcode@0.8.0, glob@5.0.15, elementtree@0.1.6, npmconf@2.1.2, request@2.47.0, cordova-serve@0.1.3, tar@1.0.2, init-package-json@1.9.1, aliasify@1.8.0,

subset - Subsetting SPSS data imported into r with package haven? -

i've used package haven read spss data r. seems ok, except when try subset data doesn't seem behave correctly. here's code (i don't have spss create example data , can't post real stuff): require(haven) df <- read_spss("filename1.sav") tmp <- df[as_factor(df$variable1) == "factor1",] tmp <- tmp[!is.na(tmp$variable2), ] the above df has "na" scattered throughout. expected above subset data, keeping rows variable1 "factor1" , discarding rows nas in variable2. first subset works expected. second subset not. removes rows, nas still present. i suspect issue has way haven structures imported data , uses class labelled instead of actual factor variable, it's on head. know happening , how accomplish same? here's structure of df , variable1 , variable2 : > str(df) 'data.frame': 4573 obs. of 316 variables: > str(df$variable1) class 'labelled' atomic [1:4573] 9 9 9 14 8 8 2 4

How to discover php COM class -

i want stuff in ms word documents using php (mostly search-replace), , i've discovered com class. have question (because i'm relative new on php), how can found methods related word example: $objbookmark = $word->activedocument->bookmarks($bookmarkname); $range = $objbookmark->range; how should activedocument, bookmarks, range...etc. there way have list this? to have autocomplete (intelisense) need php class model , ide. make work much easier. one of best ide's have come acrross php tools visual studio. in visual studio plugin gallery or in devsense website. can use visual studio free community edition. to generate php based class model can either use com built in function: com_print_typeinfo ( object $comobject [, string $dispinterface [, bool $wantsink = false ]] ) or netphp component (this link step step example word interop) dump types inside binary complete php based class model: http://www.drupalonwindows.com/en/blog/php-com-class-c

php - How to rename more than 1 file during upload ? Codeigniter -

i have form upload 5 files, lets photo of person registering , other document him. now i'm creating folder every registered user name ( btw, thing do? ), , want rename each file right name let photo,document a,document b , etc. my current code $upload_setting['upload_path'] = './uploads/'.$_post['name'].'/'; $upload_setting['allowed_types'] = 'jpg|pdf'; $upload_setting['max_size'] = 5000; // 5 mb $upload_setting['file_name'] = $_post['name']; // define uploaded file name $this->load->library('upload', $upload_setting); if ($this->form_validation->run() == false){ $this->load->view('form'); } else{ if (!is_dir('./uploads/'.$_post['name'].'/')) { mkdir('./uploads/'.$_post['name'].'/', 0777, true); }

python - Filling NumPy array with object instances? -

i trying add object instances of astropy angles numpy array , , getting error: valueerror: setting array element sequence. the angle objects this: <angle 1.2557346257567 deg> if put them in normal python list, get: s = [<angle 1.2562500714928306 deg>, <angle 1.2562500714928306 deg>, <angle 1.2562500714928306 deg>] len(s) >>> 3 len(s[0]) >>> typeerror: 'angle' object scalar value has no len() so, first question is, in way python object sequence? and, since numpy arrays need initialized specific dimensions, how find "length" of object can load them numpy array? i don't have astrop package , don't know details of angle object. can make python , numpy observations. <angle 1.2557346257567 deg> string representation of object, produced __repr__ method. the typeerror len(s[0]) means object not __len__ method. not subclass of list, nor specialized numpy array. check doc

python - Is None really a built-in? -

i trying use python's (2.7) eval in (relatively) safe manner. hence, defined: def safer_eval(string): """safer version of eval() globals , builtins inaccessible""" return eval(string, {'__builtins__': {}}) as expected, following not work more: print safer_eval("true") nameerror: name 'true' not defined however, can still eval "none" string: print safer_eval("none") none so, none not built-in? @ least both part of __builtin__ ... why still eval-able? how rid of it, if had to? none constant in python, see keywords documentation : changed in version 2.4: none became constant , recognized compiler name built-in object none . although not keyword, cannot assign different object it. the compiler inserts reference singleton none object whenever name it: >>> dis import dis >>> dis(compile('none', '', 'eval')) 1

redirect - How can I pass an object to a specific view on a another page in TYPO3? -

i have simple controller 2 actions: listaction - shows list of objects showaction - shows detail page of object i using flexform plugin define detail page , can access via settings array in controller. standard view (list view) shows objects link detail page. link generated fluid link action: <f:link.action action="show" arguments="{example: example}" pageuid="{pageid}">details</f:link.action> the generated links looks follows: <a href="index.php?id=38&amp;tx_example_p1%5bexample%5d=5&amp;tx_example_p1%5baction%5d=show&amp;tx_example_p1%5bcontroller%5d=example&amp;chash=89353bbb46f26f41969f02800c5ae530">details</a> i think that's ok , redirect correct detail page working, seems show view not showing up, because not rendered. showaction , show.html looks follows: show.html <f:layout name="default" /> <f:section name="main"> <h1>detail page

visual studio - c++ template enable_if unable to match function definition to an existing declaration -

i trying define template member function template class outside of class leverage sfinae partially overload function. minimal example of trying is: test.h: template<typename t, size_t d> class test { public: test(){} ~test(){} template<size_t w = d, typename = int*> void do_something(test&); private: t data[d]; }; #include <type_traits> template<typename t, size_t d> template<size_t w, typename std::enable_if<w == 2, int>::type* = 0> inline void test<t, d>::do_something(test &) { exit(2); } template<typename t, size_t d> template<size_t w, typename std::enable_if<w == 3, int>::type* = 0> inline void test<t, d>::do_something(test &) { exit(3); } main.cpp: int main(int, char**) { test<float, 2> t1; test<float, 2> t2; t1.do_something(t2); return 0; } however code sample produces error: c2244 'test::do_something': unable match func

How can I get a date entered in a VB6 application to display on a Crystal report? -

i have vb6 application user inputs date range , dates used populate crystal 8.5 report using selection formula within vb6 code. need display date user selected on report. since date technically not parameter, not sure can put within field object/formula field date application. , appreciated!

c# - WPF Binding TwoWay not working, OneWayToSource working. WHY? -

i have control dependencyproperty of type timespan. when try bind property, value not being updated. usage of control: <controls:timecontrol time={binding sometimespanproperty} /> when change value of time in control, change not updated in sometimespanproperty. however, if change {binding sometimespanproperty} {binding sometimespanproperty,mode=onewaytosource} , updated. i found solution. if reading in future wants know it: i had explicitly set mode of binding twoway, because default binding mode timespan type property oneway. from this: <controls:timecontrol time={binding sometimespanproperty} /> to this: <controls:timecontrol time={binding sometimespanproperty,mode=twoway} /> and works !

javascript - Angular2 dynamic stylesheet element -

i'm loading content beehance api in json, has text , style info make configured in editor. the text contained in json has html tags , add [innerhtml] { text: '<div class="sub-title">lorem ipsum</div> <div class="paragraph">dolor sit amet</div>', ... } and styles like "paragraph": { "color": "#3b3b3b", "font_family": "arial,helvetica,sans-serif", "font_size": "12px", "line_height": "1.4em", "text_align": "left" }, "subtitle": { "color": "#000000", "font_family": "arial,helvetica,sans-serif", "font_size": "14px", "line_height": "1.6em", "text_align": "right" } so there angular2 way can append generated css <style> element? tried style tag inside template don't know h

algorithm - Understanding why Java selection rank returns max() as final result -

i working out solution following question: describe algorithm find smallest 1 million numbers in 1 billion numbers. assume computer memory can hold 1 billion numbers. the book gives selection rank solution having hard time understanding few parts of it: public static int partition(int[] array, int left, int right, int pivot) { while (true) { while (left <= right && array[left] <= pivot) { left++; } while (left <= right && array[right] > pivot) { right--; } if (left > right) { return left - 1; } swap(array, left, right); } } public static int rank(int[] array, int left, int right, int rank) { int pivot = array[randomintinrange(left, right)]; int leftend = partition(array, left, right, pivot); // returns end of left partition int leftsize = leftend - left + 1; if (leftsize == rank + 1) { return max(array, left, le

dependency injection - Where Do I Declare Unity Container? -

i'm getting started unity, , i'm having trouble finding advice declare unitycontainer object. of examples i've seen consist of single method unitycontainer object declared @ top, mappings defined, few object types resolved. how handle container when need access in several places throughout program? example, user clicks on button opens new window , window needs controller, needs resolve several services? want of services unity manages singletons, wouldn't mean i'd have have single instance of unitycontainer throughout program manage singletons? my first thought have main program class have static unitycontainer property or expose sort of unitycontainerfactory class manages singleton unitycontainer instance, both of methods seem bad because create global property lot of things dependent on. what's accepted way of doing this? as noted in other answer, should compose entire object graph in composition root . don't declare container static

java - How to initialize NamedParameterJdbcTemplate variable -

my code looks this: namedparameterjdbctemplate stmt; string sql = "insert ....."; // <- insert statement map<string, object> named = ...; ... stmt.update(sql, named); but when try compile program, i'm getting error message: variable stmt might not have been initialized stmt.update(sql, named); ^ 1 error in examples (like one ), i've seen namedparameterjdbctemplate variable not initialized @ all. so, wonder i'm doing wrong here. in tutorial, life cycle of namedparameterjdbctemplate managed spring . if not using namedparameterjdbctemplate in spring context, can create namedparameterjdbctemplate datasource or jdbctemplate . here's javadoc

javascript - Fixed width and flexible count of columns with HighCharts / HighStock -

i'm using highstocks , here little example show mean: http://goo.gl/m90fgh i wanna use columns navigation(to click) want have fixed width them , disabled grouping. issue when i'm trying resize chart (e.g. browser window smaller). if disable grouping , set fixed width create same count of cols on screen overlapping each other. resize chart, keep columns without overlap , set "zoom/range" in navigation/minichart display smaller number of columns same width. it's constant width & space between columns. somehow possible? update: tried solution: http://goo.gl/ojmsfn works if shrink screen/browser, not if try expand again. range stays still same in case, don't know why. thanks advices!

C# LINQ Zip: find at least one pair -

i have 2 arrays , i'd know if condition satisfy at least 1 pair lists. minimum reproducing code: var boxtypes = new string[] { "banana", "apple", "apple", "banana" }; var boxsizes = new int[] { 31, 16, 35, 8 }; int bigboxsize = 20; bool hasbigapplebox = boxtypes.zip(boxsizes, (type, size) => (type == "apple" && size >= bigboxsize) ? 1 : 0) .sum() > 0; this code iterates through pairs. 1 pair enough. any suggestion improve code? short answer: use any(result => result > 1) long answer: use of sum() going evaluate entire collection, , using any() evaluate until first true condition met. example: boxtypes.zip(boxsizes, (type, size) => (type == "apple" && size >= bigboxsize) ? 1 : 0) .any(result => result == 1) it's worth noting (type == "apple" &&

Selenium Grid c# - Running Multiple Browsers in Node Machine -

i'm automating test cases in c# using selenium grid, have hub windows machine , node mac. wanted run multiple browsers on node machine, firefox, chrome, safari. my hub command line java -jar selenium-server-standalone-2.48.2.jar -role hub my node command line enjava -jar selenium-server-standalone-2.48.2.jar -dwebdriver.chrome.driver="chromedriver.exe" -role node -hub http://ip:4444/grid/register -port 4507 -browser browsername=chrome mainstances=5, maxsessoin=5 -browser browsername=firefox maxinstances=5, maxsessoin=5 -browser browsername=safari maxinstances=5, maxsessoin=5 my c# snippet public static remotewebdriver instance { get; set; } public static void initialize() { desiredcapabilities capabilities = new desiredcapabilities(); capabilities = desiredcapabilities.firefox(); capabilities = desiredcapabilities.chrome(); capabilities = desiredcapabilities.safari(); capabilities.setcapability(capability

objective c - Refresh UI after downloading data from server in iOS -

i have download few data , display information in colection view. downloading data in loop. want refresh ui after downloading first data server. refreshing ui after downloading data. taking lot of time , user not wait long.as data saved locally refreshing ui this, [[nsnotificationcenter defaultcenter] postnotificationname:@"refresh" object:self]; the collection view delegates getting called late. how should handle situation. if method of refreshing content, using nsnotificationcenter , works, should call on main thread calling in block. just wrap around current code: dispatch_async(dispatch_get_main_queue(), ^{ [[nsnotificationcenter defaultcenter] postnotificationname:@"refresh" object:self]; });

user interface - Adding my code into a JFrame -

so can make frame appear. have program runs on eclipse console. need pass program console frame. how that? or if long of explanation can point me somewhere may learn how it? here little bit of code. need add in if statement frame. jframe frame = new jframe("amendments"); frame.setvisible(true); string z = "y"; while (z.equalsignorecase("y")) { random x = new random(); int y =x.nextint(1); scanner in = new scanner(system.in); if (y == 0) { system.out.println("what first amendment?"); string answer = in.nextline(); system.out.println("your answer: " + answer); system.out.println("right answer: right rapps religion split between practice , establish"); }

javascript - Firefox/IE cached page on startup only shows AJAX content -

i have webapp uses ajax calls load html snippets in various places. note webapp simulates regular navigation use of history.pushstate function (not sure has problem still mention it). problem: whenever exit browser tab displaying webapp , restart again, browser not trigger regular http request load whole page. uses cache mechanism load response of latest http request. in case, if last request happens ajax call, browser load html snippet without css, js nor rest of html. note problem appears in firefox. in ie, whole page can reloaded if accept execution of scripts when being prompted. chrome works fine loads entire page. question: normal behavior , how can prevent (i.e. make work in chrome)? thanks helping!

mysql - "systemd" command missing from Amazon EC2 t2.micro -

i launched ec2 t2.micro instance amazon , trying install mysql server command: sudo yum install mysql-community-server i'm getting following error: error: package: mysql-community-server-5.7.9-1.el7.x86_64 (mysql57-community) requires: systemd i tried installing systemd command following this post i'm getting following error: /usr/include/linux/loop.h:58:2: error: unknown type name '__u64' __u64 lo_init[2]; ^ in file included /usr/include/netinet/if_ether.h:25:0, /usr/include/netinet/ether.h:25, ./src/shared/socket-util.h:26, ./src/core/unit.h:39, ./src/core/busname.h:27, src/libsystemd/sd-bus/bus-kernel.h:26, src/libsystemd/sd-bus/bus-internal.h:38, src/libsystemd/sd-bus/bus-objects.c:26: /usr/include/linux/if_ether.h:140:2: error: unknown type name '__be16' __be16 h_proto; /* packet type id field */ ^

c# - WPF listview change observable collection properties with button inside ListView Item -

i using wpf list view bound in xaml to observable collection. below list view item template generates view like listview item looks this <datatemplate x:key="imageoverlayalbumdatatemplate"> <grid> <grid margin="5,5,5,5"> <border borderbrush="lightgray" borderthickness="1"> <stackpanel orientation="vertical" background="white" height="50" width="240" verticalalignment="center"> <grid> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition /> <columndefinition width="auto" /> </grid.columndefinitions> <grid.rowdefinitions>