Posts

Showing posts from February, 2015

c# - Grid related UI design question -

grid related ui design question i want 16-grid (4 rows , 4 columns) user interface, , fill grid round shapes. want use mouseover, mouse left button down, , mouse left button events set state of grids selected or not selected. my questions: 1. how fill grid round shapes? setcolumn , setrow? 2. how make grids respond mouse please? thanks <grid.columndefinitions> <columndefinition /> <columndefinition /> <columndefinition /> <columndefinition /> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition /> <rowdefinition /> <rowdefinition /> <rowdefinition /> </grid.rowdefinitions> i'd suggest initialize grid in code instead of xaml. since need pretty repetitive stuff (4×4 shapes, each 1 hooked same event handlers) don't want in xaml. you can use grid.setrow , grid.setcolumn position controls create. ...

silverlight 4.0 - DataTemplateSelector issue -

in silverlight project, needed use datatemplateselector . found way implement (as it's not present in framework) here : http://www.codeproject.com/kb/silverlight/sltemplateselector.aspx this method has been working correctly in other places of code, time doesn't work. problem templateselector never called (i tried put breakpoint in constructor, never hit). can see problem in code ? used debug converter, , see listbox 's itemssource correctly set. thanks in advance ! xaml: <listbox name="destinationslist" grid.column="2" itemssource="{binding}"> <listbox.itemtemplate> <datatemplate> <helper:targettemplateselector content="{binding}"> <helper:targettemplateselector.firsttemplate> <datatemplate> <textblock text="test1" /> </datatemplate> </helper:targettemplateselector.f...

c# - Which Namespaces Must Be Used to Connect to SQL Server with ADO.NET? -

i using example connect c# sql server. can please tell me have include in order able use sqlconnection? it must like: using sqlconnection; ??? string connectionstring = @"data source=.\sqlexpress;attachdbfilename=""c:\sql server 2000 sample databases\northwnd.mdf"";integrated security=true;connect timeout=30;user instance=true"; sqlconnection sqlcon = new sqlconnection(connectionstring); sqlcon.open(); string commandstring = "select * customers"; sqlcommand sqlcmd = new sqlcommand(commandstring, sqlcon); sqldatareader datareader = sqlcmd.executereader(); while (datareader.read()) { console.writeline(string.format("{0} {1}", datareader["companyname"], datareader["contactname"])); } datareader.close(); sqlcon.close(); using system.data; using system.data.sqlclient;

rest - HttpContext in WCF -

i have written simple rest api in wcf, , authentication mechanism uses api key. once client submits api key in request header, check on server side (in baseservice class overriding processrequest() method of requestinterceptor class) follows: public partial class baseservice : requestinterceptor { public baseservice() : base(false) { } #region process request public override void processrequest(ref requestcontext requestcontext) { if (isvalidapikey(requestcontext)) //put values in httpcontext object. } ... now have enabled aspnet compatibility in rest services, still cannot access httpcontext object in processrequest override above. note httpcontext accessible inside service method, not in processrequest method. any ideas why? the httpcontext initialized later in wcf channel stack. remember channel interceptor runs in channel stack before else, , after message has been received http channel listener. need access httpcontex...

mysql - Ordering by top commented -

how list page of top commented pages on site php , mysql? the database set sort of this: page_id | username | comment | date_submitted --------+----------+---------+--------------- 1 | bob | hello | current date 1 | joe | byebye | current date 4 | joe | stuff | date 3 | mark | | date how query orders them top commented pages? here simple query start (with xxx being areas think need with): $querycomments = sprintf("select * comments " . "xxx = %s order xxx desc", getsqlvaluestring(????????????, "text")); well, if you're looking way list pages in order of comments, group page id , order count, like: select page_id, count(*) comments group page_id order 2 desc, 1 asc technically, don't need 1 asc ensure specific order within descending comment count. so, if lot of pages identical comment count appear, can locate specific page within group easily. in other words, if...

SSIS package items show up empty when I open project -

i'm sorta new ssis packages , i've come across problem. i've taken on project coworker left. zipped project , left on machine. problem when unzip , open project on machine, data flow portion of items gone! theres nothing there! if, however, unzip , open project on machine, stuff put in there. heck going on? ssis packages stored xml. no matter open from, package should open - may give error if components needs missing, data flow not going go awol because doesn't desktop wallpaper. maybe question of zooming. on machine, when package opens up, right click in yellow area, , context menu choose zoom , fit other that, verify actual project path of each project in solution on workstation vs yours.

gcc - Netbeans is failing to build (How do I point it to my new Open MPI library?) -

i doing c development using netbeans on os x , project fails build, stating "...this installation of open mpi not compiled fortran 90 support" i have installed newer gcc , open mpi (along side default versions), , can build using them via make on command line. leads me believe netbeans using default open mpi installation (which did not have fortran support). if correct, how use new installation? told netbeans other compilers via tool collection manager (file->project properties->build->tool collection->[...]). however, not know of way tell open mpi. i have working solution. solution exists in 2 parts. 1) reran configure on command line project , specified full paths mpicc , mpifc. solved problem of getting netbeans use right mpicc compiler. however, created issue: mpif90 wrapper not find gfortran. 2) altered 'gui environment' path variable put gfortran in path using /etc/launchd.conf method found here (http://stackoverflow.com/questions/...

Prevent Save when Validation Errors occur on WPF DataGrid -

currently, have datagrid bound data in viewmodel. have validationrules set rows, , columns. prevent user saving file if there validation errors. using relaycommands class route open, save, etc commands viewmodel. check below links disable save button in wpf if validation fails using wpf validation rules , disabling 'save' button http://babaandthepigman.wordpress.com/2010/02/14/wpf-commanding-and-data-annotations-validation/ hope helps...

ios - iPhone application - pop up dialogue - sort of -

i have iphone application is, in essence, list. there uinavigationbar @ top, , there uitableview holds list. i'd have option in way or of allowing user sort list in different ways. so, in mind, picture having navigationitem on uinavigationbar that, when touched, little pop dialogue comes up. select "sort" want, check mark appears next it, , dialogue goes away. i'm not sure how this. tried creating uiview, adding uiviewcontroller onto (which held list of different "sort" parameters (ex. sort alphabetically, sort date, etc) in uitableview. but uitableview isn't responding touches, , i'm not sure why. does have idea using apples wonderful interface having option this? can't use uisegmentedcontrol below uinavigationbar, because there 5 possible options, , can't fit in single uisegmentedcontrol. thanks!! this sounds job uipickerview . slide 1 bottom of view whenever button pressed. i've done in past , works well. perhaps thi...

scala - Traits vs template -

i m new in scala , wonder what's differences between traits , template ? when should use template , when should use traits ? thanks it depends mean template. if ( wikipedia ) feature allow functions , classes operate generic types , template , trait 2 orthogonal notions. traits can use generic type (see so question instance), there here offer alternative multiple inheritance, offering mixin class composition stackable behavior.

Data quality database model -

need example of database model attached database data quality. best form of answer @ least ddl that's executable in mysql; other rdms ddl's okay, i'll post question asking porting of code. a explaintion huge plus. questions, comments, feedback, etc. -- comment, thanks!! the biggest problem identifying meaningful measures of quality. that's highly application-dependent, doubt able much. (at least not without lot more information--perhaps more you're allowed give.) but let's application records observations of birds individuals. (i'm throwing off top of head. read gist, , expect details crumble under scrutiny.) under average field conditions, some species hard beginner wrong some species hard expert right a specific individual's ability varies irregularly on time (good days, bad days) individuals become more skilled on time you might highly skilled @ identifying hawks, , totally suck @ identifying gulls individuals prone suggesti...

python - 2 math questions -

hey, i'm using pygame , want to: a) make function returns angle between 2 points. i've tried doing math.atan2 , i'm getting wierd returns. tried both (delta x, deltay) , (deltay, deltax). suggestions? b) given length , angle, return point using 2 0. example, lengthdir(2,45) using (length,angle) return (2,2). thanks help. i've searched on internet , couldn't find me... math.atan2 returns radians . if need degree, multiply result 180/π. def a(dx, dy): return math.atan2(dy, dx) * 180 / math.pi similarly, trigonometric functions in math operate in radians. if input degree, need multiply π/180 first. def lengthdir(length, angle): radian_angle = angle * math.pi / 180 return (length * math.cos(radian_angle), length * math.sin(radian_angle)) python provides convenient functions math.degrees , math.radians don't need memorize constant 180/π. def a(dx, dy): return math.degrees( math.atan2(dy, dx) ) def lengthdir(length, angle): ...

php - Android: Sending data to be stored in MySQL -

solved: missing view parameter postdata(), changed reflect this. i sending gps data server stored in mysql database using php. this inside java file: arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(2); public void postdata(view v) { namevaluepairs.add(new basicnamevaluepair("lat","19.80")); namevaluepairs.add(new basicnamevaluepair("lon","13.22")); //http post try{ httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://www.xxxxxxxx.com/test.php"); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); httpentity entity = response.getentity(); inputstream = entity.getcontent(); log.i("postdata", response.getstatusline().tostring()); } catch(exception e) { log.e("log_tag",...

networking - network load and interarrival time -

i little confused definition of interarrival time, mean time between 2 sent packets? , using opnet, observed shorter interarrival time is, higher network load, correct conclusion? in short: yes. interarrival time defined time between "start" of 2 events. (so if had network capable of processing 2 packets @ exact same time, , 2 packets come in, interarrival time between 2 packets zero.) it sounds have sort of monitoring utility measuring interarrival time. in case, should consult documentation tool see definition , how calculate it.

sql - Specify sorting order for a GROUP BY query to retrieve oldest or newest record for each group -

i need recent record each device upgrade request log table. device unique based on combination of hardware id , mac address. have been attempting group by not convinced safe since looks may returning "top record" (whatever sqlite or mysql thinks is). i had hoped "top record" hinted @ way of order by not seem having impact both of following queries returns same records each device, in opposite order: select exthwid, mac, created upgraderequest group exthwid, mac order created desc select exthwid, mac, created upgraderequest group exthwid, mac order created asc is there way accomplish this? i've seen several related posts have involved sub selects. if possible, without subselects learn how without that. try: select exthwid, mac, max(created) upgraderequest group exthwid, mac

javascript - Jquery get each div's sub child divs and grab info into an array -

i have html looks this <div id="main"> <div id="sub_main_1" class="sub_main"> <input type="text" class="sub_name_first" /><br /> <input type="text" class="sub_name_second" /><br /> </div> <div id="sub_main_2" class="sub_main"> <input type="text" class="sub_name_first" /><br /> <input type="text" class="sub_name_second" /><br /> </div> </div> i pull out each sub_main divs information array in javascript. far have jquery code $('#main').find('.sub_main').each( function() { alert('hi'); }); the alert test should show "hi" twice. not working. not clear on how can store 2 inputs in javascript array. great! thanks, var array = $('#main input').map(fun...

Android programming: Authentication and data exchange with Java EE -

i having java application running in tomcat server using spring, hibernate, etc. , 2 web interfaces, 1 implemented in tapestry 5 , other 1 using flex blazeds , spring-blazeds. in first android application log in server , retrieve data. i´m wondering how achieve in secure way. first of need know technology best retrieve data server , how can restrict access users have been authenticated. with read until try implement httpservlet on server , make server calls via http client. in servlet use httpsession check if request comes authenticated user. , data try send serialized (json). unfortunately, i´ve never done things , maybe i´m on wrong way , there more comfortable solutions. oh yes there many ways communicate server android. method 1 mentioning, every request have servlet or controller intercept request , send appropriate response. every time have add new requirement make controller or servlet , add entry in mapping file etc. second method use service oriented archi...

Tough SQL problem for an amateur like me -

my family has several stock accounts, , keep table of stock values contents , enter current values daily. fields are... account / ticker / quantity / closingdate/ closing (current price) to report of current stock contents , recent price, using code. add row row, , account total (for account # 2, example ). table designed way can track individual stock performance. select distinct ticker, account, closingdate, quantity, closing, (quantity*closing) "net" "stock values" s (account=2) , (quantity>0.000001) , (closingdate =(select max(closingdate) "stock values" ( ticker = s.ticker) , (account=s.account)) ) but create report looks on tdbgrid that... report, grouped account recent distinct tickers added account. 4 days later, cannot crack this. account value 1 35,000.00 2 122,132,32 3 43.23 i'm using nexus 3 on delphi 7. any help, greatl...

c program pointer -

i trying programs in c face problem program can 1 tell me problem , want know when in above case if pointer value incremented on write previous value address #include<stdio.h> int main() { int a=9,*x; float b=3.6,*y; char c='a',*z; printf("the value %d\n",a); printf("the value %f\n",b); printf("the value %c\n",c); x=&a; y=&b; z=&c; printf("%u\n",a); printf("%u\n",b); printf("%u\n",c); x++; y++; z++; printf("%u\n",a); printf("%u\n",b); printf("%u\n",c); return 0; } suppose value got in above program (without increment in pointer value )is 65524 65520 65519 , after increment value of pointer 65526(as 2 increment int ) 65524(as 4 increment float ) 65520(as 1 increment char variable ) then if in case new pointer address overwrite content of previous address , value contained @ new address...

flash - Casting Variables to a Movie Clip -

how can convert gecko object movie clip? function finish(boxname, arrayname:array):void { each (var item:string in arrayname) { trace(boxname+"_"+item); var gecko:movieclip = (boxname+"_"+item) movieclip ; trace(typeof(gecko)); gecko.gotoandplay("glow"); } } this gives following error: high_hsymbol_1 object typeerror: error #1009: cannot access property or method of null object reference. @ quizz_fla::maintimeline/finish() @ quizz_fla::maintimeline/dropit() boxname+"_"+item should reference movieclip, no need casting think not possible string movieclip. associative arrays. supposed movieclips childs of "this": var gecko:movieclip = this[boxname+"_"+item];

c++ - Database creation error in Qt -

i using code create database. getting "false" in debug. tried lot not working. error in this? qsqlquery query; qdebug() << query.exec("create table glucose (id integer primary key autoincrement, value integer, date text, time text, duration text, note text"); qdebug() << query.prepare("insert glucose(id, value, date, time, duration, note)""values(?, ?, ?, ?, ?, ?)"); query.bindvalue(1,edit_glucose->text().toint()); query.bindvalue(2,datetime->date()); query.bindvalue(3,datetime->time()); query.bindvalue(4,"a"); query.bindvalue(5,edit_note->toplaintext()); qdebug() << query.exec(); you forget close create table query ")"

OpenGL multiple textures with VBOs -

i'm trying figure out how render object (a cube) different textures each face. simplicities sake, have 2 textures applied 3 faces of cube each. understand should using texture arrays 3 coordinates represent relevant texture used. i'm unsure of how , how code fragment shader. here relevant part of init() function: final string texturename = model.gettextures().get(i).texturename; final filetexture texturegenerator = new filetexture(this.getclass().getresourceasstream(texturename), true, context); textureid = texturegenerator.gettextureid(); width = texturegenerator.getwidth(); height = texturegenerator.getheight(); texturemap.put(model.gettextures().get(i).matname, textureid); context.getgl().glactivetexture(gl.gl_texture0 + i); context.getgl().glbindtexture(gl.gl_texture_2d, textureid); i confused here because orange book (opengl shading language) gives examples in glactivetexture , glbindtexture used glsl common mistakes says shouldn't this. ...

http - how to redirect a site in android -

i want redirect site .how can done using http ??pls 1 explain me?i new android i think need this... intent = new intent(intent.action_view); intent.setdata(uri.parse("http://www.google.com")); startactivity(intent);

.net - Force NCover 1.5.8 to use v4 framework like testdriven.net does? -

i want run coverage command line, can't seem ncover 1.5.8 instrument code. must possible when run coverage tests testdriven.net works. difference seems td.net able ncover use framework 4.0 (you in log when runs : message: v4.0.30319 ) command line can't make (i in log : message: v2.0.50727 ) so how can make ncover play nice nunit commandline, td.net? after more searching found this: if have found thread because trying ncover 1.5.8 work .net 4 following should fix error: open command prompt , type following set complus_profapi_profilercompatibilitysetting=enablev2profiler this instructs .net 4 clr load .net framework 2.0 profiler. for more information see: http://msdn.microsoft.com/en-us/library/dd778910.aspx at end of thread here which seems solve problem edit : it doesn't solve problem really. allows coverage.xml generated, contains v2.0 framework assemblies, .net 2.0 assemblies profiled.... grrr. drawing bo...

active directory - Issue Querying LDAP DirectoryEntry in ASP.NET -

i have users login application via active directory , pull ad information garner information user so: dim id formsidentity = directcast(user.identity, formsidentity) dim ticket formsauthenticationticket = id.ticket dim addirectory new directoryentry("ldap://dc=my,dc=domain,dc=com") dim adticketid string = ticket.name.substring(0, 5) session("people_id") = addirectory.children.find("cn=" & adticketid).properties("employeeid").value session("person_name") = addirectory.children.find("cn=" & adticketid).properties("displayname").value now, want able impersonate other users...so can "test" application them, added textbox , button page , when button clicked text assigned session variable so: session("impersonate_user") = textbox1.text when page reloads check see if session("impersonate_user") has value other "" , attempt query active directory using session vari...

Flex application scalability and compatability -

how flex app in handling large amount of data (say, reporting kind of application) are there memory management issues need kept in mind while developing such app are there issues in running flex app on mac? 1) great long you're not transferring huge amounts of data @ 1 time using httpservice. amf remoting amfphp runs super fast. 2) flash player runs on clients machine, need make sure aren't using more memory have available. 3) if remember right flash player kind of weak on mac, slower pcs haven't bench-marked them in while

c# - ScrollWindow has Absolutely No Effect -

i'm creating user control winforms , have need scroll section of control window. inexplicably, appears no scrollwindow() method available in winforms. i'm trying use interopservices use win32 api scrollwindow() function using variations of following: [structlayout(layoutkind.sequential)] public struct rect { public int left; public int top; public int right; public int bottom; public rect(rectangle rect) { this.bottom = rect.bottom; this.left = rect.left; this.right = rect.right; this.top = rect.top; } } [dllimport("user32")] public static extern int scrollwindow(intptr hwnd, int nxamount, int nyamount, ref rect rectscrollregion, ref rect rectclip); void myscrollfunc(int yamount) { rect r = new rect(clientrectangle); scrollwindow(handle, 0, yamount, ref r, ref r); } the result code absolutely nothing. i've tried sorts of variations of code, including calling update() after sc...

c# - Problems with WCF endpoints hosted from Windows Service -

i have managed windows service hosts couple of wcf endpoints. service set start automatically when pc restarted. on reboot find line of code: servicehost wcfhost1 = new servicehost(typeof(wcfhost1)); in onstart() method of service takes somewhere between 15 - 20 seconds execute. have 2 such statements second 1 executes in flash. first 1 takes long. know causing bottleneck? because of this, call exceeds 30 seconds , result scm thinks service timed out while trying initialize itself. now, know easy me spin off thread , return onstart() right away i'd know cause delay. this happens only when service starts on pc reboot. if pc , running, service starts & stops in less second. this might provide more help. basically, think need figure out dependencies have , add them service, start before yours. this shot in dark, .net framework hasn't loaded yet. perhaps, can try set automatic start delayed automatic start, allow .net framework , other windows s...

Android source referencing missing classes -

i cloned of trees android open source project take @ code, can't build them because reference classes don't seem exist. for instance, music application here references android.media.mediafile according package summary not exist, things arraylistcursor has old javadoc around absent in current documentation . so open source project disjoint released sdk? also, there way build these open source packages current sdk? thanks, -jqp so open source project disjoint released sdk? the stock android applications have nothing whatsoever sdk. written before sdk existed. so, example, there android.media.mediafile class, , arraylistcursor class. not part of sdk, can find source them using google code search , package:android qualifier. also, there way build these open source packages current sdk? if "open source packages" mean applications, no, cannot built using sdk. someday, perhaps can be, not without substantial work in cases. ...

mysql - Exclude duplicate rows in query result -

i want count number of records in database more 2 tables joined. for example have table this. table jobd + name 1 | joba 2 | jobb tablea imgeid + orderid + jobid 1 | 1 | 1 2 | 2 | 1 3 | 3 | 1 4 | 4 | 1 (this order not yet started) tableb taskid + orderid + task + status 1 | 1 | 1 | updated 2 | 1 | 1 | updated 3 | 1 | 1 | completed 4 | 2 | 2 | saved 5 | 3 | 3 | completed my problem here when count base on status (@ tableb) query results both updated has same orderid. this sample query same 1 i'm working. select t.name count(case when tb.task = 1 , tb.status <> 'completed' tb.status else null end) inprogress, count(case when tb.task = 1 , tb.status = 'completed' tb.status else null end) completed tablea ta left join tab...

c# - IEnumerable<> to IList<> -

i using linq query database , returning generic ilist. whatever tried couldn't convert iqueryable ilist. here code. i cannot write simpler , don't understand why not working. public ilist<iregion> getregionlist(string countrycode) { var query = c in database.regiondatasource (c.countrycode == countrycode) orderby c.name select new {c.regioncode, c.regionname}; return query.cast<iregion>().tolist(); } this returns list right number of items empty please help, bloqued couple of days now your select statement returns anonymous type: new {c.regioncode, c.regionname} this can't converted iregion - duck-typing, c# doesn't support. your linq statement should return type implements iregion - code should work. however shouldn't run - cast<iregion> should throw runtime exception. basically: // isn't anonymous, , should cast public class myregion : iregion { ...

Weird typewriter sound as I type into a textbox (wpf) in C# -

i've made pretty simple wpf windows textbox in it. type in it gives me weird typewriter-sound. idea why? , how can stop doing it? as there no built-in functionality in wpf automatically generate weird typewriter sound in text boxes, have 2 choices: remove code have in text changed event plays weird typewriter sound. make sure don't have third party applications generates weird typewriter sounds on system.

Validate Empty / Radio Fields - Php -

<?php $name = $_post["name"]; $email = $_post["email"]; $gender = $_post["gen"]; $age = $_post["age"]; $comments = $_post["comments"]; if(empty($_post["name"])){ echo "empty name"; } if(empty($_post["email"])){ echo "empty email"; } /// if(empty($_post["gen"])){ echo "empty gender"; } if(empty($_post["comments"])){ echo "empty comments"; } if(!isset($_post['submit'])) { ?> <html> <head> <title>lab6 : p1</title> </head> <body> <fieldset> <legend><h4>enter information in fields below</h4></legend> <form name="info" method="post" action="<?php echo $php_self;?>" method="post"> <strong>name:</strong> <input type="text" name="name" id="name" /><br> <strong>email:...

asp.net - Data Web Controls -

in repeater control can achive both sorting , grouping together, if possiple plz guide me way. if not, best control obtain sorting , grouping. thank you there no built-in data control grouping , sorting works out of box in .net framework. need implement sorting , grouping yourself. implemented solutions can @ devexpress gridview or jquery grid plugin . if want implement sorting in repeater control - @ this .

textarea - How can I create 2 Perl/TK text areas with scrollbars that when I scroll one both text areas scroll at the same time? -

is possible using tk create text areas scrollbars when scroll 1 other moves well? what want create text area headers in , text areas underneath row headings in 1 , data in other. kind of when freeze panes in excel. have data in set of arrays each line, need way of linking scrollbars in each of text areas down 1 in data controls row headings , vice versa, , left right 1 of data controls column headings , again vice versa. probably not possible doesn't hurt ask edit ok have got code , want need getting work completely. code example shows if move 1 scrollbar indeed controls other text area, , vice versa, doesnt control own text area, there way of adding multiple xviews command moves both textareas @ same time. in advance use tk; use tk::rotext; @headers = ( "+----------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+", "| | m | m | m | m | m | m | m | m | m | m |...

c++ - When does it make sense to typedef basic data types? -

a company's internal c++ coding standards document states basic data types int, char, etc. 1 should define own typedefs "typedef int int". justified advantage of portability of code. there general considerations/ advice when (in means types of projects) make sense? in advance.. typedefing int int offers no advantage @ (it provides no semantic benefit, , leads absurdities typedef long int on other platforms remain compatible). however, typedefing int e.g. int32_t (along long int64_t , etc.) offer advantage, because free choose data-type relevant width in self-documenting way, and portable (just switch typedefs on different platform). in fact, compilers offer stdint.h contains of these definitions already.

php - Symfony Templates within Templates -

sorry if seems incredibly simple. new symfony. i want have template/view "contains" other views. so, following example, imagine on /dashboard/ show both "statistics" , "inbox". want code each of these within separate actions/methods. <?php class dashboardactions extends sfactions { public function executeindex(sfwebrequest $request) { // load statisticssuccess // load inboxsuccess // render them both "within" index template } public function executestatistics(sfwebrequest $request) { // render statisticssuccess } public function executeinbox(sfwebrequest $request) { // render inboxsuccess } } thanks assistance can provide! make "statistics" , "inbox" components . sure reference documentation of version of symfony you're using.

unit testing - NHibernate ISession.Replicate with SQLite and native id generation -

we mapping primary key of object this: id(x => x.id, "id").generatedby.native("sequencename"); we have business logic depending on ids exist (legacy, not changed). new objects should generated ids oracle sequence, there rows known ids. we're using sqlite unit testing , need persist new objects in-memory database these known ids. not work of following methods: session.replicate(objectwithknownid, <any replication mode>); session.merge(objectwithknownid) according nhibernate documentation, replicate method seems i'm looking for. persist reachable transient objects, reusing current identifier values. when using sqlite, however, generated ids. can think of way of solving this? i typically run database tests against database i'm running app against - sqlite can quick tests missing many of features you'll find in full blown dbms. may able use method 1 discussed here tweak mappings @ runtime if mapping issue. ...

python - How can remove a widget and resize the main window? -

i have test app uses python , tkinter present number of text boxes user using grid layout manager. to reduce clutter on screen have show/hide button removes , show several non-critical widgets: if show_all: # display widget widget.grid() else : # hide widget widget.grid_remove() what next force main window resize after widgets have been modified. any suggestions welcome. by default main window should resize, assuming user hasn't resized window. if user has resized window, might want rethink need shrink it. if resized it, want @ size resized to. regardless, try setting window geometry of main window (eg: root.wm_geometry("") ) empty string. trigger main window re-layout children.

php - "Executing SQL directly; no cursor" error when using SCOPE_IDENTITY/IDENT_CURRENT -

there wasn't on google error, i'm asking here. i'm switching php web application using mysql sql server 2008 (using odbc, not php_mssql). running queries or else isn't problem, when try scope_identity (or similar functions), error "executing sql directly; no cursor". i'm doing after insert, should still in scope. running same insert statement query insert id works fine in sql server management studio. here's code right (everything else in database wrapper class works fine other queries, i'll assume isn't relevant right now): function insert_id(){ return $this->query_first("select scope_identity() insert_id"); } query_first being function returns first result first field of query (basically equivalent of execute_scalar() on .net). the full error message: warning: odbc_exec() [function.odbc-exec]: sql error: [microsoft][sql server native client 10.0][sql server]executing sql directly; no cursor., sql state 01000 in sqle...

internet explorer - Can't open docx files online on Win2003 server - get 403 -

i have asp.net web application runs locally , opens docx files in ie8. however, after deploying our production server (win2003), 403 error. same code works doc files, not docx files. so, i've narrowed problem down server not have direction. i read might mime type issue, i'm not sure enter executable path in iis 6.0. not have mime changes locally, maybe installed patch of sort... does have direction or easier way on server? could mime type. had problems it, fixed download handler wrote manually in user control. on iis7 though , i'm not sure if iis6 supports docx. try adding mime type on server. mime type: application/vnd.openxmlformats-officedocument.wordprocessingml.document and maybe this article helps to

jquery.validation - how to ignore default values when validating mandatory fields -

i using jquery validation plugin validate registration form. each text input field has instructions pre-filled values in input box ex: text-input box id='name', default value set 'enter name'. have pasted below sample code: <input type="text" id="name" value="enter name" onfocus="if(this.value == 'your name'){this.value = '';}" type="text" class="required" onblur="if(this.value == ''){this.value='your name';}" size="25" /> what need know how specify in validation rule such plugin throws required field error if input box contains either default message or empty values. help appreciated. i think better: jquery.validator.addmethod("defaultinvalid", function(value, element) { return !(element.value == element.defaultvalue); });

c# - How to get List of results from list of ID values with LINQ to SQL? -

i have list of id values: list<int> myids { get; set; } i'd pass list interface repository , have return list match id values pass in. list<mytype> mytypes = new list<mytype>(); imyrepository myrepos = new sqlmyrepository(); mytypes = myrepos.getmytypes(this.myids); currently, getmytypes() behaves this: public mytype getmytypes(int id) { return (from mytype in db.mytypes mytype.id == id select new mytype { myvalue = mytype.myvalue }).firstordefault(); } where iterate through myids , pass each id in , add each result list. how need change linq can pass in full list of myids , list of mytypes out? getmytypes() have signature similar to public list<mytype> getmytypes(list<int> myids) public list<mytype> getmytypes(list<int> ids) { return (from mytype in db.mytypes ids.contains(mytype.id) select new mytype { myv...

Python RegEx multiple groups -

i'm getting confused returning multiple groups in python. regex this: lun_q = 'lun:\s*(\d+\s?)*' and string is s = '''lun: 0 1 2 3 295 296 297 298'''` i return matched object, , want @ groups, shows last number (258): r.groups() (u'298',) why isn't returning groups of 0,1,2,3,4 etc.? your regex contains single pair of parentheses (one capturing group), 1 group in match. if use repetition operator on capturing group ( + or * ), group gets "overwritten" each time group repeated, meaning last match captured. in example here, you're better off using .split() , in combination regex: lun_q = 'lun:\s*(\d+(?:\s+\d+)*)' s = '''lun: 0 1 2 3 295 296 297 298''' r = re.search(lun_q, s) if r: luns = r.group(1).split() # optionally, convert luns strings integers luns = [int(lun) lun in luns]

sql server - How to add table column headings to sql select statement -

i have sql select statement this: select firstname, lastname, age people this return me table: peter smith 34 john walker 46 pat benetar 57 what want insert column headings first row like: first name last name age =========== ========== ==== peter smith 34 john walker 46 pat benetar 57 can suggest how achieved? could maybe create temporary table headings , append data 1 this? neither of answers above work, unless names come after "first" in sort order. select firstname, lastname ( select sorter = 1, firstname, lastname people union select 0, 'firstname', 'lastname') x order sorter, firstname -- or whatever ordering need if want non-varchar columns well, cons (at least): all data become varchar. if use visual studio example, no longer able recognize or use date values. or int values. or other matter. you need explicitly provide format datetime values dob. dob valu...

php - How do you execute a method in a class from the command line -

basically have php class that want test commandline , run method. sure basic question, missing docs. know how run file, php -f not sure how run file class , execute given method this work: php -r 'include "myclass.php"; myclass::foo();' but don't see reasons besides testing though.

c++ - check whether fgets would block -

i wondering whether in c possible peek in input buffer or perform similar trickery know whether call fgets block @ later time. java allows calling bufferedreader.ready(), way can implement console input this: while (on && in.ready()) { line = in.readline(); /* line */ if (!in.ready()) thread.sleep(100); } this allows external thread gracefully shutdown input loop setting on false; i'd perform similar implementation in c without resorting non portable tricks, know can make "timed out fgets" under unix resorting signals or (better, though requering take care of buffering) reimplement on top of recv/select, i'd prefer work on windows too. tia suggest go socket i/o routines,preferably poll() required millisecond timeout , can interpret timeout ( return value = -1 ) unavailability of data in input buffer. in opinion,there no non-blocking standard i/o function achieve functionality.

sql - No Changed Rows Produced by this mySQL update query. Why? -

This summary is not available. Please click here to view the post.

c# - Sending Arguments Via Event Handler? -

so i'm not sending arguments, setting class variable value, using again in method. "best practice" way things? if not, i'd interested in learning correct way. thanks! can/should arguments sent other way? private string printthis; public void printit(string input){ printthis = input; //setting printthis here static private printdocument pd = new printdocument(); pd.printpage += new printpageeventhandler(printdocument_printsomething); pd.print(); } private void printdocument_printsomething(object sender, printpageeventargs e) { e.graphics.drawstring(printthis, new font("courier new", 12), brushes.black, 0, 0); //using printthis in above line } closures introduced language solve problem. by capturing appropriate variable, can give storage 'outlives' containing method: // note 'input' variable captured lambda. pd.printpage += (sender, e) => print(e.graphics, input); ... static void print(graphic...

java - Newbie 'Can you do this with Dojo/Ajax' Question -

i have web page has function send initial request web service. after predefined time, user can send second request. after user sends first request, want web page countdown when user may send second request. after countdown, want db field updated automatically, indicating appropriate time has passed. when time has passed , db updated, i'd webpage updated show button allow user send second request. after initial request, call javascript user-defined function " countdown() " using in-built javascript function " settimeout("countdown()", 4000) ", number " 4000 " resembles number of micro-seconds need passed fire function mentioned in first parameter. in " countdown() " function, write logic ajax call, updating database desired time of 4 seconds (for example) has passed & user can send second request. also in same ajax call, can print out word (let word " yes " example), can catch / fetch in " countd...

mod rewrite - CakePHP use Regex variable capture in routes? -

in cakephp app have static pages set this: router::connect( '/terms', array('controller' => 'pages', 'action' => 'display', 'terms') ); this rewrite /terms /pages/display/terms make prettier shorter urls. now if wanted static pages, quite redundant: router::connect( '/terms', array('controller' => 'pages', 'action' => 'display', 'terms') ); router::connect( '/privacy', array('controller' => 'pages', 'action' => 'display', 'privacy') ); router::connect( '/about', array('controller' => 'pages', 'action' => 'display', 'about') ); with regular mod_rewrite can this: /(terms|privacy|about) /pages/display/$1 so naturally attempted this: router::connect( '/(terms|privacy|about)', array('controller' =...

c++ - TCP server with state information using network library -

i'm writing tcp server online turn-based game. i've written prototype using php sockets, move c++. i've been looking @ popular network libraries (asio, ace, poco, libevent), unclear 1 best suit needs: 1) connections persistent (on order of minutes), , server must able handle 100+ simultaneous connections. 2) connections must able maintain state information (user login info). [my php prototype requires each client request contain login info] 3) optionally , preferably multi-threaded, single process. prefer not have 1 thread per connection, fixed number of threads working on open connections. i'm leaning towards poco's tcpserver or reactor frameworks, not sure if meet requirements. think reactor single threaded, , tcpserver enforces 1:1 threading/connection. correct? in either case case, i'm not sure how important task of associating login info specific connection connections coming , going @ random. boost.asio should meet requirements. ...

what models/OS of BlackBerry phones widely used in the world? -

i want develop blackberry application. confuse bcoz there lots of models/os available in blackberry phones. can 1 have idea/servey popular model/os in blackberry phones. so can develop application many users possible... or tell me if generalize sollution available... thanking in advance... i haven't done should visit : http://na.blackberry.com/eng/developers/ java seems development standard on blackberry phones java 5.0 : new gold standard java® development on blackberry application platform. you'll information need on developers' site. they provide simulators per blackberry model. hope helps

c++ - stringstream to array -

could tell me, why wrong? i have mytype test[2]; stringsstream result; int value; (int i=0; i<2; i++) { result.str(""); (some calculating); result<< value; result>> test[i]; } when watch test array - first - test[0] - has correct value - every other test[1..x] has value 0 why wrong , not working? in first run in cycle stringstream set correct value array, later there 0? thanks try result.clear() ing stringstream before flushing result.str("") . sets state of accepting inputs again after outputting buffer. #include <sstream> using namespace std; int main(){ int test[2]; stringstream result; int value; (int i=0; i<2; i++) { result.clear(); result.str(""); value = i; result<< value; result>> test[i]; } return 0; } without clearing test[0] == 0 , test[1] == -832551553 /*some random number*/ . clear expected output of te...

iphone - Video Clip does not play correctly -

i trying play video in 1 of screens. seems run when file opens, fullscreen loads , closes right after. video few seconds long, , m4v format. added framework , imported class. how can make video plays properly? my header: -(ibaction)playmedia:(id)sender { nsstring *moviefile; mpmovieplayercontroller *movieplayer; moviefile = [[nsbundle mainbundle] pathforresource:@"movie" oftype:@"m4v"]; movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl: [nsurl fileurlwithpath: moviefile]]; [movieplayer.view setframe:cgrectmake(145.0, 20.0, 155.0 , 100.0)]; [self.view addsubview:movieplayer.view ]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(playmediafinished:) name:mpmovieplayerplaybackdidfinishnotification object:movieplayer]; [movieplayer play]; if ([togglefullscreen ison]) { [movieplayer setfulls...

How to call postback using javascript on ASP.NET form -

i have web form textbox , button. want after "enter" key click on textbox postbak form. i using next code: onkeypress=" if(event.keycode==13) { alert(2); webform_dopostbackwithoptions(new webform_postbackoptions('ctl00$contentplaceholder1$btnsearch', '', true, '', '', false, false)); alert(2); return false;} where webform_dopostbackwithoptions(new webform_postbackoptions('ctl00$contentplaceholder1$btnsearch', '', true, '', '', false, false)); is javascript code button event onclick. i 2 alerts, postback doesnot happen. any ideas wrong? asp.net creates client side javascript method __dopostback support postback. example: __dopostback('__page', 'mycustomargument');

c# - How to create an extension method for ToString? -

i have tried this: public static class listhelper { public static string tostring<t>(this ilist<string> list) { return string.join(", ", list.toarray()); } public static string tostring<t>(this string[] array) { return string.join(", ", array); } } but not work, both string[] , list<string> . maybe need special annotations? extension methods checked if there no applicable candidate methods match. in case of call tostring() there always applicable candidate method, namely, tostring() on object . purpose of extension methods extend set of methods available on type, not override existing methods; that's why they're called "extension methods". if want override existing method you'll have make overriding method.

c - learning sample of likely() and unlikely() compiler hints -

how can demonstrate students usability of likely , unlikely compiler hints ( __builtin_expect )? can write sample code, several times faster these hints comparing code without hints. here 1 use, inefficient implementation of fibonacci numbers: #include <stdio.h> #include <inttypes.h> #include <time.h> #include <assert.h> #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) uint64_t fib(uint64_t n) { if (opt(n == 0 || n == 1)) { return n; } else { return fib(n - 2) + fib(n - 1); } } int main(int argc, char **argv) { int i, max = 45; clock_t tm; if (argc == 2) { max = atoi(argv[1]); assert(max > 0); } else { assert(argc == 1); } tm = -clock(); (i = 0; <= max; ++i) printf("fib(%d) = %" priu64 "\n", i, fib(i)); tm += clock(); printf("time elapsed: %.3fs\n", (double)tm / clocks_pe...