Posts

Showing posts from September, 2013

c++ - Multiple connected objects in QT -

i have several qt objects notify each other of changes. connecting them each other without safeguard create infinite loop of signals: object changes , signals objects b , c; each of b , c sends signals , c , b respectively; etc. temporarily disconnecting other objects when receiving signal , reconnecting after updating object kind of barely work, emphasis on "kind of barely", includes occasional crashes due multiple signals coming out of order. what recommend safe , robust method of syncing multiple qt objects? you use qobject::blocksignals described here . must remember if use qobject::blocksignals bloack signals until call qobject::blocksignals false parameter.

c# - Printing Crystal Report in loop -

my requirement generate/print mark-sheet of student of particular class @ single click, in crystal report. when used loop shows last record/page of report. and code private void btngenerate_click(object sender, eventargs e) { try { axcrystalactivexreportviewer1.reportsource = null; reportdocument cryrpt = new reportdocument(); tablelogoninfos crtablelogoninfos = new tablelogoninfos(); tablelogoninfo crtablelogoninfo = new tablelogoninfo(); connectioninfo crconnectioninfo = new connectioninfo(); tables crtables; crconnectioninfo.servername = configuration.servername; crconnectioninfo.databasename = configuration.databasename; crconnectioninfo.userid = configuration.server_username; crconnectioninfo.password = configuration.server_password; crtables = cryrpt.database.tables; foreach (crystaldecisions.cry...

io redirection - Simulate input from stdin when running a program in intellij -

is there way configure command line args intellij stdin redirection? something along lines of: run | edit run configurations | script parameters /shared/java/paf-rules.properties 2 < /shared/java/testdata.csv unfortunately, no - @ least not directly in run configurations. the best can do, afaik, either to: modify script / program run either no args (reads system.in ) or filename argument (reads file) make wrapper script / program acts in manner above. hope helps, vikingsteve

java - .M3U8 Video Streaming on Google TV -

i have used vitamio library play .m3u8 video format on mobile( http://www.vitamio.org/en/download/ ) could 1 tell me same work on google tv? because vitamio uses native binary code (ndk) need wait jellybean release of google tv before able use library.

java - Spring MVC session Attribute set intially -

i have used spring mvc. set session attribute value @requestmapping(value = "/home", method = requestmethod.get) public string inithome(model model) { if (!model.containsattribute("clientobject")) { model.addattribute("clientobject", createdefaultclient()); } return "homemenu"; } it working fine if click home menu url(/home). if did not go home means says error 'session attribute clientobject required' so decided set sessionattibutes in constructor of controller @autowired public mycontroller(model model) { if (!model.containsattribute("clientobject")) { model.addattribute("clientobject", createdefaultclient()); } } it says error org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'mycontroller ' i tried set using requestmapping like @requestmappin...

Google translate pages does not translate whole page -

i asking question again, no 1 able answer before. including updates. web-page - http://jewelryfashionstyle.com/sv/ in right top corner there google translate thingy. translates whole page correctly language swedish. in swedish version, main menu , other items not translated. "from" language set correctly. i tried everything, removed tags menu (only menu item words remained) reason not translate menu. tried placing menu in different place, tried remove javascript animates - no luck. does have idea problem be? please, help. i've been looking solution week :) the problem doesn't come google translate, problem comes personn makes page, website not use google translate translate page. if insert page in google translate website, have same elements translated in russian , swedish

scala - Autofilling a form using the Play Framework -

i have form contains values. when posted server, server validates information, , if of fields invalid, supposed return filled form. the way have set this. i have form validates 2 fields. val userform = form( mapping( "name" -> text, "age" -> number(min=0, max=100) )(user.apply)(user.unapply) ) if form fails bind, load same form values posted. def createitem() = isauthenticated { username => implicit request => { createexperienceform.bindfromrequest().fold( formwitherrors => badrequest( views.html.createitem(formwitherrors) ), validform => { val itemcode = item.createitem(validform) redirect(routes.item.item(itemcode).url) } ) } } the problem have manually set value in html page each form. eg. @(itemform: form[itemcontent]) <input name="age" type="number" class="input-block-level...

ruby on rails - I18n_routing, empty path + nested resource -

i have rails website using gem i18n_routing. have path such this: domain.com/<place>/bookings where place "new-york". goal routes translated this: domain.com/<place>/bokningar i trying translate through i18n_routing so: resources :places, :path => '', :except => [:index, :create, :new] #resources :flight_pages, :path => 'flyg', :only => [:show, :index] #resources :hotel_pages, :path => 'hotell', :only => [:show, :index] localized resources :bookings, :except => [:edit, :update] :get_method_desc, :on => :collection :get_image_path, :on => :collection end end :autocomplete_place_name, :on => :collection end localized resources :places, :only => [:index, :create, :new] end with translation file this: resources: places: 'plats' bookings: 'bokningar' i run problem if have above, i18n_routi...

Issue in getting the location in android device -

i stuck in problem lat , long in android device. have @ code follows:- public newlocationactivity(final context mcontext) { locationmanager = (locationmanager) mcontext .getsystemservice(context.location_service); locationlistener = new locationlistener() { public void onlocationchanged(location location) { updatelocation(location); msharedpreferences=mcontext.getsharedpreferences(homesafepref.homesafelocationpref,context.mode_private); sharedpreferences.editor prefeditor=msharedpreferences.edit(); string latitude=string.valueof(currentlatitude); string longitude=string.valueof(currentlongitude); string heading=string.valueof(currentheading); string horizaccuracy=string.valueof(currenthorizaccuracy); prefeditor.putstring("latitude", latitude); prefeditor.putstring(...

jQuery "Like" with id in HTML as identifier -

i working on project, it's possible users each others stuff. right jquery gets id html, identify thing like. people able open inspector in browser, , edit id, , way whole other thing. i searching alternative ways this. i've thought of making unique string, that's kinda same, since still able copy/paste string element. thanks in advance. try below code: <?php if (!isset($_session)) session_start(); //consider ids of post fetched database. $pageids = array(1,2,3,4,5,6,7,8,9,10); foreach($pageids $index => $key) { $uniqueid = uniqid(); echo '<a href="#" class="like" rel="'.$index.'#'.$uniqueid.'"></a>'; $_session[$uniqueid] = $index; } //now when clicks on button, pass rel attribute in post variable pp if($_post['id']) { $array = explode('#',$_post['id']); $actualid = $_session[$array[1]]; if($actualid === $array['0']) { ...

php - how to detect username and password than login to different page -

<?php if (isset($_post["loginbtn"])){ $euser = $_post["emp_username"]; $epassw = $_post["emp_password"]; $check_user = mysql_query("select * employee emp_username = '".$euser."' , emp_password= '".$epassw."'"); if ($row=mysql_fetch_assoc($check_user)){ $_session["loggedin"] = "true"; $_session["eid"] = $row["emp_id"]; // keeps member id in session header("location: profile.php"); // proceeds profile page }else{ ?> <script type = "text/javascript"> alert("invalid username or password"); </script> <?php } } ?> i think need if condition inside block code: if (isset($_post["loginbtn"])) { $euser = $_post["emp_username"]; $epassw = $_post["emp_password"]; $check_user = mysql_qu...

linux - Bash escaping (MySQL GRANT ALL PRIVILEGES is failing) -

there bash doesn't like. should escaped , how? mysql --user=root --password=mypass vsftpd << eof grant privileges on `myusername\_%`.* 'myusername'@'%';" eof i following error: -bash: myusername_%: command not found error 1064 (42000) @ line 1: have error in sql syntax; check manual corresponds mysql server version right syntax use near '* 'myusername'@'%'' @ line 1 the backticks command substitution (same $() ). try using single quotes on outer level , double quotes username , hostname: mysql --user=root --password=mypass vsftpd 'grant privileges on `myusername\_%`.* "myusername"@"%";' you can instruct here doc not expand variables quoting delimiter word, i'm not sure if works command substitution too: mysql --user=root --password=mypass vsftpd << 'eof' grant privileges on `myusername\_%`.* 'myusername'@'%';" eof

algorithm - Place connected boxes on a 2D plane -

given n rectangular boxes , m connections between them, want place them on plane efficiently such total sum of length of connections remains minimum. the throught process have split plane in grid n or more spaces, , place boxes maximum number of connections farther apart in grid starting diagonally opposite corner spaces. this might not efficient when there 1 box connected n-1 boxes , connections. expect 1 box in center , other boxes around it. is there standard solution such problem? can pointer how approach such problem? it non-linear optimization problem , can solved, instance, using simulated annealing or general objective function minimization such gradient descent methods. given layout of boxes, let l denote sum of lengths of connections given layout. want minimize l. simple simulated annealing scheme works this: layout = random_layout() t = 1.0 while(true) l = sum_of_lengths(layout) layout' = move_one_box(layout) l' = sum_of_lengths(layout) ...

Hide url in a javascript popup in asp.net -

i'm using mozilla firefox , need hide url popup i'm using location=no,directories=no it's still showing <asp:button id="btn_login" runat="server" text="login" width="105px" style="height: 26px" onclientclick = "javascript:window.open('login_page.aspx','name','height=299, width=477,toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,about:blank'); return false;" /> how can fix it? thank you instead of popup can use jquery dialog , besides browser block popup windows these days $('<div></div>').dialog()

scala - Building swagger-codegen on Windows - is it ok to use Git Bash? -

i attempting build swagger-codegen on windows 7 x64. ran problem when had run ./sbt assembly . couldn't see how windows command prompt. instead, ran git-bash. ran successfully, warnings, no errors. is acceptable solution? i ask because stuck on next step running template client petstore. ./bin/scala-petstore.sh produces following error: error: not find or load main class files the official sbt distribution @ scala-sbt.org includes sbt.bat-file works on windows.

iOS UIView transition, don't change the navigationbar -

i have uiviewcontroller edit using ib. put uinavigationbar , uisegmentedcontrol on top , 3 uiviews under them. want able switch between uiviews using animation, want animate uiviews , want navigationbar , athe segmentedcontrol not move. show code how now. any idea how move 3 views? - (ibaction)segmentedcontrolvaluechanged:(id)sender { uisegmentedcontrol* segmentedcontrol = sender; if(lastselectedviewindex != [segmentedcontrol selectedsegmentindex]) { catransition *transition = [catransition animation]; transition.duration = 0.4; transition.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout]; transition.type = kcatransitionmovein; if(lastselectedviewindex < [segmentedcontrol selectedsegmentindex]) transition.subtype = kcatransitionfromleft; else transition.subtype = kcatransitionfromright; transition.removedoncompletion = yes; // force...

php - how to get values from database phpmyadmin and show -

i need values database if click button(get values) how can ? please assist me 1 there way ? this index.php <script type="text/javascript" src="jquery-1.10.1.js"></script> <form> <h1>insert data mysql database</h1> name <input name="name" type="text" id="name"> <br><br> lastname <input name="lastname" type="text" id="lastname"><br><br> email <input name="email" type="text" id="email"><br><br> <input type="button" name="submit" value="submit" onclick="insertdata()"> </form> <button type="button">get values</button> <div id="jcontent"></div> <script type="text/javascript"> /...

Regex matching a string followed by anything but a certain character -

regex match every char following didn't me. i'm trying match momentaneousvehiclespeedkmph= followed 9 in gz file. these don't match: $zgrep "momentaneousvehiclespeedkmph=\[\^9\]" file.gz $zgrep "momentaneousvehiclespeedkmph=\(\^9\)" file.gz $zgrep "momentaneousvehiclespeedkmph=\^\[9\]" file.gz $zgrep "momentaneousvehiclespeedkmph=\^\(9\)" file.gz this does: $zgrep "momentaneousvehiclespeedkmph=\(9\)" file.gz i there're lines in file containing momentaneousvehiclespeedkmph=89 . simply try $zgrep "momentaneousvehiclespeedkmph=[^9]" file.gz if don't want match single 9 . /edit if need speeds 2 digits , more, try: momentaneousvehiclespeedkmph=([0-8]|[0-9]{2,})\b

javascript - JQuery Remove all links inside a <div> that have a particular class except for the one that's clicked -

in jquery, how can remove/disable or change class of links inside <div> have particular class except 1 clicked? clicked one's class needs changed. <div class="test"> <div class="link" data-id="1">link 1</div> <div class="link" data-id="2">link 2</div> <div class="link" data-id="3">link 3</div> </div> in case, if clicked link 1 , i'm trying make link 2 , link 3 disappear or change class, , change class of link 1 nolink . how can done. i'm familiar add class, remove class, i'm stuck getting others removed or changed , change clicked 1 class. something this? $('.test div').on('click', function () { $(this).removeclass('link') .addclass('nolink') .siblings('.link') .remove(); }); demo

mysql "IN" condition with subquery -

i need execute following: select * mp_sizes size_id in(select size_ids mp_size_categories category_id = '3' , sub_category_id = '5'); when run below query return me 3 records. select * mp_sizes size_id in(3,2,4); also when run sub query showing me correct result. select size_ids mp_size_categories category_id = '3' , sub_category_id = '5'; the above query gives result 3, 2, 4 . but when use in sub query returns 1 record. return size details of first value (3) only. how can results of 3 sizes (3, 2, 4)? have tried using join ? (which faster) select * mp_sizes, mp_size_categories size_id = size_ids , category_id = '3' , sub_category_id = '5';

Chaining selects with Chosen -

i'm trying chain selects chosen , chained i'm not sure if i'm implementing .chosen().change() correctly or if error i'm getting bug. here's i've got: <select id="inputfield_date" name="date" data-placeholder="select event date"> <option value=""></option> <option value="wa">wa</option> <option value="qld">qld</option> <option value="vic">vic</option> <option value="nsw">nsw</option> <option value="sa">sa</option> </select> <select id="inputfield_code" name="code" data-placeholder="response code"> <option value=""></option> <option value="601" class="wa">601</option> <option value="602" class="wa">602</option> <option value="402" class="qld...

android - Cube Animation with only two Images in an ImageView -

Image
i need show image on imageview & onclick of image , wanna show image on imageview cube-like transition animation shown in below figure "ontouch" . i have been searching examples on site , intended activity .i need implement imageview . presently using viewflipper 2 images , trying implement it, <viewflipper android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/a" android:layout_weight="1"> <imageview android:contentdescription="@string/action_settings" android:id="@+id/alphaa" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/a"/> <imageview android:contentdescription="@string/action_settings" android:id="@+id/imga" android:layout_width="match_parent" android:layout_height="...

Counting Date Backwards in C# -

this question has answer here: how previous month date in asp.net 4 answers can please show me how decrement datetime month? example, today august 2013, count july 2013, june 2013, may 2013, april 2013 on , forth. , also, year must change when month reach january going december. counting datetime backwards. help! you can use addmonths : months: number of months. months parameter can negative or positive. the usage like: var updatedtime = yourdatetime.addmonths(-1); note calling addmonths returns new instance. numbers.

Where to find NVidia Debug Manager for Android/Eclipse NDK Plugin -

this answered year or ago here: nvidia debug manager android ndk eclipse plugin i stuck @ help/install new software. can't find archive supposed contain nvdebugmgr plugin. when downloaded nvidia's tegra android development pack isn't in there. thing in archive tadp-2.0-r5-osx.app. i trying install according these instructions: http://developer.download.nvidia.com/tegra/docs/nvdebugmgrforandroidndk-installguide_20110228.pdf . can't find nvdebugmgrforandroidndk_900.zip anywhere , it's not in tadp described in previous answer. download tegra android development pack from: https://developer.nvidia.com/tegra-android-development-pack then, while installing pack, choose custom installation installation options , select nvidia debug manager android install in select components screen. see required zip file in installation directory after download finished.

asp.net - Header Style Of Gridview not visible in Internet Explorer -

<asp:gridview id="gvschedulehistory" runat="server" width="100%" autogeneratecolumns="false" showfooter="false" > <headerstyle backcolor="#eeeeee" verticalalign="middle" horizontalalign="center" height="30px" cssclass="search" /> <rowstyle cssclass="gridview_row" /> <pagerstyle horizontalalign="right" borderstyle="solid" /> <columns> <asp:boundfield datafield="effectivedate" headertext="effective date" controlstyle-width="20%" headerstyle-width="20%" itemstyle-width="20%" /> <headerstyle backcolor="#eeeeee" verticalalign="middle" horizontalalign="center" height="30px" cssclass="search" /> </asp:gridview> and css .search { font-family: arial, helvetica, sans-serif; font-size: 12px...

spring - release db connections in standalone application -

i working on standalone application using spring/jpa , trying release database resources used. in web application using tomcat example, shutdown server, , way, let tomcat manage resources. but in standalone app, have take care this, use runtime.getruntime().addshutdownhook "catch" shutdown event , call ((classpathxmlapplicationcontext) context).close(); , this: runtime.getruntime().addshutdownhook(new thread() { @override public void run() { ((classpathxmlapplicationcontext) context).close(); } it works exception in stacktrace if thread using connection. wondering if there option? maybe getting list of open transactions , force them rollback? i believe need implement this , inside destroy method, retrieve datasource , call close method or similar. i'm assuming have few things when shutdown application. i can't quite right method name don't know using datasource.

java - transfer and cache versioned object file -

problem definition: the project setup uses gwt on client side , spring on server side there object tree of 100 objects. object describes complex config file linked 1 user . object has persisted on server side , can requested client. both client , server can access methods , fields in object. once requested client, object tree cached. object can modified client , server. if file modified server, client downloads new version. should easy add functionality config object i.e. increasing version number , adding objects tree. config file project file saves changes user did make project is. config file altered regularly (every 3 seconds) user. compare example gimp project / powerpoint file. current architecture: the server stores config file in xml format. when config requested, converted java object send server client using requestfactory ( gwt ). client can modify object , changes send server. when client done, server saves new object replacing old xml file. client caches ja...

sql - A connect by query on all children -

is there way have connect prior... start with statement in oracle start first "child" in table , run query remaining children well? know how use statement 1 child , ancestry, need code run lots of different children in table. let's suppose have code returns component , component's color table of components , component's parent , classified "sample" , color component's parent id id of parent component. this schema: components table: component component_id component_parent_id component_label component_color table: component component_color note: example code, not 1 using, if silly errors, sorry. select component, components inner join component_color on (components.component = component_color.component) component_label = 'sample' connect prior component_header.component_parent_id = component_header.component_id start component.component_id = '2000'; table component has lot of different co...

c# - A network-related or instance-specific error occurred while establishing a connection to SQL Server. Error Locating Server/Instance Specified) -

Image
moving web project test enviroment web server made error occur whenever tehre's attempt open connection sql server. we can insert , read data sql server management studio. we're suspecting error created bad connection string or sql server using integrated security, haven't been able confirm that. the connection string. <connectionstrings> <add name="dsvushort" connectionstring="data source=localhost\sqlexpress;database=ns_survey; integrated security=true;multipleactiveresultsets=true;app=entityframework" /> </connectionstrings> where used sqlconnection connection = new sqlconnection(configurationmanager.connectionstrings["dsvushort"].tostring()); connection.open() // pops error causes error connectionstring in webconfig set connectionstring in webconfig. name of connectionstrin in webconfig , code behind must same. in web.config: <configuration> <connectionstrings> <add name=...

selecting all checkboxes in jquery -

i want select checkboxes of specific name checking single checkbox on page , trigger subsequent events. as have @ moment doesnt seem fire immediately, upon first checking of 'select all' checkbox checkboxes not selected , unchecking 'select all' check box checkboxes checked. seems bit upside down. how can improve following code works properly? $(document).on("click", "input[name='chkallbs']", function () { if ($('input[name = chkbestseller]').prop('checked') == false) { $('input[name=chkbestseller]').attr("checked", "true"); $('input[name=chkbestseller]').trigger('click'); } else { $('input[name=chkbestseller]').attr("checked", "false"); $('input[name=chkbestseller]').trigger('click'); } it like if ($('input[name = chkbestseller]').prop('checked') == true) { $('input[name=chkb...

php - Post facebook event on group wall -

i'm trying post event on group wall- try { $ret_obj = $facebook->api($groupid.'/feed', 'post', array( 'link' => 'https://www.facebook.com/events/event_id/')); } catch(facebookapiexception $e) { } this code post event doesn't appear on group . show name of event,but doesnt show picture,details , more... ps: work on page wall , have chech group permissions tell me wrong,is facebook issue ?? facebook might not able fetch details link; can manually set other parameters- array( 'lik' => 'https://www.facebook.com/events/event_id/', 'picture' => picture_url, 'description' => desc, 'caption' => caption ));

openedge - Progress 4GL queries -

i new language , having problems understand queries. for example: there 2 database tables: warehouse, product. each warehouse can have multiple products , products can stored in different warehouses. query: each warehouse, each product: display warehouse.name, product.prodcode. end. the display warehousename productcode awarehouse ska-301 so result, these columns display total independent result, eg. ska-301 product may not in awarehouse. or display product in awarehouse? if product , warehouse don't have related fields? please me. thank you. in code have shown each product every iteration of warehouse. to products specific particular warehouse need add criteria 2nd clause of join. assuming have product.warehousename field suit purpose.... for each warehouse no-lock, each product no-lock product.warehousename = warehouse.name: display warehouse.name product.prodcode . end. (if there no index on product.warehou...

math - C# Convert mouse position to radians -

i have "small" problem code convert mouse position radiance. i need mouse position determine head of robot must point to. code works , head turns ... but! reaches max of pitch quickly. as not super sharp in radiance calculation or c#, have resort expert help. :) my code: maxcursory = screen.primaryscreen.bounds.height; cursory = cursor.position.y; pitch = (float) (((3 / maxcursory * cursory) - 1.5) * 1); the min , max values need: -0.6720 0.5149 edit: fixed code display error. ;) edit 2: added min , max values so want pick value within min , max based on ratio of cursor y position max screen height? the current calculation pitch gives range -1.5 1.5. for range between -.6720 , .5149 use: 1.1869 * cursory / maxcursory -.672 or, generalized: (rangeend-rangestart)*(cursory / maxcursory) + rangestart edit : assumed knew in case, cursor.position.y treats top of screen 0 , bottom same height. if wanted top of screen have value of .5149 , bo...

jquery - Is there any way to open pdf file inside web app,without using phonegap -

i trying open pdf file inside html5 app without using phonegap, thoughts or ideas guiding light development... have tried pdf.js ? take @ this. solve problem. https://github.com/mozilla/pdf.js/ sample: http://mozilla.github.io/pdf.js/web/viewer.html

Getting a zip file with a java rest client (restEasy) -

everyone. i started use resteasy (jboss) java rest client , met problem cannot seem solve. far, use bring json rest server (string form). 1 of rest service need brings zip file, however. , stumbled on problem. here code : clientrequest req = new clientrequest("rest service url"); //the url clientresponse<string> res = null; res = req.get(string.class); zipinputstream zip = new zipinputstream(new bytearrayinputstream(res.getentity().getbytes())); zipentry zipentry = zip.getnextentry(); system.out.println(zipentry.getname()); //here, print name of first file in archive, so, seem have // zip file indeed string jsonstring = ioutils.tostring(zip); //bam, causing zipexception : invalid block type google told me correct way read zip file. tried read byte byte, too, , throws sams exception on zip.read(). did wrong? should read content of file? i gratefull insight on matter. thanks p.s : sorry if sound strange, english not fi...

vb.net - Changing text in splashscreen -

Image
i have created splashscreen in vb.net , everythings works perfect except fact change loading text multiple texts changes every x seconds during loading. exemple : dim loadingtexts string = {"charging 1...", "charging 2...", "info1..."} i have no idea how can apart fact surely have use timer... how ? actual code: public class frmsplashscreen private stringtable() string = {"shovelling coal server...", "programming flux capacitor...", _ "searching answer live, universe , everything...", "waiting godot...", "starting..."} private stringmove integer = 0 sub new() initializecomponent() end sub public overrides sub processcommand(byval cmd system.enum, byval arg object) mybase.processcommand(cmd, arg) end sub public enum splashscreencommand somecommandid end enum ...

java - Persisting fragment state -

i have frame layout in activity want display different fragments inside. have sliding drawer 3 options, each of lead fragment being loaded inside frame layout. use following accomplish this: fragment nextfragment = determinefragmenttoswitchto(nextfragmenttag); transaction.replace(r.id.fragment_container, nextfragment); the first method determines fragment need evaluating nextfragmenttag string , loading new fragment so: if (fragmenttag.equals(constants.studentpage)) nextfragment = new studentfragment(); else if (fragmenttag.equals(constants.teacherpage)) nextfragment = new teacherfragment(); else if (fragmenttag.equals(constants.parentpage)) nextfragment = new parentfragment(); clearly approach creating new fragment each time , running through whole fragment lifecycle without saving state. if on student page , scrolling through student list , switch parent page, when go student page, reloads entire list (i fetching server) , looses place in it. how can persis...

While looping PHP array HTML table properties are missing after first row? -

i trying show shopping cart array in cart page in html table, after first row html table properties missing. mean after first row data not showing html table. what's wrong in code? <?php if(is_array($_session['cart'])){ ?> <table border = "1"> <tr bgcolor="#ffffff" style="font-weight:bold"> <td>serial</td> <td>name</td> <td>price</td> <td>qty</td> <td>amount</td> <td>options</td> </tr> <?php $max=count($_session['cart']); for($i=0;$i<$max;$i++){ $pid=$_session['cart'][$i]['productid'].' el kit'; $q=$_session['cart'][$i]['quantity']; $amount = $_session['cart'][$i]['amount']; ?> <tr bgcolor="#ffffff"> <td><?php echo $i+1?></td> <td><?php echo $pid?>...

python - Decimal module: rounding -

i have trouble getting desired values. the following 'abc' strings represent angles. 'result' strings represents values i'm looking for. a = '199.1224' result = '199.122400000000000' b = '199.0362' result = '199.036200000000010' c = '-199.9591' result = '-199.959100000000010' i use following code: decimal(float(a)).quantize(decimal('.000000000000001'), rounding=round_half_up) results in = 199.122399999999999 b = 199.036200000000008 c = -199.959100000000007 i'm no math genius, , tried possible in decimal module, can't seem find right way result need. as crappy workaround use: decimal(float(a)).quantize(decimal('.00000000000001'), rounding=round_half_up) str(a)+'0' so quantize 1 less decimal, convert string (have anyway) , add zero. gets me correct desired results thousands of these values. want find out if there correct way round , end 0 (don't know english wor...

windows - VBS WScript fails to execute -

i having issues getting run (or exec) methods work vbs. have been having difficulty getting arbitrary command run have resorted putting command in batch file , trying use run call .bat file. method isn't working. code follows: dim objshell set objshell = createobject("wscript.shell") objshell.run "c:\path\to\my\batch.bat" set objshell = nothing opening command prompt , entering 'c:\path\to\my\batch.bat' runs expect to. when using vbs code above, nothing @ all. command in batch file straight forward consisting of path executable , path file executable act on. changing run command above follows results in same thing trying call batch file - nothing @ all. objshell.run "c:\path\to\my\executable.exe c:\path\to\my\file.extension" my ultimate goal build path file string within script, seems irrelevant when hardcoding fails. appreciated. i able resolve 2 changes. first, added "cmd /c" front of command. this res...

image processing - Extract numbers from poker cards -

i want develop application that, given image of several poker cards, able tell numbers on cards. have never done image-processing before, wonder how should started. thoughts appreciated! a lot depends on how images like. example if images taken mobile cam , have pre-processed before can ocr. i've used tesseract ( https://code.google.com/p/tesseract-ocr/ ) before ocr , works ok printed text. poorly without training on images mobile phone. can 3rd party paid api if dont want go through work yourself. also valuable advice got keep text part in image. (eliminate unnecessary lines/ noise). if text vertical or oriented @ angle, align text region in horizontal direction.

javascript - Window.Print() Div with Overflow-x? -

i want print div has has overflow-x:auto; property (it wraps several page widths). in chrome, page scaled , displays correct. however, in ie (8-10), cuts off div part that's visible on screen. below function: function print() { var printcontent = document.getelementbyid("<%=printable.clientid%>"); var windowurl = 'about:blank'; var uniquename = new date(); var windowname = 'print' + uniquename.gettime(); var printwindow = window.open(windowurl, windowname, 'left=5000,top=5000,width=0,height=0'); printwindow.document.write("<html> "); printwindow.document.write("<head> "); printwindow.document.write("<link type=text/css rel=stylesheet href='/ebusinessstylesnew.css' /> "); printwindow.document.write("</head> "); printwindow.document.write(...

OpenGL anisotropic filtering support, contradictory check results -

when checking if anisotropic filtering supported, contradictory results. if(glewissupported("gl_ext_texture_filter_anisotropic") || glew_ext_texture_filter_anisotropic) { std::cout << "support anisotropic" << std::endl; } glfloat max; glgetfloatv(gl_max_texture_max_anisotropy_ext, &max); std::cout << max << std::endl; the output section on machine is: 16 so seemingly anisotropic filtering of 16 supported, glewissupported glew extension string opposite. is checking gl_max_texture_max_anisotropy_ext enough , glew check wrong, or different going on? apparently there known bug in glew glgetstring(gl_extensions) used in opengl 3+ context instead of glgetstringi replaced extension querying in opengl 3+. so until patched, extension querying must done manually .

search - Python: Find the position in a list of the first object that respect a given condition -

i have list of following kind: class any(object): def __init__(self,a,b): self.a=a self.b=b l=[any(1,3),any(2,4),any(1,2),any(none,6),any('hello',6), any(1,'chucknorris'),any(1,2)] l is list contains instances of any . i'd find position of first of these instances attribute a equals 'none`. as list long, algorithm should not explore whole list should stop condition (in example, attribute a equals none ) found. in above example answer of algorithm should 3. use generator expression , next : next((i i, item in enumerate(l) if item.a none), none) this return none if no such item found. demo: >>> l=[any(1,3),any(2,4),any(1,2),any(none,6),any('hello',6), any(1,'chucknorris'),any(1,2)] >>> next((i i, item in enumerate(l) if item.a none), none) 3

How to write multiple unittests in dart in multiple files? -

i writing dart library , want have unittested. created directory test , want put tests in here. because going have lot of tests, want have them separated multiple files. questions is, dart convention, how that. want have tests run all, however, want able run 1 file of tests. what suggestions? it common separate tests multiple files. including example of how can that. imagine have 2 files tests, foo_test.dart, bar_test.dart contain tests program. foo_test.dart this: library foo_test; import 'package:unittest/unittest.dart'; void main() { test('foo test', () { expect("foo".length, equals(3)); }); } and bar_test.dart this: library bar_test; import 'package:unittest/unittest.dart'; void main() { test('bar test', () { expect("bar".length, equals(3)); }); } you run either file, , test contained in file execute. the, create all_tests.dart file import tests foo_test.dart , bar_test.dart. here...

perl - How to match lines in one file against lines in another? -

i know majorly wrong here, new perl , looking following: find lines in all.css contain lines in unused.css , logic. way code structured, seems cannot match like: if ($linea =~ /$lineu/) #if line in all.css contains line in unused.css since variables being defined separately. how structure program able match lines in all.css against lines in unused.css? my program below: #!/usr/bin/perl use strict; use warnings; open(my $unused_handle,'<', "unused.css") or die $!; open(my $all_handle,'<',"all.css") or die $!; open(my $out, '>' ,'lean.css') or die $!; $lineu = q{}; $linea = q{}; print $out "$lineu"; while($lineu =<$unused_handle>) { print $out "$lineu"; #print $out "$linea"; line 1 not printed while($linea =<$all_handle>) { if ($linea =~ m/$lineu/sxm) { print "huza!\n"; } else { print ...

Return just the value of an xpath - Nokogiri Ruby -

i'm using xpath values on website this auction_page = nokogiri::html open(a, "user-agent" => theagent) auction_links = auction_page.xpath('//iframe[contains(@src, "near")]/@src') which returns need this #<nokogiri::xml::attr:0x3fcd7bef5730 name="src" value="http://thevalue.com"> i want value, not value or else. how do this? i think looking .text method. so auction_links.text should return " http://thevalue.com ". edit: if doesn't work try, auction_links.first return array, i'm sure link inside there. ; ) for further reference, here great tutorial basic nokogiri crawling/parsing .

Can xcode have files shared between projects and edited independently? -

when building ios projects xcode, realize can nightmare share code between projects. let's use following example: let's i'm building several casino apps, lets assume i've built "card" class , "card shuffling" class. these classes can used video poker apps, blackjack apps, etc. i've found if i've built these classes within blackjack project, reuse classes inside video poker app. when building video poker project, copy , paste "card" , "card shuffling" classes blackjack project video poker project. everything going until need tweak classes. let's i'm creating deuces wild video poker , need additional logic in card class display "wild 2's graphics" cards. , go blackjack app project. when view "card" class inside of blackjack app, "wild 2's graphics" logic has been written inside class. there way unlink these files can edit them without them affecting each other? ...

perl - Modify key if it already exists -

i'm writing piece of code creates hoas , loops through each key. snippet below shows basic example of problem i'm having. #!/usr/bin/perl use strict; use warnings; @array1 = qw (1 1 3 4 5); # note '1' appears twice @array2 = qw (a b c d e); @array3 = qw (6 7 8 9 10); @array4 = qw (f g h j); %hash; push @{$hash{$array1[$_]}}, [ $array2[$_], $array3[$_], $array4[$_] ] 0 .. $#array1; $key (sort keys %hash) { ($array2, $array3, $array4) = @{$hash{$key}[-1]}; print "[$key] $array2\t$array3\t$array4\n"; } output: [1] b 7 g [3] c 8 h [4] d 9 [5] e 10 j for data i'm using (as opposed example) have been using key i've realised isn't unique, so, above end overriding non-uniqe keys. i'm using these values keys in order sort them later. my question either: a) can perform above task each key unless (exists $hash{$array1}) in case can modify it or b) there way sort values, in case use another, non-redundan...

html - Single-line input fields align -

i have been searching net, haven't found solution problem. here html code: http://jsfiddle.net/ta7vt/ <p>enter name:<br><input type='text' name='name' size='30'></p> <p>your age:<br><input type='text' name='age' size='10'> years old</p> <p>provide location info:<br> <input type='text' name='street' style='padding-left: 10px' size='50' placeholder='street , house number'><br> <input type='text' name='city' style='padding-left: 10px' size='30' placeholder='city or town'> <input type='text' name='zip' style='padding-left: 10px' size='11' placeholder='zip'></p> neither '11' nor '12' last size attribute make 2 fields' width same first input . i've tried put field div width set 100%, 60% , 40% d...

php - Enable access to module for unauthorized users in Yii's srbac -

i'm trying use hybridauth extension in yii. without srbac extension fine, problem need enable access module unauthorized users using it. i've tried setting property alwaysallowed stated in srbac guide : the operations named [moduleid]/[subdirectory].[contollerid][action] like this: 'alwaysallowed'=>array( //default: array() 'sitelogin','sitelogout','siteindex','siteadmin', 'siteerror', 'sitecontact','hybridauth@controllers.defaultlogin'), (my delimiter @), doesn't work. i've been debugging , seems hybridauth controller (defaultcontroller) not recognized sbasecontroller in function _extendssbasecontroller (modules/srbac/controllers/authitemcontroller.php): if ($cont instanceof sbasecontroller) { return true; } my controller class extending sbasecontroller , works controllers not in module, not this. i've tried directly extend defaultcontroller sbasecon...

php - LIMIT command SQL Server -

this php code: require_once ('configsql.php'); $per_page = 10; if(isset($_get['page'])) { $page = ($_get['page'] - 1); } else { $page = 0; } $querycharacter = mssql_query (" select character.accountid, character.name, character.ctlcode, accountcharacter.number, accountcharacter.id, memb___id, memb_name, memb__pwd2, mail_addr character, accountcharacter, memb_info character.accountid=accountcharacter.id , accountid=memb___id , accountcharacter.id=memb___id limit {$page},{$per_page} "); $rows = mssql_fetch_row($querycharacter); $pages = $rows / $per_page; $pages = $pages ? ((int)$pages == $pages) : ((int)$pages + 1); and error: warning: mssql_query() [function.mssql-query]: message: line 2: incorrect syntax near ','. (severity 15) in c:\xampp\htdocs\pages\editcharacter.php on line 19 warning: mssql_query() [function.mssql-query]: query failed in c...

cleanly adding line breaks to XML comments in visual studio -

is there way add break xml documentation without using br tag? in below example want text in steps node cleanly displayed in output. ex, line breaks present in output ///<summary> unit test </summary> ///<steps> /// 1. /// 2. else /// 3. save ///</steps> if use br tag tag displayed if open xml file in ie. @ least want avoid using sandcastle have minimal display needs. try ///<para>1. something</para> and ///<para/>1. might work, 1-liners anyway. now if want list… ///<list> ///<item>do something</item> ///<item/>experiment see if works ///</list> here nice, concise article on xml comment tags .

asp.net mvc - How do I use razor to make something a link conditionally? -

i have razor view i'm using code looks this: @if(model.islink) { <a href="..."> } text needs appear @if(model.islink) { </a> } this works code doesn't feel clean. there better/more accepted way of accomplishing pattern? here simple method think little cleaner. set text variable @ top of view: @{ var sometext = "some text must appear"; } then output conditionally: @if (model.islink) { <a href='#'>@sometext </a> } else { @sometext } the multi-line if statement above avoids doing string construction html, if want condense syntax down 1 line can this. @html.raw(model.islink?string.format("<a href='#'>{0}</a>",sometext):sometext)

c# selenium internet explorer timeout -

i having timeout issues late selenium test when calling driver.windowhandles. i want increase timeout default of 60 seconds in ie driver. error message; ex = {"the http request remote webdriver server url http://localhost:43196/session/3385234a-4378-419a-9e3a-c59e6b0f7913/window timed out after 60 seconds."} it rather simple increase timespan of requests internetexplorerdriver driver = new internetexplorerdriver(@"c:\path", options, timespan.fromminutes(2));

c# - Get Row with Min Date in LINQ? -

i've got table date/time in , i'd find entire row minimum date. see example: id first last adatetime processed 1 joe smith 09/06/2013 04:00 true 1 joe smith 09/06/2013 02:00 false 2 jack jones 3 john jack 09/05/2013 06:00 true 3 john jack 09/26/2013 02:00 false what want query following: id first last adatetime processed 1 joe smith 09/06/2013 02:00 false 2 jack jones 3 john jack 09/05/2013 06:00 true i have linq statement comes close: var uniqueguys = d in tests.asenumerable() group d d.id g let f = g.firstordefault() f != null select new { f.id, f.first, f.last,...

position - Child image absolutely positioned, w/ dynamic dimensions. Need parent to have dynamic height to match the childs -

i understand can't done css, can done javascript? i need image absolutely positioned because part of slideshow. when remove absolute positioning, each new image displays right of last image was. i've found code online says can div, haven't been able find applying javascript understand height of image. css .slideshowcontainer { border:5px solid #c7eafb; background:#ebebec; padding:0px; margin:0px; width:90%; clear:both; } #slideshow { position:relative; width:100%; height:300px; padding:none; margnin:none; } #slideshow img { position:absolute; top:0; left:0; z-index:8; width:100%; height:auto; padding:none; margin:none; } #slideshow img.active { z-index:10; } #slideshow img.last-active { z-index:9; } html <div class="slideshowcontainer"> <ul id="horizontal-style"> <li><a href=# >home</a></li> <li><a href=# >about us</a></li> ...