Posts

Showing posts from February, 2011

javascript - How do I animate scroll on a mobile webbrowser using jQuery? -

what wan't achieve page scroll position when button pressed. have working on browsers chrome , ie doesn't seem work on mobile browser. this code use: $("#programmamenu").on("click", "div", function(event){ event.preventdefault(); $('html').stop().animate({ scrolltop: $("#"+$(this).attr("rel")).position().top - 120 }, 500, 'swing'); }); the event fire, scrolling doesn't occur. with user vohuman , answer: apparently mobile browsers scroll body element , desktop browsers scroll html element. therefor, solution question selecting both elements 'html' , 'body' so: $("#programmamenu").on("click", "div", function(event){ event.preventdefault(); $('html, body').stop().animate({ scrolltop: $("#"+$(this).attr("rel")).position().top - 120 }, 500, 'sw...

javascript - JS jquery date calendar which displays localized date but sends ISO to the server? -

i'm looking simple jquery js date calendar gracefully degrade html5 date fields. on latest versions of chrome, type=date field renders calendar localized current browser language. field value set iso date. value sent server iso date. , when field renders, displays localized date iso value. i same behavivor firefox/ie9 or >. there out-of-the-box working jquery/pure js component that? thanks.

java - Convert a FileObject into a File -

i'm using apache commons vfs2 (virtual file system) monitor change file in directory. org.apache.commons.vfs2.filelistener return org.apache.commons.vfs2.fileobject . how convert org.apache.commons.vfs2.fileobject java.io.file you can use new file(fileobject.getname().getpath()); note vfs file object not necesarrily references real file, can reference file within zip file example. depends on resolver used obtain file object.

javascript - Switch/case usage for selected value in selectbox -

i have selectbox couple of options in it. when option selected, javascript code gets value of selected option , has change font of text accordingly. i figured use switch-case statement because have multiple options, doesn't seem work, nothing changes. javascript function font() { var sf = document.getelementbyid('box').value; var generate = document.getelementbyid('generate'); switch (sf) { case 'timesnewroman': generate.style.fontfamily('times new roman') break; case 'georgia': generate.style.fontfamily('georgia') break; case 'palatinolinotype': generate.style.fontfamily('palatino linotype') break; default: generate.style.fontfamily('arial') } } html <select id="box" onchange="font();"> <option id="tnr" value="timesnew...

javascript - Is it possible to have integer array in jquery -

i have toothsequence array contains integer type values whenever want compare element or add integer have parseint shown parseint(toothsequence[i]) + 1 var toothsequence = $("#hndbridge").val().split("|"); (i = 1; <= toothsequence.length; i++) { if (parseint(toothsequence[i]) + 1 == parseint(toothsequence[i + 1])) { is possible make integer array in jquery? if not please suggest me you this: var toothsequence = $("#hndbridge").val().split("|").map(function(e) { return +e; }); +e convert e number. --for old browser array doesn't have map method, use $.map instead-- var toothsequence = $.map($("#hndbridge").val().split("|"), function(e) { return +e; });

c# - Apply templates styles on view-models in WPF -

i'm working on wpf application, application contains designer shows vertical listview of different elements (shapes). i created view-model designer, , view-model each shape. bind view of designer view-model, used "datacontext" property. but problem defined view-styles (templates) of shapes in 1 xaml file, don't know how bind them view-models !! i found in internet : var resourcedictionary = new resourcedictionary() { source = new uri("symboltemplates.xaml", urikind.relative) }; style template = resourcedictionary["sms"] style; so put in view-model constructors, have feild "template" ?? to make things more clear: 1)here designer view : <grid sizechanged="grid_sizechanged"> <listview x:name="shapesviewer" borderthickness="0" background="yellowgreen" itemssource="{binding childrenlist}"> <listview.layouttransform> ...

javascript - Kendo UI Uploader: Angular directive doesn't post files -

i working angular , kendo together, , i'm trying implement upload widget using angular-kendo directives written kendo labs. i have controller, called "editworkspace". in controller defined kendo-upload directive's options as $scope.uploadoptions the callback functions uploader defined inside controller. documentation, led believe directive expects. these options used across multiple elements. don't seem have problem until try post files server, @ point arrays empty ($_post, $_files, $_get, $_request, etc) know because dumped arrays out see in them. i've tried switching configuration own directive in invoke $(element).kendoupload() but same result. files inside form fine , send message off server, post empty arrays. has had similar experience either kendo or angular , can shed light on it? post kinds of code don't think explain.

string - PHP count lines in a table -

the code use display string inside table (this part of row in bigger table): <tr> <td> </td> <td colspan="6"> <b>some data:</b> <br> <?php echo $proceedings; // need know how many lines take up. //max 28 lines ?> </td> $proceedings can size , may contain newline characters (which make easy) of time contain no newline characters. need know how many lines string takes in table. table same width (height automatically adjust). some information; predecessor (this not code) decided make web page later print pdf. pdf needs contain lot of data, on bottom of every page (a4 format) needs have digital signature, decided count number of lines information takes , see if exceeds maximum number of lines on a4, if put in signature , continue on next page (or in case underneath signature). i know there must other ways create pdf file nice layout however, php skills aren't starting on take more tim...

opensocial - What is the JSON syntax to add tags to a statusupdate in IBM Connections? -

i want post (programmatically) statusupdate activitystream in ibm connections (4.0). looking correct place put json "tags":[{"objecttype":"tag","displayname":"ibms"}], i have tried this: { "actor": { "id": "@me" }, "verb": "post", "title": "${share}", "content":"this event <i>second entry</i> #ibms", "updated": "2013-01-01t12:00:00.000z", "object": { "summary": "first entry details #ibms", "tags":[{"objecttype":"tag","displayname":"ibms"}], "objecttype": "note", "id": "objectid5", "displayname": "first entry", } } and entry posted succesfully, tags not there, looking sample correctly posts note activitystream containing tags i don't think...

ios - how to avoid delay when adding more than one button to scrollview in iPhone? -

i need add more 1 button (its depend upon array count) uiscrollview.now using following code.this code working more time ( delay adding button) taking function.please me.. (int i=0; i< [imagearray count]; i++) { nsurl *url = [nsurl urlwithstring:[[imgarray objectatindex:i]objectforkey:@"url"]]; uiimage *img = [uiimage imagewithdata:[nsdata datawithcontentsofurl:url]]; uibutton *button1 = [uibutton buttonwithtype:uibuttontypecustom]; button1.frame = cgrectmake(xp, 0, 75, 75); [button1 setimage:img forstate:uicontrolstatenormal]; [button1 addtarget:self action:@selector(buttonclicked:) forcontrolevents:uicontroleventtouchupinside]; button1.layer.bordercolor = [uicolor whitecolor].cgcolor; button1.layer.borderwidth = 2.0; [mscrollview addsubview:button1]; xp += button1.frame.size.width+15; } because loading image server blocks main thread till image load completely. try loading image in different thread below example...

Android : Get previous fragment name to do nothing in onCreate -

i have detected bug in app today : when user clic on item in listview, launch new fragment details item. when user in fragment, if change orientation of device, oncreate method of first class (which fetch listview) called, , app crashed. i know if it's possible name of previous fragment, in order add test following in oncreate method : if (!fragmentname.equals("common")){ log.d("info", "do nothing in case, because user in detail fragment before !"), } else { super.oncreate(savedinstancestate); refreshlist(true); } i don't think possible name of previous fragment creating new instance of fragment object. if right in trying need somehow store object displaying data when fragment recreated can retrieve required object. 1 way keep id or unique property of object in sharedpreferences , reacquire data when reloads singleton somewhere. basically may need change way retrieve data or pass original opening frag...

javascript - jquery next() function not working correctly -

i have css animation 2 things, 1 adds opacity , 2 creates slideup animation when user hovers on specified area. having issue adding , removing opacity. not sure have gone wrong. below snippet of code. html <body id="body" class="preload"> <div class="box"> <div class="trigger">hhh</div> <div class="overlay animated"> <h1>box 1</h1> </div> </div> <div class="box"> <div class="trigger">hhh</div> <div class="overlay animated"> <h1>box 1</h1> </div> </div> js <script type="text/javascript"> $("window").load(function(){ $("#body").removeclass("preload"); }); $(".trigger").hover(function(){ va...

Are there still known memory leaks with XML serialization in .NET 4? -

our application leaking memory. did not yet run memory profiler on it. found plenty of blog posts , other leak in clr 2 (.net 2, .net 3.5). wondering if knows if still issue in clr 4 (.net 4).. (i found on so: are there still known memory leaks xmlserialization in .net 3.5? ) i can confirm xmlserializer still behaving same in older .net versions. way around leak implement small caching mechanism described here: xmlserializer performance issue when specifying xmlrootattribute

c# - Mono Linq to XML throwing SIGSEGV -

i have been banging head against wall on 1 , i'm hoping can kind enough give advice might going wrong code below. i've got project i'm developing mono 3.0.7 in monodevelop 4.0.9 on linux , project targeting .net 3.5. i need process xml file want use linq xml make easier work xml file. i'm not having problems generating xml , writing out file. however, when try read things file, mono crashing sigsegv error. for example, i'd try this: //load document xdocument indexfile = xdocument.load(indexfilepath); foreach (xelement acctelement in indexfile.descendants("account")) { acctcls acct = new acctcls(acctelement.attribute("acctid").value); acctslist.add(acct); foreach (xelement regionelement in acctelement.descendants("region")) { regioncls region = new regioncls(regionelement.attribute("region").value); acct.regionslist.add(region); } } i have tried running .net framework , see...

gps - Live Vehicle tracking using J2ee -

i want build project on "live vehicle tracking system" using j2ee.following basic ideas- a website end user can track vehicle(tracking can done on google maps). a gps system embedded in vehicle can send location server. i think of using j2ee.please suggest me whether use or other language. this basic idea.please make correction if necessary. thank you we making sort of application using spring zk framework maven , mysql. have our device vehicle tracking. have application made tests. can guarantee j2ee appropriate solution it. didn't have made example non of sql queries - of them easy generate. have experience in field 7 years , different tools yes that's solution.

c# - Wait for COM Event to complete -

how block ui thread while waiting com event complete. subscribe update event of com signals event has completed. myrdata.onupdate += onupdate; i not own com code , cannot make changes it. i tried autoresetevent blocks ui thread , dont recieve updates com. my answer similar @ericbrown's one, there 1 different point. creating nested message loop msgwaitformultipleobjectsex may lead code reentrancy on same thread (via window message dispatched inner peekmessage/translatemessage/dispatchmessage pattern). @ worst scenario, may end calling same com object method before previous call has returned. i first try using cowaitformultiplehandles cowait_dispatch_calls (but without cowait_dispatch_window_messages ). in case com object provided out-of-proc server, should work. otherwise, should consider putting reentrancy checks in place. i have related question code showing how done c# (i had use cowait_dispatch_window_messages there, otherwise event after wasn...

objective c - The app crashes when audio is playing and the device receives a phone call -

the app crashes when audio playing , device receives phone call. when hang call , return application, blocked. code: nsurl *audiofilelocationurl; nsstring *myaudiostring; myaudiostring = @"my-audio"; audiofilelocationurl = [[nsbundle mainbundle] urlforresource:myaudiostring withextension:@"mp3"]; nserror *error; audioplayer = [[avaudioplayer alloc] initwithcontentsofurl:audiofilelocationurl error:&error]; [audioplayer setnumberofloops:1]; [nstimer scheduledtimerwithtimeinterval:.1 target:self selector:@selector(updatemyprogress) userinfo:nil repeats:yes]; if (error) { nslog(@"%@", [error localizeddescription]); } else { [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayback error:nil]; [[avaudiosession sharedinstance] setactive: yes error: nil]; [audioplayer preparetoplay]; [audioplayer setdelegate:self]; [audioplayer play]...

javascript - How to restrict certain email addresses in RS Forms Pro Joomla -

i use rsformpro contact form in joomla v3.1.x site. for particular reason, need add 3 or 4 email addresses 'not allowed' submit form upon validation. i.e. joe@domain1.com, frank@gmail.com, sue@yahoo.com, deniise@domain2.com how can ? please advice. =============== edited for else looking answer, please see below: answer... for script work have replace below "mytextbox" email textbox exact name. the script added within "script called on form process" area (joomla backend > components > rsform!pro > manage forms > form > properties > php scripts). $array = array('joe@domain1.com','frank@gmail.com','sue@yahoo.com','denise@domain2.com'); foreach($array $arr){ if($_post['form']['mytextbox'] == $arr) $invalid[] = rsformprohelper::getcomponentid('mytextbox'); } so of email addresses see in above array, validate & prompt 'invalid' message.

json - php curl_init() function unable to open stream -

i trying show on web site guild member roster (just table) retrieving data url... http://eu.battle.net/api/wow/guild/pozzo%20dell%27eternit%c3%a0/i%20guardiani?fields=members here code: function curl($url){ $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_sslversion, 3); $data = curl_exec($ch); curl_close($ch); return $data; } $json = curl("http://eu.battle.net/api/wow/guild/pozzo%20dell%27eternit%c3%a0/i%20guardiani?fields=members"); if($json == false) { throw new exception("failed load infomation. check setup options"); } on laptop seems go without problems, when load page on web space curl() function seems not working, giving error: fatal error: uncaught exception 'exception' message 'failed load infomation. check setup options' in /home/mhd-01/www.iguardiani.net/htdocs/wp-content/themes/parabola/warcraft_roster....

go - json decode key types -

i want decode big set of data (static-schema) json file. file contains exclusively numeric data, , keys integers. know how decode json struct containing fields of map[string]int or map[string]float32 using json.unmarshal. have no interest in string keys, i'd need convert them int somehow. so i'd know is: is there way achieve this, .ie getting struct containing fields of map[int]float32 type directly decoding, otherwise how achieve after decoding, in memory efficient manner ? thanks the json format specifies key/value objects string keys. because of this, encoding/json package supports string keys well. the json/encoding documentation states: bool, json booleans float64, json numbers string, json strings []interface{}, json arrays map[string]interface{}, json objects nil json null if want use encoding/json package , move on map[int]float64, can following (works float32 well): package main import ( "fmt" ...

asp.net - Set value to TextBox in UserControl inside placeholder -

i have textbox inside user control. created dinamically user control , load in placeholder. but when tried assign value textbox, raised next below error: object reference not set instance of object this user control: <%@ control language="c#" autoeventwireup="true" codebehind="ivt_formclient.ascx.cs" inherits="evi.sc.web.evi.ivt.sublayouts.ivt_formclient" %> <asp:panel id="pnlcontainer" runat="server"> <asp:textbox id="txtclientnumber" runat="server"></asp:textbox> </asp:panel> the access modifier (in user control): public string txtfirstname { { return txtfirstname.text; } set { txtfirstname.text = value; } } in web form have control reference: <%@ reference control="~/evi/ivt/sublayouts/ivt_formclient.ascx" %> in code behind of user control is: public partial class frm_verifyidentity : system.web.ui.page { ...

R: Assign Variable Names based on a matrix's columns -

i (very) new user r, , trying replicate matlab codes here (prefer r octave @ stage). i have following matrix df : variable value th 100 tw 100 gap 30 i'd able assign variables, based on first column, values in second. basically, th = 100 , tw = 100 , gap = 30 . my end aim able manipulate data in following manner: difference <- th-gap edit: >dput(df) structure(list(s = structure(1:3, .label = c("aa", "bb", "cc" ), class = "factor"), n = c(2, 3, 5)), .names = c("s", "n"), row.names = c(na, -3l), class = "data.frame") you have a data.frame different object entirely matrix . matrix atomic vector dimension attributes wrap matrix . atomic vector matrix can contain data of single type, cannot have character data mixed numeric data. data.frame on other hand type of list, each list element atomic vector of same length (the length gives number of rows, number of elements in list ...

java - Can't access last element of array -

i parsing .csv file, line after line , want values of columns. example .csv file : time;columna;columnb,columnc 27-08-2013 14:43:00; text; too; same here so did store content in bidimensional string array (thanks split()). array made follow : array[0][x] = "time". array[y][x] = "27-08-2013 14:43:00"; they x different columns, name of every column stored on line[0][x]. y different lines, value stored string in it. my problem following, want [x] position of data, when try access last [x] element of array. receive error-message java.lang.arrayindexoutofboundsexception: 17 @ iocontrol.readcsvfile.getposvar(readcsvfile.java:22) @ iocontrol.readcsvfile.<init>(readcsvfile.java:121) @ en.window.main.main(main.java:48) obviously i'm reading far, how? here code : //retrieves x position of variable var given parameter. private int getposvar(string[][] index, string var) { int x = 0; boolean cond = false; while((index[0][...

html5 - iOS Safari detect when user clicks "Done" in native player -

i trying open new tab in safari iphone mobile browser (ios 7) when user clicks "done" button in native video player. action flow: user plays html5 video (clicks play icon) mobile safari opens fullscreen player 3 user clicks done i tried various approaches , none of these events working. ended webkitendfullscreen pause any ideas on on may suitable solution? if want check out work have done far here code , jsfiddle link: http://jsfiddle.net/r8bre/ <script> var myvideo = document.getelementbyid("nvideo"); myvideo.addeventlistener("pause", function() { window.open("http://www.google.com", "_blank"); window.focus(); }, false); myvideo.addeventlistener('webkitendfullscreen', function() { window.open("http://www.google.com", "_blank"); window.focus(); }, false); </script> i banged head on quite few hours today. initi...

ios - How to validate fractional number -

i trying write function returns boolean value if given string in valid fractional format or not. e. g. fraction numbers follows 2/3, 1 2/3, 6/5, 80/20, 60 1/4, etc. -(bool)validatefraction:(nsstring *)string { if(string valid fraction) return yes; else return no; } you can use regular expressions that: -(bool)validatefraction:(nsstring *)string{ nsstring *fractionregex = @"\\d+(/\\d+)?"; nspredicate *fractiontest = [nspredicate predicatewithformat:@"self matches %@", fractionregex]; return [fractiontest evaluatewithobject:string]; } p.s. not also, that function not validate against division 0 , not allow fraction have sign (+ or -) @ front

Spring: DTO and service layer -

i'm using current layer topology: 1) dao 2) service 3) controllers(presentation) in 1 of controllers i'm receiving following call (from clients): public playerstatisticsdto getplayerstatistics(int playerid); the controller should delegate call service layer. problem is, if create method like: public playerstatisticsdto getplayerstatistics(int playerid); in service i'm making service layer aware of dto object! i believe bad practice (or not?) so other alternative came creating new class: public class playerstatistics {...} and calling in controller: playerstatistics stats = this.service.getplayerstatistics(playerid); return todto(stats); the problem solution dont have use class @ in project seems unnecessary duplicated code if there 1 on 1 mapping between data requested , being presented, using dto object in presentation layer not bad practice. if change presentation layer @ later stage, can create new pojo containing presentation att...

c# - Why is this Regex not working on MVC unobtrusive validator? -

Image
i have folowing regex on mvc view model (p.s. other regex`es work fine) [required, maxlength(256)] [regularexpression(@"/(\[brand name\])/i", errormessage = "reply message <strong> must</strong> contain <strong>[brand name]</strong>")] public string replymessage { get; set; } unless i'm misunderstanding need, regex should be: .*(\[brand name\]).* or in other words, character before , after, must contain "[brand name]".

jquery - A potentially dangerous Request.Path value was detected from the client (&) on button click -

Image
i have redirect controller action on button click, i'm getting error `a potentially dangerous request.path value detected client (&).` here code: views/_layout.cshtml <body> <div id="wrapper"> <div id="tab1"> <div class="tab2"> <div id="test2" class="officebar"> <ul> <li class="current"><a href="#" rel="home">main</a> <ul> // ..other button code.. <li><span>logout</span> <div class="button"> <a href="#" id="logout" title="logout"> <div class="logout"> ...

c# - How to read YML feeds - or ignore DOCType if read as XML -

ok hope isn t confusing here goes. we have been provided feed russian retailer in yml format need read , enter database. haven t used yml before , honest don't understand or how differs xml (which prefer using unfortunately retailer won t supply in format). have tried google how read yml file , come across yaml file have been supplied not like. so have not had luck finding yml have downloaded xml , tried read following line added: <!doctype yml_catalog system "shops.dtd"> and because of cannot read nodes - have manually deleted line , can read nodes want to. here snippet of file: before download: <yml_catalog date="2013-08-28 14:50"> <shop> <name>domprom.ru</name> <company>domprom.ru</company> <url>http://www.domprom.ru</url> <currencies> <currency id="rub" rate="1"/> <currency id="usd" rate="33.4"/> <currency id="eur" ...

c++ - Remove delete/delete[] -

i'm trying remove delete , delete[] of old application , use smart pointers instead. in following code snippet, want remove last cicle. std::unique_ptr<mapifiledesc> filedesc(new mapifiledesc[numfiles]); (int = 0; < numfiles; ++i) { // works i've delete[] @ end filedesc[i].lpszpathname = new char[max_path]; // not work. each iteration previous array deleted // happens shared_array boost::scoped_array<char> pathname(new char[max_path]); filedesc[i].lpszpathname = pathname.get(); } // want remove following cicle (int = 0; < numfiles; ++i) { delete [] filedesc[i].lpszpathname; filedesc[i].lpszpathname = nullptr; } what think best approach situation: use wrapper object keep track of arrays created , delete them in destructor or use vector of boost::shared_array , assign them each of elements? std::vector<boost::shared_array<char> > objs; (int = 0; < 10; ++i) { objs.push_back(boost::shared_array<ch...

html - First-child pseudo-class in css 2.1 -

i don't know put pseudo class in definition: #recently_played_grid li img { margin-left: 10px; } i want set margin-left 0px in first child of list. should do: #recently_played_grid li:first-child img ? it doesn't seem work if looking have all images in first li item code should work fine. if looking have margin on first img child of every li you'll have change to #recently_played_grid li img:first-child <ul> <li> <img /> << selects this, , <img /> <img /> </li> <li> <img /> << selects this, , <img /> <img /> </li> <li> <img /> << selects <img /> <img /> </li> </ul> if want first img in first li should change to #recently_played_grid li:first-child img:first-child ...

java - Tomcat7 Spring Maven Mysql have different Class objects for the type avax/el/ExpressionFactory; -

i use tomcat7, hibernate, spring , maven, , want use jsf. after few days, can't find issue problem. when compile project have error: aug 27, 2013 8:16:32 pm com.sun.faces.spi.injectionproviderfactory createinstance info: jsf1048: postconstruct/predestroy annotations present. managedbeans methods marked these annotations have said annotations processed. aug 27, 2013 8:16:33 pm com.sun.faces.config.configurelistener$webconfigresourcemonitor$monitor <init> info: monitoring jndi:/localhost/javaserverfaces/web-inf/faces-config.xml modifications aug 27, 2013 8:16:33 pm com.sun.faces.config.configurelistener contextinitialized severe: critical error during deployment: java.lang.linkageerror: loader constraint violation: when resolving interface method "javax.servlet.jsp.jspapplicationcontext.getexpressionfactory()ljavax/el/expressionfactory;" class loader (instance of org/apache/catalina/loader/webappclassloader) of current class, com/sun/faces/config/configurelis...

php - Multidimensional Array - foreach, within a foreach -

i have multi dimensional array printing out how want it, however, have become stuck on figuring out how can construct each loop i'm looking for. please note : $handle field client entered in backend. <?php $gp = mage::getstoreconfig('social_code/social_group/google_field'); $ld = mage::getstoreconfig('social_code/social_group/linkedin_field'); $tw = mage::getstoreconfig('social_code/social_group/twitter_field'); $fb = mage::getstoreconfig('social_code/social_group/facebook_field'); $social_array = array( "facebook" => array( 'class' => "facebook", 'url' => 'https://www.facebook.com/', 'handle' => $fb ), "twitter" => array( 'class' => "twitter", 'url' => 'https://www.twitter.com/', 'handle' => $tw ), "linked-in" => array( ...

php - Can i store mysql result in apc cache ? -

consider sample code : $storyid = 1; $detailscache = 'details'.$storyid; if(!apc_exists($detailscache)){ $phases_details = <<<sql select stp.stp_id, stp.stp_name, stp.stp_position, story_phase stp stp.stp_stl_id = $storyid sql; $resultdetails = helpers::execute_query($phases_details,"get phase details failed."); **// cant cache result here apc_store($detailscache, $phases_details);** } $result_phases_details = apc_fetch($detailscache); while($row = mysql_fetch_assoc($result_phases_details)){ // logic } any better way cache result ? assuming mysql result resource (which seems based on later use of mysql_fetch_assoc), cannot stored via apc. however, if read out result php data structures first, can store in apc later retrieval. $resultdetails = helpers::execute_query($phases_details,"get phase details failed."); $results = array(); whi...

php - How to style data from mysql database? -

i got php code display comments database: <?php $con = mysql_connect("localhost","root",""); if (!$con){ die("cannot connect: " . mysql_error()); } mysql_select_db("strek", $con); $sql="select * comments"; $result=mysql_query($sql, $con); while($row=mysql_fetch_array($result)){ $name=$row['name']; $comment=$row['comment']; echo $name. "<br>" .$comment; echo"<br>"; } ?> i'd both name , comment aligned in center , i'd name bold. please me how that. "i'd both name , comment aligned in center , i'd name bold. please me how that." since op has double quotes in echo $name. "<br>" .$comment; in think working , needs have centered , in bold, use of code below valid. consider following: echo "<div align='center'><b>" . $name. "<br>...

python - Requesting a robust regex that checks if an img tag contains the alt element in a HTML document -

i'm writing python script check html documents img tags. should check alt="" present inside of img tag. print out line number. the regex have factor in different order of contents. eg: <img class="" alt="" src=""> <img class="" src=""> <img src="" class=""> <img src=""> so yes, summerise. regex check of elements of img tag present must account range of possible arrangements thank you using regexes evaluation html bit risky, if you're willing accept shortcomings*, work using positive lookahead assertions : regex = re.compile(r'<img (?=[^>]*\balt=")(?=[^>]*\bsrc=")(?=[^>]*\bclass=")') will match if current string contains <img that's followed (within same tag) alt=" , src=" , class=" , in order. explanation: <img # match '<img' (?= # assert it's possible...

c# - ASP.NET button on a web control has click event, but isn't recognized by control -

for old asp.net project working on, have user control button... <%@ control language="c#" autoeventwireup="true" codebehind="mycontrol.ascx.cs" inherits="mynamespace.mycontrol" targetschema="http://schemas.microsoft.com/intellisense/ie5" %> <!-- snip: unrelated html tags... --> <asp:button id="btsubmit" onclick="btsubmit_click" runat="server" style="font-weight: bold; color: black" tabindex="32" text="view"></asp:button> since upgrading .net 4.0, whatever platform try run on, following error: compiler error message: cs1061: 'asp.mycontrol_ascx' not contain definition 'btsubmit_click' , no extension method 'btsubmit_click' accepting first argument of type 'asp.mycontrol_ascx' found (are missing using directive or assembly reference?) ...yet in code behind: // class defined partial, between mycontrol.ascx.cs ...

c - How do you indicate errors in handling messages in window procedures? -

i'm authoring library handle information raw input api , i'm handling cascading functions . has resulted in several, small, readable, , focused functions. but, has hit me don't understand how properly indicate failure windows. have function: /* oninput: handle data received windows via `wm_input` message. */ static lresult callback oninput(hwnd hwnd, uint msg, wparam wparam, lparam lparam) { bool dispatchrawinput(const prawinput); assert(msg == wm_input); return defwindowproc(hwnd, msg, wparam, lparam); } and returns 0 as documentation states should ; assumes success. the actual text states: "if application processes message, should return zero." but do if can't handle it? assumed you'd call defwindowproc , leave @ doesn't signal windows happened. the message wm_create seems instance can find returns other zero: "if application processes message, should return 0 continue creation of window. if applicati...

formula - Range between numbers - Pentaho Report Designer -

Image
i'm attempting conditional formatting on column contains percentages using pentaho report designer (3.91). have 3 condition format gradually changes color of cell red yellow green unable figure out how so. alternatively have tried create formula expression through formula editor (structure-->style-->bg-color) defines ranges every 5% increase 50% i'm unable formula function correctly. appreciate suggestions. code below , not receive errors in formula editor formula not function correctly. =if([percentage_used]= "0%" <= "5%";"#ffffff"; [percentage_used]>= "5%" <= "10.00%";"#ff0000"; [percentage_used]>= "10.00%" <= "15.00%";"#ff4500"; [percentage_used]>= "15.00%" <= "20.00%";"#ffa500"; [percentage_used]>= "20.00%" <= "25.00%";"#ffd700"; [percentage_used]>= "25.00%" <= "...

html - JavaScript @media print stylesheet not working -

i have started trying make simple html , css webpages while incorporating bit of javascript. i'm trying make simple print button doesn't show when print it. i've searched around sa various answers , i've seen lot of things link media= "print" . in stylesheet class write either display: none or visibility: hidden . apply button. the problem when try doing it, doesn't turn invisible when page preview pops up. here main code: <link rel="stylesheet" href="print.css" type="text/css" media="print" /> <script type = "text/javascript"> function newperson(firstname, lastname, age, gender, birthmonth, birthdate) { this.firstname = firstname; this.lastname = lastname; this.age = age; this.gender = gender; this.birthmonth = birthmonth; this.birthdate = birthdate; this.birthyear = birthdaycalculate; } function birthdaycalculate() { var date = new date(); var curyear = date.getfullyear() var curmon...

python - Buttons activate on creation, then do not work -

i'm neew language, , i'm lost. from tkinter import * class app: def __init__(self,master): self.var = "" frame = frame(master) frame.pack() self.action = button(frame,text="action",command=self.doaction()) self.action.pack(side=left) def doaction(self): print(self.var) root = tk() app = app(root) root.mainloop() command=self.doaction() call doaction @ time line run (i.e. @ creation). need remove parentheses function isn't called until button calls it: self.action = button(frame,text="action",command=self.doaction) to pass argument (which know @ creation time) function, can use lambda (anonymous function): self.action = button(frame,text="action",command=lambda: self.doaction(x)) this creates new function calls self.doaction(x) . equivalently, can use named function: def button_action(): self.doaction(x) self.action = button(frame,text=...

Javascript - Do something when an element in two arrays are the same? -

i found solution returned array of elements without duplicates: array1 = array1.filter(function(val) { return array2.indexof(val) == -1; }); however, want modify code little bit. instead of being returned array without duplicates, want when there duplicate. problem is, i'm not sure how code works. thing i'm not sure how val gets set, or is. for (var = 0; < json.length; i++) { var item = json[i]; // if json.indexof(val?), } read docs array filter method then. val parameter of callback passed single array items, i.e. json[i] or item in case: for (var = 0; < json.length; i++) { var item = json[i]; if (json.indexof(item) >= 0) { // } }

utf 8 - Spring mvc form not reading some character sequence -

i have implemented basic spring mvc form. now, able read special characters @#$%^&* there few things missing like, if type "..........", reads "?.." or not reading text between < , > characters. googled out find out solution , seems spring mvc default not follow utf-8 pattern. so, appended following code in web.xml <filter> <filter-name>springcharacterencodingfilter</filter-name> <filter-class>org.springframework.web.filter.characterencodingfilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> <init-param> <param-name>forceencoding</param-name> <param-value>true</param-value> </init-param> </filter> i using <meta http-equiv="content-type" content="text/html; charset=utf-8"> in page. also, in server.xml us...

reporting services - Remove sorting arrows from Sorted header in SSRS 2008 -

i have many sorted columns in y report , little arrows causing report become super wide. need columns stay sortable, gotta rid of sorting arrows. ideas? step 1 check padding of each textbox default set 2pt (for left, right, top , bottom). reduce 0pt textboxes (sorted , unsorted). save space. step 2 after reducing padding if report still wide. split header in multiple lines. if header here data split multi lines make space. here data reduce font size of header. step 3 if report still wide try this: create parameters handle sorting . create 2 parameters "sort by" , "sort order". "sort by" handles parameters put interactive sort. "sort order" determines if ascending or descending. can use these parameters sort in detail group or in dataset itself. hth.

c++ - Box2d SetLinearVelocity weird issue -

i trying b2body object follow touch location in constant speed , have problem in "y" axis in body go location on "other half of screen" mirror image...the "x" axis fine though. (i using cocos2d 1.0.0) here code: helloworldlayer.h #import "cocos2d.h" #import "box2d.h" #define ptm_ratio 32.0 @interface helloworldlayer : cclayer { b2world *_world; b2body *_body; ccsprite *_ball; } + (id) scene; @end helloworldlayer.m #import "helloworldlayer.h" #import "cgpointextension.h" static cgpoint location; @implementation helloworldlayer + (id)scene { ccscene *scene = [ccscene node]; helloworldlayer *layer = [helloworldlayer node]; [scene addchild:layer]; return scene; } - (id)init { if ((self=[super init])) { cgsize winsize = [ccdirector shareddirector].winsize; // create sprite , add layer _ball = [ccsprite spritewithfile:@"ball.png" r...

python - some Qframe and other widget just in one *ui files (pyuic4) -

you know can after working in qt designer , converting via pyuic4 command executable program or module , can modify code , merge , build complete program , have serious question: suppose have qmainwindow , qframe , don't want save in separately *ui files , need save in 1 *ui files , it's possible? you can't save 2 forms in 1 .ui file, think can (i did not tried should work): save example 1 qdialog , 1 qmainwindow ( qframe can't stand alone-it needs parent widget) in separate .ui files, convert them via pyuic4 command 2 .py files , join 2 files 1 .py module (copy data 1 - copy class , create instance in __main__ ). that not practical when want change in designer , because you'll need whole procedure again.

winapi - can I call windows api functions (64 bit) when compiling with gcc (gfortran)? -

i'm attempting compile subroutine sendmsg.f90 compiled lf90 32 bit gcc 64 bit. purpose link other 64 bit subroutines compiled gcc. subroutine updatedisplay(winhand,ntps,qcancel,niter) use win32mod implicit none integer winhand, ntps, messnum, niter, qcancel ! sendmessagea windows function ! winhand = handle of window (from isdev code) ! messnum = message number (assigned isdev) ! ntps = number of year iteration on (wparam) ! dum = 0 (lparam) messnum = 1114 qcancel = sendmessagea(carg(winhand),carg(messnum),carg(ntps), carg(niter)) end subroutine we have lahey fortran 7.5 has lf90 compiler , gcc (which uses gfortran) , called lgf (which suppose uses gcc, right?). i'm new windows programming (and fortran). can code compiled gcc call windows api? should use iso_c_binding? should or should try link .obj file created lf90 .o files created gcc? thanks help! update: i'v...