Posts

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

android - The constructor Intent(new View.OnClickListener(){}, Class<DrinksTwitter>) is undefined -

i getting following error: the constructor intent(new view.onclicklistener(){}, class<drinkstwitter>) undefined in following code snippet: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // edittext , button references etusername = (edittext)findviewbyid(r.id.username); etpassword = (edittext)findviewbyid(r.id.password); btnlogin = (button)findviewbyid(r.id.login_button); btnsignup = (button)findviewbyid(r.id.signup_button); lblresult = (textview)findviewbyid(r.id.result); // set click listener btnlogin.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // check login string username = etusername.gettext().tostring(); string password = etpassword.gettext().tostring(); if(username.equals("test") && password.equals(...

java - Achieve the xml hierarchy structure having an ordered list with level numbers -

i have list of numbers represents levels in xml tree. example have folowwing list: 0, 1, 2, 2, 1 and xml (with 'lev' elements) needs be: <lev> <lev> <lev> </lev> <lev> </lev> </lev> <lev> </lev> </lev> how can form xml having list? need recursive method, need xsl file, great having java code - parsing list. i'm not sure if possible, having list. great! thanks. later edit: for above list let's introduce position too: level position 0 0 1 1 2 2 2 3 1 4 if having in list number(level) x , after having number(level) y y<=x know @ point last element(s) (x, x-1, ..., y) needs closed when creating xml. ex.: when @ position 3 (level 2) know element @ position 2 (also level 2) needs closed when @ position 4 (level 1) know element @ position-s 3 (level 2) , 1 (level 1) needs closed recursion...

multithreading - Is there a build in functionality in .NET to create thread bound variables? -

is there way (psedo code): getcurrentthread().items.add(new refobject); then later on retrive refobject[] refobjs = getcurrentthread().items; and enumerate objects. both calls occur on same thread during life span of it. the basic idea can easisly identify items current thread , in fact created in thread. it's same using page.request object asp.net request - know it's unique in worker process, doesn't mixed other requests being served @ same time. want treat thread page.request - comes , goes, while it's alive, can query @ without caring other threats exist in process. once did similar, more of simulation marshaling objects reference. , can think of couple of more ways it, don't want manually store mapping between thread , object myself. isn't there similar transactionscope threads in .net ? not intersted in dealing hardship of syncronization , avoiding race conditions. ps: if that's not available, can @ least application domain without ...

date_select in rails -

i have issue, when post date in date_select post today's date, although select future date keeps giving me current date. <%= form.date_select :starts_at %> does me out... in advance. check model. are attributes attr_accessible while isn't? attr_protected?

image polling through javascript -

i need poll image using javascript , need perform action once image found @ position. code have written task. /*----image handling script starts here----*/ var beacon = new image(); beacon.onload = function() { console.log('image found'); console.log(this.width,this.height); window.clearinterval(timer); }; beacon.onerror = function(){ console.log('image not found'); } var timer = window.setinterval(function(){ console.log('sending request again'); beacon.src = "http://www.google.co.in/logos/2010/lennon10-hp.gif"; },2000); /*----image handling script ends here----*/ problem that, after 1 request, response gets cached , request don't sent everytime set src. if examine net tab, sends request on first src set , caches response. i need send fresh request image every time code sets src. workarounds? request image different query string each time. browser treat unique url , won't have in cache. can away ...

unit testing - How to test private variables in NUNit? -

i have a static class has private variable. private static dictionary<strng, string> items = new dictionary<string, string>(); many public methods of class access dictionary object. want write nunit test class (in different library). how can test private variable? i know question nunit , don't want argue whether it's or bad practice test private members. fact it's necessary, when have deal legacy or poorly designed code can't refactor. so mention gallio/mbunit provides light api called mirror ease testing private type members. example: following test sample invokes private method named someprivatemethod on foo instance. [test] public void sampletest() { var foo = new foo(); int actual = mirror.forobject(foo)["someprivatemethod"].invoke(); assert.areequal(123, actual); }

php - Finding the first and last days of each month in the period of time -

i have task make website article stats based on database results. need calculate amount of articles added monthly , pass these results javascript stats function. the first i'm doing finding entire period in articles have been added: select min(date) startdate articles limit 1 select max(date) enddate articles limit 1 now have period starts $startdate , ends $enddate . these variables unix timestamps in database. column date in database unix timestamp. next, should find amount of articles have been added in each month doing query in foreach loop like: select count(id) total articles date > ".$startmonth." , date < ".$endmonth but make need find first , last days of each month in period. , stucked @ moment. please can please suggest me how find these first , last days array. think should make strtotime("+1 month",$date) in while loop until $startdate equals $enddate . in advance. upd. there total 46 articles in database. wi...