Posts

java - Android call notifyDataSetChanged from AsyncTask -

i've custom listadapter fetches data internet in asynctask. the data added list, when try operations application crashes... i'm sure because i'm calling notifydatasetchanged(); @ wrong time (i.e. before asynctask ends). what i've got now: public class mylistadapter extends baseadapter { private arraylist<string> mstrings = new arraylist<string>(); public mylistadapter() { new retreivestringstask().execute(internet_url); //here call notify function **************** this.notifydatasetchanged(); } class retreivestringstask extends asynctask<string, void, arraylist<string>> { private exception exception; @override protected arraylist<string> doinbackground(string... urls) { try { url url= new url(urls[0]); //return arraylist return getstringsfrominternet(url);; } catch (exception e) { ...

javascript - Fixing dynamic responsive navigation when there are more items than the container has width -

so i'm working dynamic navigation. basic html markup of <ul><li> composition. problem occurs when user added many items navigation , there isn't enough room them within container (imagine simple <div>). so, need solution. wondering if there way determine when width of <ul> larger or equal containing <div>'s width, inject remaining <li> elements new <li> dropdown them all. possible , if how? i know basics of jquery i'm afraid i'm not sure on this. oh and, need work responsively need work percentages too. let me know if feasible or if have better way around this, thanks. update: have updated github repo plan outlined. -- i use jquery this. idea i'm having follows. you <div>'s width, add widths of <li>'s , see if bigger. take off many needed <li>'s fit <div>. then add ones took off new <li> <ul> dropdown. i'm happy write this, wont till later w...

c# - KendoUI Grid ColumnMenu Undefined Columns -

i'm using asp.net mvc wrapper kendoui in project. i saw grid columnmenu , want use , works menu lists 3 undefined columns. my grid has 3 columns without model binding , empty title set this .includeinmenu(false) nothing changes, i've tried comment columns nothing changes again. edit: the grid code, cleaned readability. html.kendo().grid(model).name("grid") .datasource(datasource => datasource.ajax().read(read => read.action("", "").data("")).model(model => model.id(m => m.id)).pagesize(50).events(events => events.requeststart(""))) .columns(columns => { columns.template(o => "").clienttemplate("").htmlattributes(new { @style = "white-space: nowrap;" }).width(100).includeinmenu(false); columns.template(o => "").width(36).headertemplate(h => "").htmlattributes(new { style = "text-align:center" }).clienttemplate("...

EclipseLink nullable column but unique -

is possible define column eclipselink, can null if value != null exists, there should unique values within column. how can model that? thank you andre what type of value? i enforce uniqueness in object model, not in database. if want restrict in database, add check constraint in own ddl script. in java can use enum or type code or value , restrict through set methods. eclipselink have @objecttypeconverter allows conversion between set of values.

optimization - MATLAB fmincon interior-point Warning: Matrix is singular to working precision -

i trying run fmincon function of matlab optimization toolbox in following form: fmincon(@fun,a,b,aeq,beq,lb,ub) i cannot find solution , getting no feasible solution found. i went troubleshooting testing boundaries following code: f = zeros(size(x0)); xnew = linprog(f,a,b,aeq,beq,lb,ub) this did not work when did aeq=sparse(aeq);a=sparse(a); magically did! sparse not work fmincon ! in addition that, warning: matrix singular working precision when run fmincon . think matrix matrix in fmincon function. still presume problem matrices because of sparse experience above. here example of matrices: =0.3333 -0.3333 aeq = 1 1 0.6667 0.3333 0.3333 0.6667 so have idea problem , how can solve it? by way linear problem can solved 'active-set' algorithm out of 4 possible algos fmincon . 1 not strictly abide constraints, giving constraint violated results sometimes. any advice appreciated.

Stream support for git-p4 or good p4 command line tutorial? -

my current project sits in perforce stream workspace. quite familiar git, git-p4 not support streams. know way around limitation? do know cli tutorial perforce (from git user perspective)? or command line wrapper perforce use similar git (most not possible)? thanks, lars i don't think git-p4 supports streams. clone depot path, whereas stream may include several modules. here's article notes on how command usage stacks between git , perforce: http://answers.perforce.com/articles/kb_article/mapping-git-terms-and-commands-to-perforce/?l=en_us&fs=relatedarticle

java - Counting pages in a Word document -

i'm trying count pages word document java. this actual code, i'm using apache poi libraries string path1 = "e:/iugkh"; file f = new file(path1); file[] files = f.listfiles(); int pagescount = 0; (int = 0; < files.length; i++) { poifsfilesystem fis = new poifsfilesystem(new fileinputstream(files[i])); hwpfdocument wddoc = new hwpfdocument(fis); int pagesno = wddoc.getsummaryinformation().getpagecount(); pagescount += pagesno; system.out.println(files[i].getname()+":\t"+pagesno); } the output is: ten.doc: 1 twelve.doc: 1 nine.doc: 1 one.doc: 1 eight.doc: 1 4teen.doc: 1 5teen.doc: 1 six.doc: 1 seven.doc: 1 and not expected, first 3 documents' page length 4 , other 1 5 pages long. what missing? do have use library count pages correctly? thanks in advance this may you. counts number of form feeds (sometimes used separate pages), i'm not sure if it's gonna work documents (i guess not). ...