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.

jquery - How get size of element with hidden parent? -

1.4.4 return size of hidden element, element in hidden element? there better solution getwidth? <script type="text/javascript"> function getwidth(element){ var parent = element.parent(); $('body').append(element); var width = element.width(); parent.append(element); return width; } $(function(){ var width = $("#foo").width(); console.log(width); //0 width = getwidth($("#foo")); console.log(width); //ok }); </script> <div style='display:none'> <div style='display:none' id='foo'>bar</div> </div> when elements hidden, width may vary depending on styling. , when hidden element inside hidden element, results vary again. however, jquery code quite straightforward: $('#foo').parent().width() this grab foo...

java - How do you use variable arguments to wrap a certain function taking an Object[] -

i have method takes key , associated parameters in following format. public string foo(string key, object[] parameters) {..} i prefer pass parameters using variable argument format. how should that? i tried public string foo(string key, object... parameters) {..} - seems collide method definition given above. should following , wrap object[] method? public string foo(string key, object a) {..} public string foo(string key, object a, object b) {..} public string foo(string key, object a, object b, object c) {..} just change definition of existing function to public string foo(string key, object... parameters) {..} the variadic method mechanism in java syntactic sugar creating array @ call site , passing in. method should compatible existing source code and compiled classes. from the java documentation on varargs : the 3 periods after final parameter's type indicate final argument may passed array or sequence of arguments.

html - Change label text using Javascript -

why doesn't work me? <script> document.getelementbyid('lbltipaddedcomment').innerhtml = 'your tip has been submitted!'; </script> <label id="lbltipaddedcomment"></label> because script runs before label exists on page (in dom). either put script after label, or wait until document has loaded (use onload function, such jquery ready() or http://www.webreference.com/programming/javascript/onloads/ ) this won't work: <script> document.getelementbyid('lbltipaddedcomment').innerhtml = 'your tip has been submitted!'; </script> <label id="lbltipaddedcomment">test</label> this work: <label id="lbltipaddedcomment">test</label> <script> document.getelementbyid('lbltipaddedcomment').innerhtml = 'your tip has been submitted!'; </script> this example (jsfiddle link) maintains order (script first, label) , uses o...

fullscreen - Android: How to fade out search / home / menu / back buttons? -

i'm using android (archos 43) extended display in industrial application. need single program display data received, , send user inputs bluetooth. little program should start directly after booting , should disable (fade out) android-buttons (search, home, menu , back). here's problem: i know, there applications can fade out these search/home/menu/back-buttons (like deskclock or videoplayers), how work? using: android:theme="@android:style/theme.light.notitlebar.fullscreen" only disables titlebar, not 4 android-buttons. it's not android-problem, special feature archos 43 internet tablet. androidmanifest.xml : <uses-permission android:name="archos.permission.fullscreen.full" />

algorithm - Python usage of breadth-first search on social graph -

i've been reading lot of stackoverflow questions how use breadth-first search, dfs, a*, etc, question optimal usage , how implement in reality verse simulated graphs. e.g. consider have social graph of twitter/facebook/some social networking site, me seems search algorithm work follows: if user had 10 friends, 1 of had 2 friends , 3. search first figure out user a's friends were, have friends each of ten users. me seems bfs? however, i'm not sure if that's way go implementing algorithm. thanks, for 2 cents, if you're trying traverse whole graph doesn't matter whole lot algorithm use long hits each node once. seems you're saying when note: i'm trying traverse whole graph this means terminology technically flawed- you're talking walking graph, not searching graph. unless you're trying search in particular, don't seem mention in question @ all. with said, facebook , twitter different graph structures have impac...

Java Server socket stuck on accept call (Android Client, Java Server) -

below have put fragment of code understand problem. have server code, works fine first time client loads , sends packet. after first packet received, server stuck on "accept". i have wireshark configured port, , server getting packets. wonder why accept wont return more once. driving me nuts. server code public class dapool implements runnable { private serversocket serversocket; private arraylist<da> pool; private linkedlist<socket> clientconnq; public dapool(int newpoolsize, int serverport) { try { serversocket = new serversocket(serverport, 500, inetaddress.getbyname("127.0.0.1")); } catch (ioexception e) { e.printstacktrace(); return; } poolsize = newpoolsize; clientconnq = new linkedlist<socket>(); pool = new arraylist<da>(poolsize); da devicethread; (int threads = 0; threads < poolsize; threads++) { devicethread = new da(); connpool.add(devicethread); devicethread.start()...

class - LaTeX: \newenvironment with only one optional arg (and no mandatory) -

try set new environment within class take optional argument, or none. this used : \begin{myenv} --> "label:" or \begin{myenv}[mylabel] --> "label: mylabel" i try define environment basic macros. rather not use xparse package. i have found several examples of \newenvironment optional argument mandatory one. not need mandatory argument! is there way \newenvironment or \def macros ? no problem, declare environment 1 argument, , make optional: \documentclass{minimal} \newenvironment*{myenv}[1][]{% label: #1% \par \ignorespaces }{% \par end% \par \ignorespacesafterend } \begin{document} \begin{myenv} abc \end{myenv} \begin{myenv}[mylabel] abc \end{myenv} \end{document}