Posts

Showing posts from April, 2014

How to get my real IP using vb.net? -

how real ip using vb.net? if running in asp.net, use httprequest.userhostaddress property : dim ip string ip = request.userhostaddress()

Simple DropDownList in ASP.NET MVC3 app -

i need simple dropdownlist in form , don't want create viewmodel. have 2 models(tables) in relation 1:n: public class course { public int id { get; set; } public string name { get; set; } } and public class project { public int id { get; set; } public int courseid { get; set; } public int projectno { get; set; } public string name { get; set; } public datetime deadline { get; set; } } in 'create project' want have dropdownlist id (as value) , name(as text) course table(model). in new project insert chosen courseid. how can simple possible? any particular reason why don't want use viewmodel? they're helpful type of problem. if don't want use viewmodel, can construct specific class in controller aggregate of properties need both classes: public actionresult show(int id) { course course = repository.getcourse(id); // whatever persistence logic here project project = projectrepository.getprojectbycoursei...

jqtouch - How to find the id of an element using jQuery -

this html code < body > < div id="map" > i traversing parents until find body find map var pagefrom= $(theelement).parentsuntil( 'body' ); var pagefromid = $(pagefrom).attr("id"); in firebug see pagefrom [div#map.current] the problem pagefromid "" , should "map" if you're using parentsuntil() [docs] method, retuning collection of ancestors ordered nearest starting point farthest away. because of this, you'll need access last 1 in collection id. var pagefrom= $(theelement).parentsuntil( 'body' ); var pagefromid = pagefrom.last().attr('id'); or var pagefrom= $(theelement).parentsuntil( 'body' ); var pagefromid = pagefrom.slice(-1).attr('id'); note can grab id property on element: var pagefromid = pagefrom.get(-1).id;

php - Create operation wcf with parameters matching database fields -

i want consume wcf service in php script , goal insert record database. my database table has 4 fields..is possible create wcf service accept 4 parameters, 1 each field? i guess similar asks web service input parameters. or there better, more efficient way of achieving goal? thanks you can create wcf web service simple method accept 4 parameters. [servicecontract] public interface iservice { [operationcontract] void insertfields(string field1 string field2, string field3, string field4); } but there better ways this, example wcf data services , odata. as want consume service php, think odata choice. hope helps.

database - Debugging a Simple IF Statement in PHP -

code does not work -- $u = $_session['username']; while($responseanswer=mysqli_fetch_array($rquery)){ if($responseanswer['onuser']=='$u'&&$responseanswer['response']=='') { echo "awesome"; } } works $u = $_session['username']; while($responseanswer=mysqli_fetch_array($rquery)){ if($responseanswer['onuser']&&$responseanswer['response']=='') { echo "awesome"; } } how resolve this? $u fine. thanks. single quotes not interpolated variables inside them. should work: if($responseanswer['onuser']==$u && $responseanswer['response']=='') but 1 thing note, i'd highly suggest format cod ebetter. include spaces appropriate, , indent scope. code become: $u = $_session['username']; while ($responseanswer=mysqli_fetch_array($rquery)) { if ($responseanswer['onuser'] == $u ...

Use variable as part of textbox name in C# -

i developing program wth 30 text boxes , 30 check boxes next them. want people check names , press send button. program saves names in txt file true or false statement next them, uploads file ftp server me analize. problem facing don't want write code every text , check box load , save it's value on txt file. if name text boxes tbox1;tbox2;tbox3 etc. how use loop write value of tbox i + ; + cbox i on line i of thing.txt or vice versa? please grately apreciated because save me lot of unnesacery code writing! (int = 0; <= count; i++) { textbox textbox = (textbox)controls.find(string.format("tbox{0}", i),false).firstordefault(); checkbox checkbox = (checkbox)controls.find(string.format("cbox{0}", i),false).firstordefault(); string s = textbox.text + (checkbox.checked ? "true" : "false"); }

iphone - Can't seem to read UITextField value correctly -

i trying verify uitextfield, allows numbers isn't 0 (zero). check fails every time? when debugging resultingstring = '0'( type in 0 ) trying make fail, doesn't fail. nsstring *resultingstring = budgetfield.text; if(resultingstring == @"0" || [resultingstring length] == 0){ [apphelpers showalert:@"dude!" withmessage:@"don't cheap know have more $1"]; //never gets in here. return; } use "==" values, not strings: ([resultingstring intvalue] == 0 || [resultingstring length] == 0)

Setting html id on a sub menu's <ul> with Telerik MVC Menu Control -

using telerik asp.net mvc menu control, i'm trying id on ul's in sub menus. i've tried putting htmlattributes(new { @id="myid" }) call in few places can't seem figure out put id on . in code snippet below, i've shown 2 places i've tried calling htmlattributes method. comment after call explains telerik control putting id. @(html.telerik().menu() .name("mainmenu") .items(menu => { menu.add() .text("tools") .items(item => { item.add().text("add toolbox").htmlattributes(new {@id="toolsmenu"}); @* puts id on "add toolbox" <li>*@ item.add().text("toolbox"); }).htmlattributes(new {@id="toolsmenu"}); @* puts id on "tools" <li>*@ menu.add() .text("setup") .items(item => { item.add().tex...

sharepoint - make all moss pages available without password -

hello evey time person enter moss site moss ask him username , password need moss available every 1 how want enter regular site without username , password i working on sharepoint 2007 version: 12.0.0.6421 try below steps. more information on link enable anonymous access web application central admin. central admin home page > application management > authentication providers > select membership provider (authentication.aspx) , enable anonymous access next page. you don't have on iis manager ... enabling central admin page enable on iis. explicitly turn on sites want accessed anonymously. browse site, click site settings > advanced permissions > settings >anonymous access (setanon.aspx) , turn on anonymous access site.

regex - string replace without href in javascript -

<html> <head> <title>test</title> </head> <body> <a href="hello.html">hello</a> <script> var str=document.body.innerhtml; document.body.innerhtml=str.replace(/hello/g, "hi");</script> </body> </html> in code hello.html , hello change hi.html , hi. don't want replace href="". how write regular expression ? the following regex replace wil want: <script> var str=document.body.innerhtml; document.body.innerhtml=str.replace(/(>[^<]*)hello/g, "\1hi"); </script> but think still fragile, , solution regex replaces in .innerhtml be... remember regexes hacky solution when trying solve problems involve html/xml parsing.

html - Browser rendering right margin iPhone/iPad/webkit -

Image
i have html snippet below renders in browsers. in webkit on iphone , ipad, when pinch page (so smaller), see black border background color of body shining through on right edge. happens when specifiy width of .headerpic div. since place in document specify width, wondering why stops short of rendering way right edge (since theoretically widest part of document?). i've attached photo of looks ipad. <!doctype html> <html> <head> <style> body {background-color:#000;color:#231f20;margin:0;} #wrapper {background-color:#fff;min-height:1000px;} #header .headerpic {height:102px;padding-top:80px;margin:0 auto;width:986px;} #footer {color:#fff;} </style> </head> <body> <div id="wrapper"> <div id="header"> <div class="headerpic"> </div> </div> </div> <div id="footer"> ...

c# - Download file from ASP.NET MVC 2 site -

i'm trying implement controller can download files (more jar-archives). files stored on disk , not in database. far have come this: public filepathresult getfile(string filename) { return file(path.combine(server.mappath("~/app_data/bundles"), filename), "application/java-archive"); } nevermind lack of error handling , such @ time. file downloaded way, gets wrong name. instead of, example, "sample.jar" file gets controller's name, "getfile", (without extension). any ideas on doing wrong? use overload allows specify filedownloadname . return file(path.combine(server.mappath("~/app_data/bundles"), filename), "application/java-archive", filename);

c# - What is this behaviour called? -

i have following method: public override bool issatisfiedby(sourcefile candidate) { console.writeline("check 1: " + one.issatisfiedby(candidate)); console.writeline("check 2: " + two.issatisfiedby(candidate)); console.writeline("check 3: " + three.issatisfiedby(candidate)); return one.issatisfiedby(candidate) && two.issatisfiedby(candidate) && three.issatisfiedby(candidate); } if pass sourcefile argument not fulfills rule one, rule 2 , 3 aren't checked. know correct way, read more exact behaviour can't find because don't know behaviour called :d it's called short-circuit evaluation . in c# happens && , || operators.

javascript - Delay/defer document.write from an external script till after document ready -

i have external script loads advertisements. script being loaded includes calls document.write . problem delays doc ready site. delay showing until after doc ready. currently tried wrapping function loads external content in jquery doc ready, page blows up. goes white screen ad , code showing. obviously because document.write running after page loaded. know way around or how delay loading of external content till after doc ready? you try hack override document.write , buffer output , write div in doc ready.

java - Decoding a QR code in an Android application? -

in android, using zxing can scan qr code through phone camera , decode it. but, in scenario, qr code image stored in phone , need decode it. is there anyway decode qr image in manner? you can use zxing code this. check out decodehandler.java .

php API daemon process over a url -

i need background process api on url. for example, url http://www.msite.com/myapi.php read incoming protocol , reply. what best way accomplish scenario? should treat regular web page? what pros/cons using web page url api? you should implement rest service. check this url out. you need create proper controller (in case use mvc approach) , implement proper methods corresponding api (http request methods important topic here). illustrate, allowed myself paste code url embedded here: get request /api/users – list users request /api/users/1 – list info user id of 1 post request /api/users – create new user put request /api/users/1 – update user id of 1 delete request /api/users/1 – delete user id of 1 just notice, can use different approach xml-rpc or soap .

Explain this javascript function from Eloquent Javascript -

i having hard time following function. not understand how variable start reverts 16 after reaches value of 26 greater 24. function findsequence(goal) { function find(start, history) { if (start == goal) return history; else if (start > goal) return null; else return find(start + 5, "(" + history + " + 5)") || find(start * 3, "(" + history + " * 3)"); } return find(1, "1"); } print(findsequence(24)); ok, after looking @ sometime, have few questions might clarify few things: 1) correct statement each call find keeps track of it's own start value? example, when find(1) called, it's has start value of 1, when find(1 + 5) called, find(1)'s start value still one, find(1 + 5) has it's own start value of 6. 2) having hard time following stacktrace if see printed out. how viewing it: find(1) calls find(1 + 5) //start = 1 find(6) calls find(6 + 5) // ...

javascript - JQuery Link to several different pages from one JS file -

i want modify current script when click on image new (lightbox) pop-up appears , within specific animation plays. have feature working, animation needs seperated different parts , and have it's own link animation. once click on triangle on left hand side, want load different page different animation no sure how. see code blow (sorry large chunk of code) // ------------------------------------------------------------------------------------------------------------------------------ // getobjbyid() function getobjbyid(id){var ns4 = (document.layers)?true:false; var ns6 = (document.getelementbyid)?true:false; var ie4 = (document.all)?true:false;if (ns4){return document.layers[id];}else if(ie4){return document.all[id];}else{return document.getelementbyid(id);}} // pushin() function pushin(the_array, the_data){var len_array=the_array.length;the_array[len_array]=the_data;return the_array.length;} // javascript function display flash movie format video on web page function op...

Apache .htaccess 404 error redirect -

i'm trying make htaccess file redirect 404 errors through index.php. page user failed access appended index.php's url can find out page request failed. for example, if tried access http://example.com/doesntexist.php , apache should redirect them http://example.com/index.php/doesntexist this have: rewritecond %{request_filename} !-l rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule .* index.php?%{query_string} [l] this works on 1 of webhosts failed when transfered site webhost (godaddy). thanks guys i can't test right now, according this answer , when set a errordocument /404.php (or index.php, doesn't matter) the $_server["request_uri"] variable contain original, failed request.

c# - What does a BitWise OR ("|") mean when used with a return statement? -

in c#.net, has ever seen return statement inside method looks this? protected override buttons getbuttonstoshow() { return buttons.new | buttons.return | buttons.delete; } how bitwise operator "|" working here? result of statement? know how bitwise operators work in if ... else ... statements , such, i've never seen used way. buttons flags enum . this makes bit-mappable can use bitwise operators combine values. in case returns value bitmap combining of 3 options. this blog post has quite clear explanation (though uses & example).

javascript - How to execute a command in a Firefox Add-On? -

i quite new writing firefox add-ons, still, got point patched working extension, except core of it. at point in code, need execute system-command on file. i've found snipped on web , tried adapt it, without luck. xpi/components/script.js : var cmd = '/usr/bin/somecommand' var args = ['-option', 'value', f.path ]; var execfile = components.classes["@mozilla.org/file/local;1"].createinstance(components.interfaces.nsilocalfile); var process = components.classes["@mozilla.org/process/util;1"].createinstance(components.interfaces.nsiprocess); execfile.initwithpath(cmd); if (execfile.exists()) { process.init(execfile); process.run(false, args, args.length); } can tell me what's wrong here? i've assembled command , i've got filename can't firefox execute code snippet. is execfile , initwithpath , createinstance , etc. stuff needed?? want execute command in cli: $ somecommand -option value filename ...

android click event programmatically -

actually programmatically want click on coordinates. want evoke click event on coordinates providing programmatically. it possible using performclick() if it's specific view want click on.

actionscript 3 - ASP.net MVC with AS3 — user sessions -

i have searched high , low answers on topic have not found direct me in right direction. i want add ability have flash game record users progress save database. part pretty easy, how can make user can login , continue game. i wanting know if it'll better game progress saved sharedobjects or sql database. i game played on website , data can still accessed , played if advised. new user sessions as3 , need pointers. i appreciate help. let me know if need explain better. you deploy wcf service on asp.net server , use service retrieve , set data database, including verifying if login correct , if send gamesession data. you can send byte array wcf strings, int , other datatype including classes long propperly setup. to have flash able connect website anywhere site needs cross domain policy file other wise flash (or silverlight matter) not able connect service. silverlight cross domain flash cross domain (blah.winsmarts.com)wcf hello world tutorial (one of b...

url - Match a string from tons of patterns -

i want make system url matching. work in way: the database contains many patterns. , metadata of pattern this: pattern1, keyword pattern2, keyword ... ... i have input url. htttp://example.com/blabla/111/2222/detail.htm the system input , output keyword of matched pattern input url. there more 20,000 requests per second. the thing need design pattern , database model. i've spend on 2 weeks in system. i'm thinking match url in tree. all nodes in tree able 2 kinds of output: node should continue matching url, or node know keyword should applied url. each node connected callback(a script stored in db). different node have different behavior. but thing have tons of patterns. think need have facility convert patterns thos "nodes". or @ least can build tree existing nodes patterns in db. i'm still thinking tree generating. there should better way. any ideas helpful. thank you!!! you need 1 of industrial-strength string matching algori...

Is there a javascript method to find out if a string is part of another string? -

i need find out if 1 string in , return true or false, or similar. just remembered having read indexof returning -1 if doesn't find something? use indexof function of string: var str = "something"; var other = "thi"; if (str.indexof(other) != -1) { // other part of original string. }

url - How to change .php extension of website pages? -

i have website running on php. want remove .php suffix of webpages in such way user doesn't know server side language running. how edit displayed address in address bar not show .php ? with mod_rewrite in .htaccess: rewriteengine on rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l]

c# - Web Services and Queues -

our company has many soap services , few web sites post xml page. know soap envolpe allow wrap xml definition can potential represent objects, there difference in way handled? iis create queue(msmq) handle web service requests? thanks no, msmq not involved @ in web service running in iis. if want queueing, have implement (maybe queueing in msmq on server or using database).

java me - Alert pop up with LWUIT -

how create pop window using lwuit? want show alert , alert automatically dispose after 5 10 sec's. how lwuit? use code , show alert periodic time. dialog validdialog = new dialog("alert"); validdialog.setscrollable(false); validdialog.setisscrollvisible(false); validdialog.settimeout(5000); // set timeout milliseconds textarea textarea = new textarea("...."); //pass alert text here textarea.setfocusable(false); textarea.setisscrollvisible(false); validdialog.addcomponent(textarea); validdialog.show(0, 100, 10, 10, true);

mysql - How to Test Whether SimpleXML is installed on my PHP or not? -

anyone knows that? thing installed default. there easy way check whether extension installed or not? i check simplexml_load_string available me how simplexml not listed on php.ini there way also. can create php page <?php echo phpinfo(); ?> you can see simple xml enabled or disabled here.

php paypal integration -

i want return invoice generated after paypal payment on website. how paypal invoice generated after payment made? you can every information paypal using paypal api .

Ruby on Rails and strange HTTP_ACCEPT header from PSP -

i have ruby on rails app (3.1rc4) , getting couple of exceptions each day same user agent (mozilla/4.0 (psp (playstation portable); 2.00)). exception: a actionview::missingtemplate occurred in home#index: missing template home/index, application/index {:formats=>["*/*;q=0.01"], :locale=>[:en, :en], :handlers=>[:erb, :builder, :arb]}. searched in: "/var/www/releases/20110721144523/app/views" i have app/views/home/index.html.erb, looks tries find file strange request format " / ;q=0.01". http header: * http_accept : */*;q=0.01 anyone can me problem? this common problem, see ticket on github. you can choose render html explicitly; write render "index.html" instead of render . return html instead of 406 though. hope there better solutions.

javascript - How to make function work after append -

for example i'm using append, , example i'm appendig button in div, , have function $('button_id').click(... etc work affter append div, how can that.i mean no errors, function not starting, it's because append , want use function how that, tryed delegate, same thing.i tryed function in button tag , onmouseover , function thing, nothing gives me function not found.what solution ? i have 2 events, 1 event click event appends button, other event click event if button appended clicked, second event not working ? try using : $(elem).live(...) it bind event , in future.

iphone - Core data managed object property retention -

i seem having issue managed objects not releasing memory. have nsoperation downloads new information, saves temp context, merges main context. works in allocations instrument newly created properties stick around in memory after merge complete , entire operation deallocated. there way fix this? i've tried reset both temp , main contexts , refreshobject:, both don't fix this. thanks! make sure create nsautoreleasepool first thing in operations main . before return out of main make sure drain pool. includes returns before end of method such inside if statement.

How to create a dynamic website without IIS -

i want create dynamic website not support iis. area work not allow installed in server. have windows based server , create dynamic website. iis not allowed , server side languages asp.net, php not allowed. did not client side. possible do? in short, general answer question is possible? no, it's not. , if still find way, it's not going worth effort. for 1 thing, without programming languages asp.net or php, still need web server such iis serve static content. there of course alternatives iis specifically, no web server @ means no serving web sites @ all. if given opportunity server static content, possibly produce web site dynamic @ least on per visit basis using client side scripting , cookies, things make site limited, , without other serving static content there no saving things between sessions, or in way affecting server side of application. you have ask why need serve website. company benefit from? if so, convince department setup environment serve it?...

Facebook Javascript SDK security -

i'm in process of using facebook javascript sdk provide user login functionality website. what i'd take logged in user's unique facebook id , put/fetch data to/from mysql database using id determine data available said user. however don't feel secure. whilst i'm not storing sensitive credit-card details etc, i'd prefer secure practically possible. my fear javascript being it, fake facebook id , pull whatever wanted. i'm aware php sdk provide solid solution problem, javascript 1 because it's easy use , have basis of set (i admit it, i'm lazy). so, questions are: would set insecure feel might be? is there can improve security of such system, other switching php sdk? thanks! facebook ids pretty hard make (at user know own). depending on store in database (which not user cannot on own, unless ask extended permissions) if worried user trying information database, add access token or signed request each row , , facebook id d...

regex - Match line break with regular expression -

<li><a href="#">animal , plant health inspection service permits provides information on various permits animal , plant health inspection service issues online access acquiring permits. i want use regular expression insert </a> @ end of permits. happens of similiar blocks of html/text have line break in them. believe need find line break \n line contains(or starts with) <li><a href="#"> . you search for: <li><a href="#">[^\n]+ and replace with: $0</a> where $0 whole match. exact semantics depend on language using though. warning : should avoid parsing html regex. here's why.

asp.net mvc 3 - MVC3 + WIF - FederationResult missing "wctx" -

i have mvc3 app want implement claims support. goal follows: provide signin link, when clicked displays popup window username/password , facebook/windowslive/google etc. links automatically redirect signin page when protected controller accessed e.g. /order/delete i've set application , providers in appfabriclabs.com , included sts in project. i've created implementation of iauthorizationfilter can mark controllers [wifauth] , onauthorization method called. i've implemented use-case visitor has not been authenticated this: private static void authenticateuser(authorizationcontext context) { var fam = federatedauthentication.wsfederationauthenticationmodule; var signin = new signinrequestmessage(new uri(fam.issuer), fam.realm); context.result = new redirectresult(signin.writequerystring()); } and appfabriclabs page identity provider choices (haven't figured out how customise page). when log in returnurl gets called l...

max - Which maximum does Python pick in the case of a tie? -

when using max() function in python find maximum value in list (or tuple, dict etc.) , there tie maximum value, 1 python pick? random? this relevant if, instance, 1 has list of tuples , 1 selects maximum (using key= ) based on first element of tuple there different second elements. how python pick 1 pick maximum? i'm working in python v2.6. on python 2, isn't specified in documentation , isn't in portable in-python section of standard library, behaviour may vary between implementations. in source cpython 2.7 implemented in ./python/bltinmodule.c builtin_max   [ source ] , wraps more general min_max function  [ source ] . min_max iterate through values , use pyobject_richcomparebool [ docs ] see if greater current value. if so, greater value replaces it. equal values skipped over. the result first maximum chosen in case of tie.

osx - Installing Python 2.5 on Mac 10.6, for GAE/Django-nonrel (and i'm a new mac user) -

my big problem here i'm 1 day learning macosx basics need explained me i'm 4 yr old. i'm running os 10.6, snow leopard, comes python 2.6. the real problem getting aptana 2.0 debug google app engine sdk , require pil image transforming , requires python 2.5, app using django-nonrel framework (i realize didn't make easy on myself). i'm familiar python, google app engine , django-nonrel, getting setup on mac i'm lost. 1) how install 2.5 , not screw install 2.6? 2) how change python path? info on how install pil on mac mac pil installer python 2.5 (btw, totally feel 80 yr old trying program on mac) easiest way install mac ports: http://www.macports.org/ then terminal window: $ sudo port install python25 afterwards, should have python_select available, can use change symlinks.

javascript - Why is my localStorage code not working? -

i'm trying make div div disappear , stay gone when user comes back. doesn't seem want. when press button, nothing happens. not value of localstorage changes... localstorage.done = localstorage.done || false; $('#mybutton').addeventlistener('click', function() { if (!localstorage.done) { localstorage.done = true; $('#mydiv').style.display = "none"; } }); you code localstorage working (even if suggested use getter/setter methods instead of direct property access). your problem this: $('#mybutton').addeventlistener('click', function() { jquery not know .addeventlistener want call .bind() localstorage.done = localstorage.done || false; $('#mybutton').bind('click', function() { if (!localstorage.done) { localstorage.done = true; $('#mydiv').hide(); } });

C language semantic specification -

wikipidea says perl has dominant implementation used reference specification ,while c language specified standard ansi iso. i learnt c language without reading single line of standard, normal...? i know how standard (i.e. natural language document) capable of describing programming language without referring dominant implementation. it's extremely rare find people learn programming language specification. spec targeted @ compiler authors (who need adhere word-for-word guarantee correctness) , final arbiter of what's legal in language. language specs extremely dense , technical, , not way learn program in language. often, advanced users of language read spec. also, few languages defined in terms of reference implementation. languages defined relative abstract execution environment. example, c++ specification says that the semantic descriptions in international standard define parameterized nondeterministic abstract machine. international standard ...

javascript - How can I prevent showing content that is off-screen when a user "drags" mouse across viewing area? -

i using "overflow: hidden" on body tag, hides scroll bars, doesn't prevent user click-dragging mouse reveal outer content when dragging bottom or right-hand edge of browsing window. here's site: http://entanglement.gopherwoodstudios.com/ to replicate behavior, 1 way (in chrome) press middle mouse button , drag down or right. in ie9, grab , drag menu button edge. is there application-wide way prevent this, or there property or event-call must rework on every single element? try setting both overflow-x , overflow-y css properties "hidden" on element serving clipping element. overflow-x:hidden; overflow-y:hidden;

asp.net mvc - Facebook SDK MVC CanvasRedirectToAction -

i'm trying pass value using tempdata["somevalue"] action using this.redirecttoaction("action"); public actionresult testtempdata() { tempdata["teamid"] = 1; return facebook.web.mvc.canvascontrollerextensions.canvasredirecttoaction(this,"testtempdata2"); } public actionresult testtempdata2() { if (tempdata["teamid"] == null) viewbag.title = "not found"; viewbag.title = "found"; return view("index"); } but on "action" tempdata empty can me ? this because canvasredirecttoaction method redirects writing out javascript function executes when testtempdata action loaded. tempdata preserved server-side redirects. if use redirecttoaction have tempdata url bar not change reflect current page.

html - Button inside link doesn't work in IE -

i have sitewiode styling of buttons using html element. buttons submit forms works well. buttons links. therefore use syntax: <a href="#"><button>link text</button></a> this works in browsers except ie, button clicks nothing happens. link isn't followed. how can work in ie? don't put button inside link. can style <a> <button> css.

java - Eclipse help, import not recognized -

i trying use import of org.apache. when put eclipse project gives me redline errors , says not recognize import. what should do? thanks by way trying import code eclipse: how log onto https website java? right click on project, choose build path -> add external archives... , choose jar file contains apache classes

iphone - Send data to app without launching -

i wondering if there way send data app i.e. custom url scheme, without opening app. you can launch app using url-scheme (and pass data through url), can't send data app installed on same iphone without launching it. what trying achieve? maybe there different way solve problem.

Are XML/HTML tag names inside closing tags really necessary? -

this not programming question per se , wondering why name of tag required in closing tag in xml. instance, couldn't <a> <b>stuff</b> </a> be written <a> <b>stuff</> </> so each closing tag </> merely terminated last opened tag? so questions are would work (i.e. there corner cases i'm not thinking of in ambiguous/fail)? if work, why didn't 'they' design way? if work, why didn't 'they' design way? one reason sgml/xml designed human readable. /a/b example readable, structure more complex nightmare try interpret. this true mixed content (pcdata , element structures mixed).

Accessing SalesForce products with PHP -

i'm having trouble finding documentation makes me think can make requests php retrieve product listing salesforce. see plenty of information getting contacts, not products. possible products? if so, can point can learn this. you want read docs on salesforce php toolkit , salesforce ws api documentation .

java - Displaying money in a JTable but preserving the ability to sort as a double -

i have jtable 1 of columns amount in dollars , cents. define tablecolumn double , right justifies , when sorting, sorts double (not string). , good. problem truncates trailing zeros. 100.00 displayed 100 0.00 displayed 0, etc. tried tablecellrenderer although causes money column display trailing zeros, amounts left justified , jtable sees string. want trailing zeros retained in displays retain data type sorting , right justifying occur. datatype not need double if there better way this. i found perfect link. worked first time. copy code. http://tips4java.wordpress.com/2008/10/11/table-format-renderers/

ios - Xcode Instruments - Enable NSZombie Detection? Where is it? -

i have watched video http://www.markj.net/iphone-memory-debug-nszombie/ the guy shows option called enable nszombie detection on allocations inside instruments, instruments doesn't shows option. guy's video done using 1 year old version of instruments , using xcode 3.2.5. guys know option now? how can enable iphone apps? thanks in xcode 4.0, 'enable zombie' option present in iphone simulator , not when profile on actual device.

zk: when to create widget children? -

first off: i'm new zk. try create component lot of client side processing (think image editing). therefore, create widget creates it's own child widgets @ 'construction time'. but although find lot of documentation on how instantiate widgets, fail find hint on when it. in other words: how zk call widget, method should override in widget javascript generate children? not sure what's purpose adding child. but default widget initialize lifecycle 1.widget.$init() //js widget constructor 2.widget.redraw_ // output html , it's "mold" . 3.widget.bind_ // binding event html , , desktop inited. if planing build composite widget , calendar in datebox , reference $init function in datebox. :) let me know if need further information. https://github.com/zkoss/zk/blob/5.0/zul/src/archive/web/js/zul/db/datebox.js function _initpopup () { this._pop = new zul.db.calendarpop(); this._tm = new zul.db.calendartime(); this....

visual studio - why the sum of "Functions With Most Individual Work" can't be more than 100%? -

Image
i'm using vs2010 built-in profilier application contains 3 threads. 1 of thread simple: while (true) if (something) { // blah blah, fast , occuring thing } thread.sleep(1000); } visual studio reports thread.sleep takes 36% of program time. question "why not ~100% of time?" why main methods takes 40% of time, inside method durring application execution start end. do profiler devides result number of threads? on thread i've observed method takes 34% of time. mean? mean works 34% of time or works time? in opinion if have 3 threads run in parallel, , if sum methods time should 300% (if application runs 10 seconds example, means each thread runs 10 seconds, , if there 3 threads - 30 seconds totally) the question what measuring , how it. question i'm unable repeat experience actually... thread.sleep() call takes small amount of time itself. task call native function winapi command scheduler (responsible dividing process...

How to create popup dialog page in eclipse plugin development -

i creating eclipse plugin project. want have popup dialog page when user clicks customized icon on toolbar, kind of google app engine popup dialog , ideas how it? you need a command a handler command a menu contribution toolbar a dialog i have constructed (very) small example illustrates this...

php - Ajax Files browser ; What are the good practices -

i'm working on file browser (a ligth file manager if prefer) based on php , javascript. i'm building treeview folders : <ul id="treeview"> <li><a href="#">folder 1</a></li> <li><a href="#">folder 2</a> <ul> <li><a href="#">folder 2.1</a></li> <li><a href="#">folder 2.2</a></li> </ul> </li> <li><a href="#">folder 3</a></li> </ul> each link represent folder. want here loading content of folder after cliking on it. i have php code : public function getcontent($path) { //fetch content of $path directory } i have js code handle events : $('#treeview a').live('click',function(e){ e.preventdefault(); var folder = //here : path loadcontentinpanel(folder); }); but don't know h...

Magento: Different products in the different store views under the same store? -

Image
i have multi website, multi stored magento shop, , have need make products available in 1 store_view, not available in other, both store_views part of same store , website. all products configurable simple products attached them. way think of solving registering new product attribute through control each product goes. works great catalog , lists of products, have huge problems single product view , choosing configurable product options. i can't seem find in magento core option generated, override , strict options each store view. basically, need know this generated. last resort managing through ajax, there lot of ajax code , calls in page confusing. any or tip appreciated. i pretty sure way above not working because attribute enable/disable product has impact @ website level , not store or store view! if tomakun says product disabled @ whole website , not store view choose first! i have same problem want assign different products 1 website different stores...

computational geometry - efficient algorithm to find nearest point in a graph that does not have a known equation -

i'm asking questions out of curiostity, since quick , dirty implementation seems enough. i'm curious better implementation be. i have graph of real world data. there no duplicate x values , x value increments @ consistant rate across graph, y data based off of real world output. want find nearest point on graph arbitrary given point p programmatically. i'm trying find efficient (ie fast) algorithm doing this. don't need the exact closest point, can settle point 'nearly' closest point. the obvious lazy solution increment through every single point in graph, calculate distance, , find minimum of distance. theoretically slow large graphs; slow want. since need approximate closest point imagine ideal fastest equation involve generating best fit line , using line calculate point should in real time; sounds potential mathematical headache i'm not take on. my solution hack works because assume point p isn't arbitrary, namely assume p close gra...

Looking for help with 2-tier clean URL's using .htaccess -

i working on site have 2 levels url reaches my objective have clean url's this... http://domain.com/username/dosomething my ugly url's this... http://domain.com/index.php?page=username&command=dosomething my attempt this rewriteengine on rewriterule ^([a-za-z0-9]+)$ index.php?page=$1&command=$2 rewriterule ^([a-za-z0-9]+)/$1/$2 index.php?page=$1&command=$2 you're not using backreferences correctly in first part. backreferences parenthesised expressions filled $1, $2 et al. in second part of rule. e.g.: rewriterule ^([^/]+)/([^/]+)$ /index.php?page=$1&command=$2 these parenthesized expressions match 1 or more non-/ characters , fill them $1 , $2 respectively.

ruby - Rails I18n nested translation keys -

is there way nest translation lookups? this: en: uh_oh: 'uh oh!' error1: :'uh_oh' + ' there big error!' error2: :'uh_oh' + ' there big error!' i18n.t('error1') #=> 'uh oh! there big error!' i18n.t('error2') #=> 'uh oh! there big error!' i've tried bunch of variations of this, , tried using ruby translation file instead of yaml. note does work: en: uh_oh: 'uh oh!' error1: :'uh_oh' i18n.t('error1') #=> 'uh oh!' but if add additional text error1 , uh_oh doesn't translated. basically want avoid having pass in common terms, this: en: uh_oh: 'uh oh!' error1: '%{uh_oh} there big error!' i18n.t('error1', {uh_oh: i18n.t('uh_oh')}) for common terms uh_oh , interpolation same every call error1 (and other key uses uh_oh ), doesn't make sense have pass in string interpolated. it'd easier following...

php - Does a compressed XML file affect performance and memory ? What are some tips for a better XML? -

my question if there easy way compress xml file. read exi, gzip , similar, didn't understand how it, or if question possible. what trying achieve reduce size of xml file use simplexml. possible , if is, have impact on speed/performance/memory ? also, large xml file considered large based on size or number of elements? are there tips should follow "better" xml? the best way can think remove unnecessary data possible. i.e. don't make formatted human readability. include many unnecessary spaces/tabs/newlines. use self closing tags whenever possible , reduce content down bare minimum still meets xml specs. i'm sure there compressors out there this. kind of "compression" not require decompression before parsing, in turn may not save space.

git svn - Git repo grew after running repack -

we've been using subversion , considering moving git. git illiterate. used git svn clone copy svn history git , git folder 3.1g. followed advice several blogs shrink , ran: git repack -a d -f --window=100 processed 494,755 objects when @ disk size using 3.7g. thought shrink made larger. tried running again git repack -a d -f --window=250 --depth=250 no changes size. git prune command didn't appear anything. took several days clone this, rather not start over. is there way go smaller size, or ideas has on why repack made bigger? git-svn way if have copy repo svn git, honestly, better work natively in git. said, i've used before , this best guide found on matter. really, may want play around revision history importing using -r option. did an: rm -r `find -type d -name .svn` to remove .svn folders. don't plan on commiting git svn, me, if plan use git locally , commit svn repo, you'll have little more research on best way that. also git-gc...

java - Why StringBuilder when there is String? -

i encountered stringbuilder first time , surprised since java has powerful string class allows appending. why second string class? where can learn more stringbuilder ? string not allow appending. each method invoke on string creates new object , returns it. because string immutable - cannot change internal state. on other hand stringbuilder mutable. when call append(..) alters internal char array, rather creating new string object. thus more efficient have: stringbuilder sb = new stringbuilder(); (int = 0; < 500; ++) { sb.append(i); } rather str += i , create 500 new string objects. note in example use loop. helios notes in comments, compiler automatically translates expressions string d = + b + c like string d = new stringbuilder(a).append(b).append(c).tostring(); note there stringbuffer in addition stringbuilder . difference former has synchronized methods. if use local variable, use stringbuilder . if happens it's possible accessed...

ruby on rails - activerecord to_xml update xml version to 1.1 -

the to_xml activerecord include xml declaration follows. <?xml version="1.0" encoding="utf-8"?> how change version 1.1 , change encoding? we can use to_xml(:skip_instruct => true) hide declaration altogether. if using restfull routes visiting some_url.xml give results have described. if way serving xml can define own xml builder template. work in same way view works here example your controller action def show @obj = someclass.find(params[:id]) respond_to |format| format.html # show.html.erb format.xml { render :layout => false } end end then in views folder place show.html.erb create show.xml.builder file contents looking this xml.someclass xml.id(@obj.id) xml.name(@obj.name) end in template can add <?xml version="1.1" encoding="utf-8"?> or whatever xml declarations wish add update don't need serving views, restfull route, controller , action has respond_to...

javascript - Having problems scripting SVGs -

i'm having trouble manipulating svgs through javascript. i'd increase length of line through clicking button. i've included code in head tag: <script type="text/javascript"> x=135; y=135; var container = document.getelementbyid("svgbox"); var mysvg = document.createelementns("http://www.w3.org/2000/svg", "svg"); function svg() { mysvg.setattribute("version", "1.2"); mysvg.setattribute("baseprofile", "tiny"); mysvg.setattribute("height","300px"); mysvg.setattribute("width","300px"); container.appendchild(mysvg); } function line() { x=x-10; y=y-10; var l1 = document.createelementns("http://www.w3.org/2000/svg", "line"); l1.setattribute("x1", "100"); l1.setattribute("y1", "100"); l1.setattribute("x2", x); l1.setattribute("y2", y); l1.setattribute("s...

How to use microsoft UDDI 3 and its SDK and API -

i want tutorial or document describe api functions of microsoft uddi, , how find services it. functions , input , output parameters in c# i'm not sure if required use microsoft api or not, juddi has .net web service client. it might worth checking out , there number of examples. http://svn.apache.org/repos/asf/juddi/trunk/juddi-client.net/

Negative weights using Dijkstra's Algorithm -

Image
i trying understand why dijkstra's algorithm not work negative weights. reading example on shortest paths , trying figure out following scenario: 2 a-------b \ / 3 \ / -2 \ / c from website: assuming edges directed left right, if start a, dijkstra's algorithm choose edge (a,x) minimizing d(a,a)+length(edge), namely (a,b). sets d(a,b)=2 , chooses edge (y,c) minimizing d(a,y)+d(y,c); choice (a,c) , sets d(a,c)=3. never finds shortest path b, via c, total length 1. i can not understand why using following implementation of dijkstra, d[b] not updated 1 (when algorithm reaches vertex c, run relax on b, see d[b] equals 2 , , therefore update value 1 ). dijkstra(g, w, s) { initialize-single-source(g, s) s ← Ø q ← v[g]//priority queue d[v] while q ≠ Ø u ← extract-min(q) s ← s u {u} each vertex v in adj[u] relax(u, v) } initialize-single-source(g, s) { each vertex v  v(g) d[v] ← ∞ π[v...

objective c - Adding extra UIlabel to each cell -

i'm trying add uilabel each cell( uitableview ) i'v succeeded code in (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath method here's code //add text uilabel *test = [[uilabel alloc] initwithframe:cgrectmake(250,80,50,20.0)]; test.text = [nsstring stringwithformat: @"test"]; test.backgroundcolor = [uicolor clearcolor]; test.font=[uifont fontwithname:@"applegothic" size:20]; [cell addsubview:test]; however figured if this, can't add different text each cell, instead, ends same text in cells. can tell me how that? oh , problem if this, "test" displayed in every cell except first one. have @ tutorial " uitableview – adding subviews cell’s content view ". try this - (uitableviewcell *) getcellcontentview:(nsstring *)cellidentifier { cgrect cellframe = cgrectmake(0, 0, 320, 65); cgrect label1frame = cgrectmake(17,5,250,18); uilabel *lbltemp; ...

linux - Is it possible to collect .local domain ip addresses hierarchically for building dhcp based dns? -

suppose in normal dhcp environment, you'll ip address like: 192.168.0.101 linuxpc1.localdomain on segment a 192.168.1.102 linuxpc2.localdomain on segment b i want them installing avahi on linuxpcs hostname set. so on 192.168.2.103 linuxpc3.localdomain, running ping linuxpc1.local would work. what easiest way realizing not affecting dhcp server settings? or if difficult, @ least want know ip address name running script linuxpc3.localdomain host. getipbyname-avahi.py linuxpc1.local -> returns 192.168.0.101 i don't want setup nis or ldap or sql ... thought reusing avahi capability of resolving dhcped ip address start. why don't enable dns updates in dhcp ? something like ddns-updates on; ddns-update-style interim; ddns-domainname "network.athome."; ddns-rev-domainname "in-addr.arpa."; in dhcpd.conf (i'm assuming use isc's) , update dns. if can't change dh...