Posts

Linux: all commands return Fatal Python error: Py_Initialize: Unable to get the locale encoding -

i messing around path variables , after putting following 3 commands, every shell command execute return fatal python error: export pythonpath=$pythonpath:z3/bin export path=$path:z3/bin export pythonpath=$pythonpath:/usr/lib/python2.7 error message: fatal python error: py_initialize: unable locale encoding file "/usr/lib/python2.7/encodings/ init .py", line 123 raise codecregistryerror,\ ^ syntaxerror: invalid syntax aborted does how can fix this? running ubuntu 14.04.

html - Twitter bootstrap resize a column -

i have table class .table .table-striped .table-bordered now when try change width of second column doesnt resize. i've tried width: 50% and inline styling still no luck. override in css this: .table tr td:nth-child(2) {width:50%;} see example: http://bootply.com/60325

java - How to perform Lambda expressions and forEach on normal arrays? -

i print arraylists such as colors.foreach(color -> system.out.printf("color: %s ", color)); but somehow can't apply normal arrays ( string[] colors ). how apply expression normal arrays? basically need way perform stream operations on arrays. it's simple converting array stream: arrrays.stream(colors).foreach(color -> system.out.printf("color: %s ", color)); for more info on see java 8 stream , operation on arrays

wpf - How to set maximum length of separated word of string property C# EF -

here part of model public class sensor { public int id { get; set; } [required] [maxlength(40)] public string name { get; set; } } name text filed have maximum length of 40 symbols. , in text field possible have few words. my question is possible set maximum length of word in name property? for example have: "motion detector". , want word maximum 8 symbols. mean motion , detector need less of 8 symbols length. user can't write "motiondetector" length 12 symbols. one way can use setter in property control max length per word: set { string[] words = value.split(' ') if (words.any(x => x.length > 8)){ //error, } else { //ok, pass name = value; //only update name if length words valid } }

vba - getting null when reading cell value using excel macro -

i have sheet pivot tables used. manipulated sheet , kept 4 columns data , rest hidden. copied data sheet, sorted it. above working fine macro. once sort happens, trying read cell value check if value positive, copy 4 columns data of row row. problem have is, though there value string or double in these columns, cells(row, column).value returning empty or 0. my data copied pivot table follows: snapshotbeforesort sorted data using macro , gives me output follows: customer effort value budget value total value table snapshot now need delete rows have total value(4th column) 0.0, copy data in 4 columns row if total value > 0 or <0. to 4th column value, used following code: printing time being have check t value > or < 0. dim t double t = cells(2,4).value msgbox t the value returned 0. if tried value in first column(customer), declaring t string, returning empty strin. please in reading right value. thank in advance

sql - how to get rows value in one row? -

select id x gives list of ids: 1 2 3 44 655 31 how in 1 row array? (1,2,3,44,655,31) query should this select string_agg(id, ',') x

c# - Proper way to avoid duplicating test data for unit tests -

lets have following unit test entity framework 6 using moq: public void save_employee_via_context() { var mockcontext = new mock<dcmdatacontext>(); var mockset = new mock<dbset<employee>>(); mockcontext.setup(m => m.employees).returns(mockset.object); var service = new generalservice(mockcontext.object); //test valid inputs (int = 0; < testdata.validemployees.count; i++) { service.addemployee(testdata.validemployees[i]); //veryfy inserted assert.areequal(testdata.validemployees[i],mockset.object.find(testdata.validemployees[i].employeeid)); } //ensure proper methods called each time. implied happened if above //assert methods passed, double checking never killed mockset.verify(m => m.add(it.isany<employee>()), times.exactly(testdata.validemployees.count)); mockcontext.verify(m => m.savechanges(), tim...