Posts

Showing posts from March, 2014

Android thread showing result on debugging but not on running -

i trying implement thread in application. working web service , fetching show results. time being showing progress dialog using thread. following thread implementation : final handler handler=new handler(); progdialog = progressdialog.show(departments.this.getparent(), "loading... ", "please wait....", true); new thread(new runnable() { @override public void run() { // todo auto-generated method stub suid = downloaddata(); struid = suid.struid; dep = download(struid); departments = dep.departments; depid = dep.depid; handler.post(new runnable() { @override public void run() { // todo auto-generated method stub progdialog.dismiss(); } }); } }).start(); when debug application seems fine , results shown accordingly. when run application, progress dialog seen results not displayed. there missing?

xaml - How to represent Line Break or new line in silverlight textBox -

i having hard time match special characters set in silverlight. on following: to represent linebreak in silverlight textblock: use : > linebreak < but use represent new line or linebreak in silverlight textbox?? example : want 1 line mag : line one. line 2 into : this line one. line two. it seems \r\n not working. line 1 \r\n the bottom line @ top <textbox text="this line one!&#13;this line two!" /> linebreak weirdness in silverlight textbox if going initialising content of textbox literal text in xaml in similiar way might textblock need reliable way represent line break character silverlight uses in xaml. silveright uses cr character (0x0d - ascii 13) represent linebreak in c# include in string literal \r. xaml isn't c# can't use \r in xaml. xaml fundementally xml xaml parsing oddities. including linebreak, derek has in answer, directly in xaml not work @ runtime (although designer displays expected). mig...

How can i convert a date in php to SQL format ? (and insert it) -

i'm trying insert date , lets curdate() sql datetime field. my date in format of: 28/01/2008 when try insert sql, zeroes. so how can convert properly? $newdate = date('y-m-d', strtotime($olddate));

asp.net - What wrong in this code? -

here have 2 list boxes ,when click add button items should added second list box in asp.net using jquery. <%@ page language="c#" autoeventwireup="true" codefile="listboxexample.aspx.cs" inherits="listboxexample" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>adding,removing elements first listbox second listbox</title> <style type="text/css"> .lstbx1 { font-family: verdana; font-size: medium; font-style: normal; background-color: aqua; height: auto; width: auto; } .lstbx2 { font-family: verdana; font-size: medium; font-style: normal; ...

Assign left/right tag to nodes in the binary-tree -

i have binary (undirected) tree. want assign each (child) node left/right tag. how can it? thanks you in c making tree structure struct tree { char tag[4]; struct tree * left; struct tree *right; };

php - How to fix SQL indexes to remove spaces/jumps? -

i have table entries listed , edited , removed creates space. example: 1,2,4,5,6,8,10 have them in order example: 1,2,3,4,5,6,7 is there code qick , painless? thank you. if have foreign key constraints you'll need use on update cascade (something tend avoid plague). is there reason ensure these numbers sequential or aesthetics? there's no problem having keys 'missing' - database cares little. if need then: set @indx = 1; update `table` set `field` = (@indx:=@indx+1) order `field` asc; have fun...

python - Web2py on App Engine Local Environment: Cannot access admin interface -

Image
i have been trying learn web2py use on app engine. cannot seem able access admin interface. (the default page loads, when access 127.0.0.1:8080. access admin interface, url used should 127.0.0.1 (by default)) however when click admin interface link page logging in email id not work. i have been through tutorial @ http://wiki.web2py.com/deploying_web2py_on_google_app_engine_gae_ however, not talk setting password access admin interface on local app engine environment.(and think out of date) i have been through web2py book talks setting password access admin environment (when using web2py server, chapter not talk app engine) questions: have set password access admin interface while deployed on local app engine server? if yes, how? if not, how access admin interface? finally, can access admin interface when app deployed on remote gae servers? you should set admin password during installation process. check video @ 00:35 or read this doc.

http - How to put ads on every web page? -

i wondering how put ads software hotspot shield does. puts ads on top of every web page. don't want in specific language vb or c++ want how in language. examples: http://ishtechnology.com/wp-content/uploads/2010/10/blog-ad-added-by-hotspot-shield-e1288306756847.png http://www.raymond.cc/images/hotspot-shield-advertisements.png beside obvious evilness of this, solution quite simple : install transparent http proxy on machine , decorate each , every page html code required display add. did kind of behaviour bad ? indeed defaces web pages, sole purpose of displaying adds clicked.

http post connection in android -

i developing application in android.which involves sending data url/server in android application...can tell me how pursue this....thanks in advance tushar see sample code. helps you. httpcontext localcontext = new basichttpcontext(); string ret = null; httpclient httpclient = new defaulthttpclient(); httpclient.getparams().setparameter(clientpnames.cookie_policy, cookiepolicy.rfc_2109); httppost httppost = new httppost(url); httpresponse response = null; stringentity tmp = null; httppost.setheader( "accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); httppost.setheader("content-type", "application/x-www-form-urlencoded"); try { tmp = new stringentity(data, "utf-8"); } catch (unsupportedencodingexception e) { lo...

Python SQL select row from specific variable field -

i'd grab specific value row based on random variable. here's example table pid column "auto-increment primary key integer" , other 2 columns text example-table pid name phone --- ---- ----- 1 bill 999-9999 2 joe 888-8888 i'd throw random variable @ table randomvariable = raw_input('enter something: ') > 1 and have code return name > bill i know can use like... randomvariable = raw_input('enter something: ') sql = ("select name example_table pid='%s'" % randomvariable) result = cursor.execute(sql) print result > bill apparently using '%s' isn't secure , suggested use '?' in it's place. randomvariable = raw_input('enter something: ') sql = ("select name example_table pid=?", randomvariable) result = cursor.execute(sql) print result but doesn't seem work me. end with... "valueerror: operation parameter must str...

sql server - How to edit SSMS Script Table As templates? -

in context menu of table in sql server management studio there several items under common item script table as : select insert update delete .. and same objects, e.g. stored procedures, functions, etc. how can edit templates used menus? you cannot edit templates used sql server management studio (which nice feature). you can create own (parameterised templates) in c:\users\username\appdata\roaming\microsoft\microsoft sql server\100\tools\shell\templates\sql (for sql server 2008)

ios - How to port Windows Phone 7 application to iPhone -

i port wp7 app wrote iphone. there useful document me start? have no knowledge in objective-c yet. monotouch development stack using c# , .net develop ios apps. should make ios app development easier existing .net developers. here're parts of monotouch: supports c# language supports linq silverlight core supported (eg. .net core, webservices, json, xml). read monotouch faq more detail. supports sqlite (only) via mono.data.sqlite.dll ios classes exposed .net managed classes there few gotchas: you can't dynamically link assembly. code needs recompiled natively on ios (sorry no jit compilation) because monotouch still depends on ios sdk, must familiar ios programming model (eg. view hierarchy , application lifecycle model). you can't use visualstudio directly. need monodevelop , xcode develop monotouch apps. said, apparently hacked visual studio , able write large portion (not all) of code in visual studio. check out here . because of setup, ...

c# - Convert XML response to .CSV file -

i have following code, i sending array of data web service, response web service gets displayed in web form shown below. private void form1_load(object sender, eventargs e) { int asent; int csent; webservice.results returned = convert(); txtresult.text = system.convert.tostring(returned.status); txtmoreres1.text = returned.errordetails[0].errordetails; txtmoreres2.text = returned.errordetails[1].errordetails; txtmoreres3.text = returned.errordetails[2].errordetails; txtmoreres4.text = returned.errordetails[3].errordetails; date.text = system.convert.tostring(datetime.today); time.text = system.convert.tostring(datetime.now.timeofday); } what need results 'returned' converted xml response .csv file. have code save .csv location on c drive. how can change code this? thanks time! stringbuilder sbcsv = new stringbuilder(); int actualsent; ...

objective c - in iPhone SDK How to change the color of BarButton Item -

how change color of leftbarbuttonitem of uibarbuttonitem in navigationbar? if trying set image in bar button through interfacebuilder shows border on image in bar button there specific size image bar button or how set image with-out showing border in ? if adding barbutton dynamically doesn"t appear while running app , if adding leftbarbutton in xib , connecting outlets leftbar button become visible not able assign customview view ultimate goal change color of left bar buttton please , suggest, thanks create bar buttom item custom view using -[uibarbuttonitem initwithcustomview:] . way, have control want on appearance.

java - How to get the elements <and> and <or> in XPath with Jre default Processor (JAXPSAXProcessor) -

i working xml files contain and/or tags. want transform them html. in xsl using 2 templates <xsl:template match="and"> ( <xsl:apply-templates select="./*[1]" /> <xsl:text> </xsl:text> <xsl:value-of select="name(.)" /> <xsl:text> </xsl:text> <xsl:apply-templates select="./*[2]" /> ) </xsl:template> <xsl:template match="or"> ( <xsl:apply-templates select="./*[1]" /> <xsl:text> </xsl:text> <xsl:value-of select="name(.)" /> <xsl:text> </xsl:text> <xsl:apply-templates select="./*[2]" /> ) </xsl:template> it works when using xalan processor when using jaxpsaxprocessor getting errors: error [main] jaxpsaxprocessorinvoker - syntax error in 'or'. error [main] jaxpsaxprocessorinvoker - syntax error in 'and'. i suppose jaxpsax...

winapi - Implicit vs. Explicit linking to a DLL -

when 1 should implicitly or explicitly link dll , common practices or pitfalls? it rare explicitly link dll. because painful , error prone. need write function pointer declaration exported function , loadlibrary + getprocaddress + freelibrary code right. you'd if need runtime dependency on plug-in style dll or want select set of dlls based on configuration. or deal versioning, api function that's available on later versions of windows example. explicit linking default com , .net dlls. more background info in msdn library article .

utf 8 - Downloading a CSV file with utf-8 encoding -

we have web app stores , works data character encoding utf-8. when open csv file exported our system, run trouble programs interpret csv different character encoding , funny symbols start appear. i've tried sending http://en.wikipedia.org/wiki/byte_order_mark#utf-8 openoffice doesn't seem respect that. is there way force file in utf-8 encoding? i leave file in utf-8 , rely on our users sort out - our users not particularly technical i'm not sure wise. would safer approach convert data basic character set before exporting? we had similar problem time ago. solution worked applications send utf-16le encoded data bom.

c# - Model-View-Presenter in WinForms -

i trying implement mvp method first time, using winforms. i trying understand function of each layer. in program have gui button when clicked upon opens openfiledialog window. so using mvp, gui handles button click event , calls presenter.openfile(); within presenter.openfile(), should delegate opening of file model layer, or there no data or logic process, should act on request , open openfiledialog window? update: have decided offer bounty feel need further assistance on this, , preferably tailored specific points below, have context. okay, after reading on mvp, have decided implement passive view. have bunch of controls on winform handled presenter , tasks delegated model(s). specific points below: when winform loads, has obtain treeview. correct in thinking view should therefore call method such as: presenter.gettree(), in turn delegate model, obtain data treeview, create , configure it, return presenter, in turn pass view assign to, say, panel? would same...

c++ - Writing to specific position in a file -

i have fstream output; output.open(fname, ios::out | ios::trunc); //file (int i=0; i<flength; i++) output.put('1'); i want overwrite different length of data different locations in file. data characters. lets there 111111111111111111111111111111111 , want write 11 111111333111!!!!!!1 11441111 use seekp() set writing position in file stream.

ios - Game Center : match delegate’s not called after finding a match -

i'm trying use game center : multi player till now, players authenticating game center, can send/read scores, , acheivements. multiplayer features, tried both methods : - using game center interface find match. - find match programmatically. for both ways have following issue: match delegate’s match:player:didchangestate: method not called. in apple docs, it's stated delegate called if 1 player connected or disconnected. in case delegate never called. think i'm missing step. here after implementation of delegate (as specified in apple doc). - (void)match:(gkmatch *)match player:(nsstring *)playerid didchangestate:(gkplayerconnectionstate)state { switch (state) { case gkplayerstateconnected: // handle new player connection. break; case gkplayerstatedisconnected: // player disconnected. break; } if (!self.matchstarted && match.expectedplayercount == 0) { self.matchs...

asp.net - Nasty problem with AJAX uploaders on .net pages, sending partial forms instead of complete ones is tricky -

got question: how far can go without form being implemented around master page in .net project? i hate form tag stops having multiple smaller forms , cannot use "edit-in-place" feature properly, dont want send fields, few of them, , ajax solutions until hit wall of uploading file, damn uploads, damn .net, damn html, know way out of ditch? question on side, how on god's earth posting file thru iframe regarded more secure sending file in httpxml object? aren't both http request? thank bearing temper today there's many places start it's hard pick point. first off, although single form issue enforced regular .net web forms there other options such mvc . give more control emit multiple forms on page. don't nest them number of browsers can't deal nested forms well. as far ajax, don't have make ajax call web form served page. pretty common instead make several generic handlers (.ashx files) ajax controls post to. example, might ...

android - Start BroadCastReceiver From Activity -

i want start broadcastreceiver activity . how can that? define broadcastreceiver: private final broadcastreceiver receiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { // } }; register receiver in onresume: @override protected void onresume() { super.onresume(); intentfilter filter = new intentfilter(); filter.addaction("some_action"); registerreceiver(receiver, filter); } unregister receiver in onpause: @override protected void onpause() { super.onpause(); unregisterreceiver(receiver); }

HTTP Error 500.19 - Internal Server Error The requested page cannot (WCF + REST + IIS7 + SSL) -

i having "dandy" time trying wcf rest service hosted on iis ssl. environment: testing on windows7 box local iis server. have self-registered certificate on dev box , have: created site in iis purposes of exposing wcf service via https. created application under site , named "api" navigated site in iis clicked 'bindings...' in actions panel on right. clicked 'add' selected 'https' , selected certificate. a lot of rest plumbing handled via extensions in wcf using wcfrestcontrib library. while has been useful programming point of view, there little out there in way of documentation when goes wrong. the error getting is: error summary http error 500.19 - internal server error requested page cannot be accessed because related configuration data page invalid. detailed error information module iis web core notification beginrequest handler not yet determined error code 0x8007000d config error config ...

algorithm - Java build List from values of multiple Maps in a particular order -

suppose have list of integers in meaningful order (list1). you have 2 map's integer keys subset of list1. there no overlap between 2 maps, between them both may possible list1 proper superset of set of both of keysets (i.e., there integers in list1 missing both maps). how can build new list of objects 2 maps in objects appear in order integer key appears in list1? you can loop: map map1; map map2; list list2; // iterate through of possible keys in order for(object possiblekey: list1) { // if possible ke key in 1 of maps, // add new list. preserve order. if(map1.containskey(possiblekey)) list2.add(map1.get(possiblekey)); else if (map2.containskey(possiblekey)) list2.add(map2.get(possiblekey)); } the above code simplified, should general idea.

java - How to serialize a class with an interface? -

i have never done serialization, trying use google's gson serialize java object file. here example of issue: public interface animal { public string getname(); } public class cat implements animal { private string mname = "cat"; private string mhabbit = "playing yarn"; public string getname() { return mname; } public void setname(string pname) { mname = pname; } public string gethabbit() { return mhabbit; } public void sethabbit(string phabbit) { mhabbit = phabbit; } } public class exhibit { private string mdescription; private animal manimal; public exhibit() { mdescription = "this public exhibit."; } public string getdescription() { return mdescription; } public void setdescription(string pdescription) { mdescription = pdescription; } public animal getanimal() { return manimal; } ...

sql server - joining two different table -

i have couple of tables joining organization table: id, name registration table: id, name after execute how looks org_id org_name reg_name reg_id -------------------------------------------------------- 329 abc regname1 311 329 abc regname2 298 what want display data 1 row this: org_id org_name reg_name reg_id ------------------------------------------------------------------------ 329 abc regname1;regname2 311;298 note: reg_name dynamic, might 1 or ten. i'd give post try: comma separated list in sql-server .

conversion from mathematica to matlab --> (appendto) -

i have following in mathematica , want use in matlab.i tried have mistakes , can't fixed them.it don't yet matlab philosophy! so, intmc = {}; sigmat = {}; do[np1 = np + i*100; xpoints = table[randomreal[], {z1, 1, np1}]; a1t = table[f[xpoints[[i2]]], {i2, 1, np1}]; a12 = standarddeviation[a1t]/sqrt[length[a1t]]; appendto[intmc, {np1, mean[a1t], a12}]; appendto[sigmat, {np1, a12}], {i, 1, ntr}]; i did this: fx=@ (x) exp(-x.^2); intmc=zeros(); sigmat=zeros(); i=1:ntr np1=np+i*100; xpoints=randn(1,np1); k=1:np1 a1t=fx(xpoints(k)) end %--> until here prints results,but in %end gives % me message " attempted access xpoints(2,:); %index out of bounds because size(xpoints)=[1,200] %and stops executing. %a1t=fx(xpoints(k,:)) % -->i tried instead of abo...

How do I use a MySQL user-defined function from within PHP? -

spent several hours searching answer without success. i've written user-defined function in mysql passed identifier uses retrieve various pieces of data, concatenate 1 string , return it. want call function php page , output result. unsuccessful attempts include: 1. $result = mysql_query("select functionname($id)"); 2. $sql = "select functionname($id)"; $result = mysql_query($sql, $link); 3. functionname($id) any ideas? 1 , 2 close, $result not going contain result of function call. rather, going contain result cookie query. can use cookie actual data, mysql_fetch_row() . function call returns value select statement, same "select 42" or "select mytable". result use same mechanism other sql query returns results; is, use cookie , call mysql_fetch_row() . final code this: $result = mysql_query("select functionname($id)"); $row = mysql_fetch_row($result, $link); $returnvalue = $row[0]; note don'...

web crawler - Regarding crawling of short URLs using nutch -

i using nutch crawler application needs crawl set of urls give urls directory , fetch contents of url only. not interested in contents of internal or external links. have used nutch crawler , have run crawl command giving depth 1. bin/nutch crawl urls -dir crawl -depth 1 nutch crawls urls , gives me contents of given urls. i reading content using readseg utility. bin/nutch readseg -dump crawl/segments/* arjun -nocontent -nofetch -nogenerate -noparse -noparsedata with fetching content of webpage. the problem facing if give direct urls http://isoc.org/wp/worldipv6day/ http://openhackindia.eventbrite.com http://www.urlesque.com/2010/06/11/last-shot-ye-olde-twitter/ http://www.readwriteweb.com/archives/place_your_tweets_with_twitter_locations.php http://bangalore.yahoo.com/labs/summerschool.html http://riadevcamp.eventbrite.com http://www.sleepingtime.org/ then able contents of webpage. when give set of urls short urls http://is.gd/jooaa9 http://is.gd/ubhraf http://i...

php - How to remove 'via app' when posting on facebook page feed -

when posting page wall (feed) through application, under post contents facebook adds '20 minutes ago *via my_app*'. problem company, since don't want fans knowing posting done through application, losing personal touch. is there way lose '*via my_ap*p' part of post? these of things have tried: i have given every possible permission on page admin user, including 'manage_pages' have tried token returned graph api me/accounts page / impersonating pages please tell me, short of making bot whole thing, there way through facebook api. thank can provide. if don't want people see company are, facebook wrong platform you! i'm pretty sure, violate terms of facebook (developer).

Executing tasklist on Windows with popen in C without cmd.exe popup -

hello , thanks time. i'm developing kind of monitoring application in c , fell in need of getting current tasks list. i'm using tasklist , getting output popen(); ptr = popen("tasklist /v", "r"); while(1) { if(fgets(temp, 255, ptr) == null) break; fputs(temp, log); } the problem fractions of second cmd.exe window pops , that's disturbing, because switches focus on new window , makes application go windowed-mode instead of fullscreen. so, i've spent days looking on either popen ways or windows ones start process in 'hidden' mode/window got no result. things tried include: cmd.exe /c tasklist /v start /b cmd.exe /c tasklist /v start /min /b cmd.exe /c tasklist /v start /min cmd.exe /c tasklist /v tasklist > somefile i tried last 1 read output somefile seems tasklist forces output stdout since no data written though file created. hope in answer , thank anyway. you can achieve calling createprocess passing...

java - What should be the optimal way to find the average of a large number of integers? -

each of integers can large size of integer (java int-32 bits), storing sum of integer numbers in integer variable isn't option. i'm afraid using java bigints might affect performance badly. right i'm trying divide , conquer while using long store sum. are there better solutions? you can use long (64-bit) hold sum. if overrun that, biginteger way go.

internet explorer 7 - jscrollpane scrollbar doesnt show in ie7 -

i made simple jquery image loader , attached jscrollpane it. works nice in browsers except in ie7 scrollbar doesnt show up. cant find solution issue. got ideas how fix? click here see project for future reference after going on code in jscrollpane js file belive has comment on line 92: // todo: deal width/ height 0 means element hidden , should // come later , check once unhidden... looking @ solution..

javascript - Is it possible to upload a file with AJAX and no iframe or Flash? -

every time have looked ajaxy file uploading, iframe has been used underneath, somewhere. is possible upload file using ajax , no iframe or flash? how in more recent versions of firefox , chrome? i'm debating co-workers, arguing cannot perform ajaxy upload pure javascript, since cannot read file contents user's harddrive in order pass in file contents via ajax call server side script. you can use file api on firefox (3.6 , above) , think latest webkit supports (not sure) though. i did mootools plugin works on ff: http://mootools.standupweb.net/dragndrop.php

silverlight - Binding Dictionary<string,string> to Combobox in SL3 -

i'm trying following. have class: public class textfield { public string texttype { get; set; } } in view created list: public textfieldeditcontrol() { initializecomponent(); dictionary<string, string> lst = new dictionary<string, string>(); lst.add("singleline", "single line"); lst.add("multiline", "multi-line"); lst.add("richtext", "rich text"); cmbtexttype.itemssource = lst; } in xaml have: <combobox x:name="cmbtexttype" displaymemberpath="value" selectionchanged="cmbtexttype_selectionchanged" selecteditem="{binding path=texttype, mode=twoway}" /> the problem when check value of texttype property, returns string that: "[singleline, single line]" instead of key. can set return key key/value pair? in title specified silverlight 3, unfortunately didn't h...

java - How to import com.sun.javadoc.* in eclipse? -

importing com.sun.javadoc eclipse report me error "the import com.sun.javadoc cannot roselved" seems package not installed. looking @ web site http://download.oracle.com/javase/1.5.0/docs/guide/javadoc/doclet/spec/index.html?com/sun/javadoc/package-summary.html api displayed cannot download anything. how can do what is, in eclipse preferences, define installed jre called "jdk x.y.z" , include tools.jar part of libraries. change project preferences use jre "jdk x.y.z". the other approach add tools.jar project's library or point in project path.

sql - TSQL String matching question -

i trying match 2 strings using tsql. first string:       abcd dfhg kljkl second string: abcd dfhg kljkl - 4536764 matching rule: if second string begins first string followed " - " (that is, space, dash, space) , set of numbers (and nothing else), consider match. any ideas? i have 2 answers you. assuming firststring values not contain of characters % , _ , or [ , return you're asking for. not guarantee second string begins first , followed space-dash-space , number, makes sure numbers follow point onward. if table wide @ all, nonclustered index includes firststring , secondstring whatever other columns want selected (or they're in clustered index) make index cover query , improve performance. select * strings secondstring firststring + ' - [0-9]%' , secondstring not firststring + ' - %[^0-9]%'; i submit if firststring blank , secondstring starts ' - ' correct per specs. if firststring value cont...

BeautifulSoup (Python) and parsing HTML table -

##### update ###### : rendercontents() instead of contents[0] did trick. still leave open if can provide better, elegant solution! i trying parse number of web pages desired data. table doesn't have class/id tag. have search 'website' in tr contents. problem @ hand : displaying td.contents works fine text not hyperlinks reason? doing wrong? there better way of doing using bs in python? those suggesting lxml, have ongoing thread here centos , lxml installation without admin privileges proving handful @ time. hence exploring beautifulsoup option. html sample : <table border="2" width="100%"> <tbody><tr> <td width="33%" class="boldtd">website</td> <td width="33%" class="boldtd">last visited</td> <td width="34%" class="boldtd"...

java - Spring LDAP Authentication (Automatic or not?) -

i read through spring ldap reference docs , unable figure out whether user authentication against ldap server automated or not. by "automated" mean happens automatically on bean instantiation if provide userdn , password in contextsource . say, programmer never has call ldaptemplate.authenticate(...) - happens "behind-the-scenes". so know if spring ldap authentication automatic if there fields can set change behavior thanks, ktm edit: ask question in context of code wrote. following contextsource 1 of context sources in beans file, user can opt use. used configure userdn , password @ runtime (for security reasons). want know whether ldap application use userdn/password collect @ runtime in authentication. (does authentication precede execution of code? ignore userdn/password fields code configures?) public class runtimecontext extends ldapcontextsource { public runtimecontext() { super(); if (!resolveauthinfo()) { ...

javascript - Implementing a hover info box -

i have calendar, , when user hovers on cell, large-ish info box appears details date. having trouble though making info box disappear when user moves away. i want when mouse cursor moves out of calendar cell hidden info box disappear. i'm having trouble because mouseenter , mouseleave messed having info box top element. so tried around using "placeholder" divs transparent, have same shape , location calendar cell beneath it, , have z-index of 1000 above info box. apply mouseenter , mouseleave events these divs instead. there's 2 problems though. one, have messed html semantically. divs have no purpose around seems limitation. , secondly, mess jquery ui selection (i've applied calendar cells - click no longer selects cell). is there clean way handle displaying info box? there no user interaction info box -- it's display information. edit : here code: <li> <div class="day-content"> </div> <div...

facebook - Setting inline URL with Jquery -

i using following code show social icons on hover: can see site here: http://vitaminjdesign.com/adrian/ $('a').live('mouseover mouseout', function(event) { if (event.type == 'mouseover') { $('<a href="http://www.facebook.com/sharer.php?u=(this)" target="blank"><img src="images/facebook.gif" class="facebook" alt="facebook"></a>').appendto(this).fadein(500); $('<a href="#"><img src="images/twitter.gif" class="twitter" alt="twitter"></a>').appendto(this).fadein(500); } else { $('a').find('.facebook,.twitter').stop(true, true).fadeout(500); } }); the problem having within facebook url see (this). want dynamically add in url of link associated current a being hovered. basically, want add in url of element being hovered on (this) ...

where are iOS layout guidelines? -

i have been trying find reference details on offset guidelines subview layouts in ios no luck. first looked in ib guide, , in section layouts, indicates ib guides (the blue lines) use guidelines supposedly described in detail in ios mobile hig, searched document , didn't find such guidelines. anyone know it's specified, or going have piddle ib , write down numbers on sticky notes? i don't think there documentation specific asking (except standard element dimensions described in docs). tapworthy worth read , of if want understand rationale behind of apple's (and others') ui design decisions.

java - In Play Framework, how and when are changes to models synchronized with the DB schema? -

in play framework, when add or modify model, when update made database schema? done automatically, or need initiate manually somehow? if running in dev mode, done immediately. definition of when server request next invoked, update check made , kicks off process recompiling java classes, , result database schema also. if in prod mode, when server starts.

file io - C++ compiler error with stringbuf / ifstream -

i cannot understand why compiler (msvc++2010) doesn't code: // get_sum(filename c-string) returns sum file int get_sum(const char* const s) { stringbuf bill_buf; ifstream bill_file; bill_file.open(s); bill_file.get(bill_buf, '\0'); // read whole file bill_file.close(); return get_sum_from_string(bill_buf.str()); } i these errors (i translated them german english , give correct line numbers code excerpt without leading comment): error 1 error c2079: 'bill_buf' uses undefined class 'std::basic_stringbuf<_elem,_traits,_alloc>' (line 2) error 2 error c2664: 'std::basic_istream<_elem,_traits> &std::basic_istream<_elem,_traits>::get(_elem *,std::streamsize)': conversion of parameter 1 'int' 'char *' not possible (line 5) error 3 error c2228: left of ".str" there must class/structure/union. (line 7) has got idea what's goi...

android - Background Image Quality -

android development please. can somone tell me how might increase quality of background images in app? have been using photoshop images great, save web png...then add app... on phone image looks little blurred. whats best way increase image quality? i make sure you're saving @ adequate resolution. i'm bet "save web" reduces resolution 72 dpi may not enough android handset. in photoshop, try bumping resolution of final png 300 dpi , see if makes difference. there can experiment different resolutions figure out what's smallest value can use , still have crisp image. alternatively, documented resolution requirements.

ASP.NET MVC3 TryValidateModel validates entire model collection, not just single instance -

i have action takes list of models. i'd validate each 1 individually vs. entire model collection @ once. i'm trying use tryvalidatemodel, appears if 1 of models invalid, of them invalid. form displays 5 surveyresponsemodels (a class 2 required strings , 2 ints). if fill out 5 models completely, validcount = 5 below. however, if of 5 models incomplete (thus failing validation), validcount of 0. expected behavior of tryvalidatemodel? if so, ideas on how can validate these 1 @ time? [httppost] public actionresult create(ilist<surveyresponsemodel> respondents) { int validcount = 0; foreach (surveyresponsemodel respondent in respondents) { if (tryvalidatemodel(respondent)) { validcount++; } } modelstate.addmodelerror("", validcount.tostring() + " respondents passed validation"); } looking @ code, appears me tryvalidatemodel val...

Assign a vertical alignment to a list box when selected //WP7 C# XAML -

when list box item selected, selected item become vertically centered on hit. hoping add c#. i've got far. want same applied secondary list box item (listbox1 , listbox2). private void listbox1_selectionchanged(object sender, selectionchangedeventargs e) { //messagebox.show("item selected: " + listbox1.selecteditem.tostring()); if (listbox1.selectedindex == 3) { listbox2.scrollintoview(listbox2.items[27]); } } private void listbox2_selectionchanged(object sender, selectionchangedeventargs e) { //messagebox.show("item selected: " + listbox2.selecteditem.tostring()); } if want change appearance of in different states i'd reccomend using visualstatemanager , changing properties of elements accordingly in relevant state. in instance of items listbox , should change itemcontainerstyle .

c# - Page refresh Vs IsPostBack -

i've got index page sends users edit products page on separate browser tabs. for each products edited index rewrites session["productid"]. the edit page has following code have unique identifier tab , product: if (!ispostback) //first time page load { random r = new random(datetime.now.millisecond + datetime.now.second * 1000 + datetime.now.minute * 60000 + datetime.now.minute * 3600000); pageid.value = r.next().tostring(); session[pageid.value + "productid"] = session["productid"]; } this works, , when same user opens multiple tabs reference session[pageid.value + "productid"] in code have proper id. (i'm working in trusted environment intranet, therefore i'm not bothered level of security). my issue occurs if user page refresh hitting f5 key. @ point session[pageid.value + "productid"] gets session["productid"] of last product opened. for example: user 1 opens product1 in tab1 use...

Is there a simpler way to do parsing in Java on Android? -

i'm having difficulty performing should simple task. let's have text file states: a = b i want program read file , output "b" whenever user inputs "a". in python or c++ can accomplish in around 7 lines or less. however, i'm having difficulty finding simple way on android. example, 1 sample found here on had 900 lines in 6 files. is there simple way parse file , return variable on android missing? as long you're happy the a = b format used in properties files, 99% of way goal properties properties = new properties(); try { properties.load(new fileinputstream(filename)); } catch (ioexception e) { // file missing or not in 'a = b' format } the, having got variable key containing string "a" user, result of properties.getproperty ( key ) equal "b" if file contains line a = b . i'm pretty sure need more in c++ load map file , handle escaping , character encoding issues. if properties...

ravendb - Basic NoSQL document design question -

i trying figure out how best implement system...and head out of rdbms space now... a part of current db has 3 tables: show, showentry, , entry. showentry many-to-many joining table between show , entry. in rdbms thinking it's quite logical since changes show details can done in 1 place, , same entry. what's best way reflect in document-based storage? i'm sure there no 1 way of doing can't think if document-based storage appropriate case @ all. fyi, considering implementing ravendb. while discussions on general nosql design more ravendb focused 1 fantastic! thanks, d. when modelling many-to-many relationship in document database, store collection of foreign keys in 1 of documents. document choose largely depends on direction intend traverse relationship. traversing 1 way trivial, traversing other way requires index. take shopping basket example. it's more important know items in particular basket baskets contain particular item. since we're...

php - How can I tell if file is writable from script? -

my plugin needs able write file system. possible query known file write permissions? for example, wordpress theme ships file called custom.css need write access to. when theme first loads, i'd query script see if writable, echo results theme. then in support session's, can ask user visually check setting insure have write permissions expected (and eliminate cause of read/write issue). is_writable("yourfilename.txt") http://php.net/manual/en/function.is-writable.php for example... if (is_writable('custom.css')) { echo "success! custom.css writable"; } else { echo "failure!! custom.css not writable"; }

class - PHP Fatal error: Call to protected method FormValidator::setError() from context '' -

consider poor class: abstract class formvalidator { private $error_objects = array(); protected function seterror($entry_name,$err_msg) { $this->error_objects[] = new formvalidatorerrorobject($entry_name,$err_msg); } protected function seterrorcurry($entry_name) { $_this = $this; return function($err_msg) use($entry_name,$_this) { return $_this->seterror($entry_name,$err_msg); }; } public function counterrors() { return count($this->error_objects); } public function geterror($index) { return $this->error_objects[$index]; } public function getallerrors() { return $this->error_objects; } abstract function validate(); } i use in implementing class this: $seterror = $this->seterrorcurry('u_email'); if(empty($uemail)) { $seterror(uregform_errmsg_email_null); } if(!filter...

jquery - Best way to make a simple orderable playlist in django -

simple django orm question: i've got pretty classic example of playlist , track models: class track(models.model): name = models.charfield(max_length = 50) mp3 = models.filefield(upload_to="track/") class playlist(models.model): name = models.charfield(max_length = 50) class playlisttrack(models.model): playlist = models.foreignkey('track.playlist') track = models.foreignkey('track.track') position = models.integerfield() #here's crux of problem is best way of making orderable playlist? i doubt it, if so, how ordered queryset ? (i serialising json, queryset prefered, if have different, simple, way of making json i'd love hear it!) here's have far: playlist = track.objects.filter(playlisttrack__playlist__exact=1) but doesn't preserve ordering, according playlisttrack.position field... thanks! if notice playlisttrack model nothing more many-2-many intermediate table, things become ...

c# - Canceling an asynchronous socket operation -

i have c# .net 3.5 application sends multicast "hello" packet whomever may subscribed particular multicast group , listens responses. so, every x seconds, may send "hello" packet , make note of responds. it intended used this: multicasthello hello_ = new multicasthello(); // alert our ui of responses 'hello' hello_.receivedhelloresponse += onhelloresponse; // timer function triggered every x seconds private void ontimer(object sender, eventargs e) { // stop listening responses last 'hello' hello_.cancelhello(); // send new 'hello' , start listening responses hello_.sendhello("224.0.100.1"); } unfortunately, i'm having issues canceling asynchronous read. private void onreceive(iasyncresult ar) function throw system.argumentexception says "the iasyncresult object not returned corresponding asynchronous method on class." how can reliably cancel asynchronous socket operation. or, there bett...