Posts

Showing posts from July, 2013

Android splash Activity does not implement or extend Thread Class -

the splash screen activity works on thread class not extend or implement thread. how thread work inside activity? why activity not extends thread class .you can implements runnable in activity : public class androidrunnable extends activity implements runnable{ thread mythread; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } @override protected void onresume() { // todo auto-generated method stub super.onresume(); } @override protected void onpause() { // todo auto-generated method stub super.onpause(); } @override public void run() { // todo auto-generated method stub } } see example creating splashing screen activity using thread: android tutorial: how make basic splash screen

mongodb - How do you hookup a mongo db for JEE6 project? -

i'm trying use mongo db in replace of current apache derby database. how connect mongo db this? mongo has java driver, , examples on how use it. @ this tutorial. in addition, recommend define data access layer dao interfaces have loose coupling between data access code , business logic code, if need replace again db, replace dal implementation , not touch bll code

jQuery: on scroll, DIV always at the bottom right of whatever is viewable -

i'm trying determine best way make sure specific div 20px bottom , 20px right, once user scrolls. <body> <div id="wrap"> <p>some content</p> </div> <div class="social-badges"><!-- box @ bottom right --></div> </body> $(window).scroll(function() { console.log('scrolling'); $(".tba-social-slider").css({"position" : "absolute", "bottom" : "20px", "right" : "20px"}); }); css position fixed should trick: .tba-social-slider{ position: fixed; bottom: 20px; right: 20px; } no javascript needed imo.

jQuery if hash has an appended value -

simple logic here, don't know how can separate value hash returned window.location.hash . .split('=')[0] , removing before instead of after it. some potential hashes: /#work /#work=video1 i'd say: var hash = window.location.hash, val = hash.split('=')[0]; if (val != ''){ stuff because there value i.e. once split, value } else { other stuff because there value i.e. once split, value nothing } var hash = window.location.hash, val = hash.substr( hash.indexof('=') + 1 ); if(val.length) { // val // } else { // else }

javascript - Odd div overflow in Chrome -

for reason, in chrome, when refresh portfolio page thumbnails break , move down footer. the way can replicate refreshing page. very weird.. js issue? before: http://cl.ly/463x3d0y1d1k3535162c after refresh: http://cl.ly/3y3q1a2u3n373s0r210s live site: http://atavist.baltimoredrew.com/?post_type=portfolio it looks applying height article elements inside #portfolio. my guess 'equal height' code you've got going running before images have loaded aren't getting accurate heights. try making sure page ready (images loaded, dom ready, etc..) before implementing equal height bit. hope helps.

html - How to force div element to keep its contents inside container -

i making css menu. using ul. when make li float left lis gets outside of ul. mean height of ul become zero. how can make li display inside ul after giving float left. one way make div tag common class , add clear: both in css not want this. need better solution. please just add overflow: auto; <ul> . make text doesn't leak outside of ul. see: http://jsfiddle.net/6ckag/ however, depending on you're doing, might easier make <li> display: inline; . totally depends on you're doing! see: http://jsfiddle.net/k7wqx/

string - Longest Common Subsequence in Ocaml -

does know how find longest common subsequence of set of strings in ocaml language? look @ other questions tagged "lcs", longest common subsequence of 3+ strings . should able write code in ocaml.

android - Soap response Parsing -

i have copied soap response getting on browser, how can parse response in android using soap? have used soapobject obj = (soapobject)mysoapenvelop.getresponse(); getting obj.getpropertycount() = 1 . i confused @ point can 1 me come out ??? here complete response : true <data> <xs:schema id="newdataset" > <xs:element name="newdataset" msdata:isdataset="true" msdata:locale="" > <xs:complextype> <xs:choice maxoccurs="unbounded" minoccurs="0" > <xs:element name="table" > <xs:complextype> <xs:sequence> <xs:element name="id" minoccurs=...

mysql - SQL command to show 0 if doesn't exist in the join table -

i'm having problem in sql command. i have table questions, other possible answers questions , other replies users. imagine following example: question 1 : win semi-final? aswners : a) portugal b) spain replies : 10 people voted b) spain, 0 people voted a) portugal select a.answer, count(r.id) total replies r left join answers on a.id = r.id_answer left join questions q on q.id = a.id_question q.id = 1 group r.id_answer my point the select result: spain 10 portugal 0 but can't, don't know how it, because way did, result asnwers replies on replies table. this: spain 10 you have start questions, , left join replies. select a.answer, count(r.id_answer) total questions q join answers on ( a.id_question = q.id ) left join replies r on ( r.id_answer = a.id ) q.id = 1 group a.id, a.answer with current query don't need question : select a.answer, count(r.id_answer) total answers left join replies r on ( r.id_answer = a.id ) a.id_question = ...

permissions - Facebook user locale on "user_denied" facebook app page -

i want display correct user language on facebook app when user denies permissions. how can this? want achieve without using automatic translation process of facebook, need have own translation. what talking here, app on website or canvas/page tab? for latter, signed_request contains user.locale , if user has not authorized app yet. for website app, there no data available if user hasn’t connected app yet (afaik). in case see client sends in accept-language http request header.

jquery - JqPlot : Set a fix height value for the graph area not including y axe labels -

Image
i using jqplot. the graph height depending on height of main container or default jqplot value. my problem if y label long, graph size reduced fit in main container. is possible set fix value graph height not depending on label text length? my need : display same graph height (400px example) not depending on y label text length here image depict problem: only thing comes mind along these lines presented in sample. after call paint plot, call below code current plot's size , adjust accordingly adding size taken surrounding divs (i.e. title & axes). in result whatever set size of chart in css taken graphical part of chart, want it. var w = parseint($(".jqplot-yaxis").width(), 10) + parseint($("#chart").width(), 10); var h = parseint($(".jqplot-title").height(), 10) + parseint($(".jqplot-xaxis").height(), 10) + parseint($("#chart").height(), 10); $("#chart").width(w).height(h); plot.replot()...

List Jquery access -

i creating menu , having problem access element hide menu. grateful if can me out. <ul id="secondary-nav"> <li class="expandable expanded"> <p style="display: none;"> <ul style="display: block;"> <li class="expandable expanded"> <p> <a href="http://www.example.com">link text 1.1</a> </p> <ul style="display: block;"> <li> <li class="current"> <li> <li> <li> </ul> </li> <li class="expandable"> <li class="expandable"> <li class="expandable"> <li class="expandable"> </ul> </li> how access ul element has style tag , change style display "none". unorder list within unorder list. thank much $('ul').filter(function() { return $(this).css('display') == 'block'; // or this.style.display...

objective c - Subclassing NSFontManager doesn't work -

i subclassed nsfontmanager , overrode "modifyfont:(id)sender) changed nsfontmanager class in xib files new class. can see, class initialized, overwritten method never called. though nsfontmanager method works normal. what wrong? #import "gffontmanager.h" @implementation gffontmanager -(id)init{ if (self = [super init]) { //this called nslog(@"gffontmanager init"); } return self; } -(void)modifyfont:(id)sender{ //this never called nslog(@"do something"); [super modifyfont:sender]; } @end ok - here how works: i added following main.c , worked charm! #import <cocoa/cocoa.h> #import "gffontmanager.h" int main(int argc, char *argv[]) { [nsfontmanager setfontmanagerfactory: [gffontmanager class]]; return nsapplicationmain(argc, (const char **) argv); } best regards - gerald

javascript - Blackbird logger - absolutely nothing happens -

this should simple... i thought nice try blackbird logger ( blackbird home page ) following guide on authors page, created directory on server , loaded blackbird.js, blackbird.css, 2 blackbird image files , .html file containing following directory. when access page, alert fires absolutely nothing else happens. blackbird .js , .css files loading , visible in debugger. have gone wrong? (same result on firefox, chrome , ie). <!doctype html> <html lang="en-us"> <head> <title>blackbird test</title> <link rel="stylesheet" type="text/css" href="blackbird.css" /> <script type="text/javascript" src="blackbird.js"></script> <script type="text/javascript"> function func1() { alert("in function, send log messages"); log.debug("hello"); log.debug( 'this debug message' ); ...

iphone - In-App Purchase and App Rejection iOS -

i new in-app purchase feature in ios. i working on ios app in i'll showcasing products along price, , when user wants purchase products can tapping on shopping cart, launch web-view , displays mobile webpage can buy selected product. products tangible , delivered outside app. my question is: do need implement in-app purchase, if user transaction done in mobile web-page? if have implement apple in-app purchase, how know if user has purchased product, inform apple product has been purchased? it depends on type of product selling. if it's tangible good. i.e. plane ticket, or other physical item. can use own payment mechanism. if it's can consumed in app, or otherwise conceivably delivered via apple's iap mechanism must use iap. if don't rejected. to answer questions. 1) if transaction done via web, , none-iap type item described above, cannot use iap. 2) if did have purchased via iap, apple responsible transaction, , take typical 30% off t...

jquery - Mimic Stackoverflow's effect -

is there jquery effect mimic fadeout of background color's fadeout when new comment displays on stackoverflow's response wall, ideally jquery :) vanilla jquery not allow animate color, jquery ui adds ability. $('#foo').animate({ backgroundcolor: "#60ffff" }, 1000); also jquery ui's highlight feature close seem after: $('#bar').effect("highlight", {}, 1000);

php - Update one field so that the order value will be continuous -

in table 1 field "ord" contains order of values particular group. tbl_test , fields group,time,ord,name sample entries id group time ord name ---------------------------------------------------------------- 1 1 1340865990 1 john 2 1 1340865880 2 jos 3 1 1340867830 3 mery 4 1 1340867830 4 bill 5 1 1340867830 5 stiev 6 1 1340867830 6 tom 7 2 1340867830 1 test 8 3 1340867830 2 john if remove set of values group 1 example removed "mery" , "tom" "ord" field must have updated order value remaining items id group time ord name ---------------------------------------------------...

java - How to use global log4j.xml -

i have java library uses log4j. library contains log4j.property file has following contents: log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.target=system.out log4j.appender.stdout.layout=org.apache.log4j.simplelayout log4j.rootlogger=info, stdout the library used application, has own global log4j.xml. i put lines in global log4j.xml: <logger name="com.my.package"> <level value="info"/> </logger> however, none of logs shown in log. what's going wrong here? many thanks. 2 things can think of: the log4j.xml file not on class path. you writing debug messages , logger set info.

PostgreSQL bulk import from CSV failing. ERROR: invalid input syntax for integer: "1990-01-02" -

i importing data csv file postgresql table. the table looks this: create table foo_stats ( td date not null, ins_id integer check (ins_id > 0) not null, df_id integer check (df_id > 0) not null, pc real not null default 0.0, ph real default 0.0 not null, pl real default 0.0 not null, av real default 0.0 not null, cv bigint default 0 not null, avi real default 0.0 not null, cmi bigint default 0 not null, vwp real check (vwp >= 0) not null, atr real no...

Inheriting from generated Protocol Buffer classes -

protocol buffer documentation warns ... you should never add behaviour generated classes inheriting them. break internal mechanisms , not object-oriented practice anyway. source: protocol buffer basics my 2 part question is: what internal mechanisms break? in way not good oo practice anyway? "what goes wrong" going implementation specific. if cited specific implementation , might possible answer, in more general sense: not supported scenario, , implementations not required work correctly or @ if subclass. undefined behaviour, implies. further, protocol buffers not support inheritance, because not target platforms can support it. key thoughts: there may code checks incoming object against list of expected types - if yours isn't there, fail it won't handle fields etc add the whole idea of serializer robustly give serialized; if serialize somederivedclass , there's no way serializer can give back the entire point of library hide...

objective c - ios: gdb p (CGFloat) [[self view] center].x -

how p(print) cgfloat in xcode gdb: gdb p (cgfloat) [[self view] center].x result: unable call function "objc_msgsend" @ 0x184e08c: no return type information available. call function anyway, can cast return type explicitly (e.g. 'print (float) fabs (3.0)') you have cast objective-c method calls when using gdb. gdb p (cgfloat) ((cgpoint)[(uiview *)[self view] center]).x

Eclipse javadoc: The type package-info is already defined -

os: windows 7 x64 eclipse platform: 3.7.2.m20120208 m2e: 1.0.200.20111228-1245 have similar problem in bug . there bunch of package-info.java files in /src , /test folders, have same package. eclipse show error: "the type **package-info** defined" i can delete package-info.java files either in /test or /src avoid problem indication. workaround not comfort since using scm , need delete files time after update. same eclipse platform 4.2.0.i20120608-1400 there few options solve this: move away package-info.java files, , replace them package.html files. only have package-info.java files in src/ tree, same-named packages in test/ tree "overlap" src/ tree. generate javadoc separately src/ , test/ trees, different audiences.

php - This can be deleted -

this question can deleted. well, if there direct link, can use file_get_contents accomplish that, remember make sure not violating copyrights.

jquery - How to get x% height in px? -

i gave 100% height div , want actual height in px. how can find out height of div? with jquery can use this, when container id of div: $(document).ready(function() { alert($('#container').height()); });

ios - Does dismissViewControllerAnimated:completion: retain previous view controllers? -

i having memory leaks , crashes in app , know if due way container view controller switches between view controllers. app should allow user navigate long series of pages. each page laid out viewcontroller in storyboard (each page has number identifier). by time page 14 in app, can see in instruments' activity monitor app takes 600mb of memory (on ipad 3). because each view controllers have uiimageviews big images. i using arc. below code container view controller. can see memory management problem somewhere? @implementation pagenavigator int startingpage = 0; int currentpage = 0; -(void)viewdidappear:(bool)animated{ nslog(@"starting book page %d", startingpage); //do first time app runs if(startingpage != -1){ uiviewcontroller *currentpagevc = [self.storyboard instantiateviewcontrollerwithidentifier:[nsstring stringwithformat:@"%d", startingpage]]; [self presentmodalviewcontroller:currentpagevc animated:yes]; c...

osx - Error trying to exec cc1, gcc only wants to compile for avr? -

i've installed gcc on mac (snow leopard) can compile avr microcontrollers. however, seems preventing me compiling else. i'd build packages astrometry.net, , when run ./configure make following: make -c ./qfits-an stage cflags=" -g -wall -ffinite-math-only -fno-signaling-nans -march=native -o3 -fomit-frame-pointer -dndebug -fpic -winline -d_largefile_source -d_file_offset_bits=64 -d_gnu_source" ldflags=" -g -wall -ffinite-math-only -fno-signaling-nans -march=native -o3 -fomit-frame-pointer -dndebug -fpic -winline" cc="gcc" make -c src stage gcc -g -wall -ffinite-math-only -fno-signaling-nans -march=native -o3 -fomit-frame-pointer -dndebug -fpic -winline -d_largefile_source -d_file_offset_bits=64 -d_gnu_source -c -o anqfits.o anqfits.c gcc: error trying exec 'cc1': execvp: no such file or directory gcc -v gives: using built-in specs. target: avr configured with: ./configure --target=avr --enable-languages=c,c++ --disable-...

Display all comments for a WordPress blog on a single page? -

what need - code perform following: i trying setup wordpress template display comments have been posted blog. how pull comments , have same formatting applied comments under single post? such formatting occurs when comments displayed using comments.php template. note want pull comments blog single page. still want comment pagination instead of having 20 comments under post #1, 20 under post #2, etc. want have 40 show @ 1 time on 1 page. you want use get_comments() function. <?php foreach (get_comments() $comment): ?> <div><?php echo $comment->comment_author; ?> said: "<?php echo $comment->comment_content; ?>".</div> <?php endforeach; ?> see apply_filters() function apply comment output filters specific fields. <?php echo apply_filters('comment_text', $comment->comment_content); ?> edit: for pagination, can use offset , number parameters of get_comments() arguments: <?php $args =...

python - create permenant unique links based on a user ID -

possible duplicate: create unique profile page each user python i using google appengine python , jinja2 , trying give each user in app unique url profile page can visited without logging in. here code far: class profilepage(webapp2.requesthandler): def get(self, profile_id): user = user.get_by_id(profile_id) #profile_id = unique field if user: #get posts user , render.... theid = user.theid personalposts = db.gqlquery("select * post theid =:1 order created desc limit 30", theid) else: personalposts = none global visits logout = users.create_logout_url(self.request.uri) currentuser = users.get_current_user() self.render('profile.html', user = currentuser, visits = visits, logout=logout, personalposts=personalposts) app = webapp2.wsgiapplication([('/', mainpage), ('/profile/([0-9]+)', profilepage),]) when try , test it gives me 404 error....

mysql - table with data from combined tables -

i know can combine tables sql queries, that's not looking for. imagine having 10 tables, identical, reasons, not want mix data in 1 table. though! on other hand, create search results want able single sql query: (select * combined_table name='whatever') in data on fly 10 tables... possible, yes/no? you want put data single table. let's have ten different types of data. add column called type (you should choose better name) , allow have value 1 10. query work without changes. you can still data separately if wish: select * yourtable name = 'whatever' , `type` = 3 the reason can think of not doing if have different users different permissions , want use tables control users can see data. if despite benefits, still don't want put data in 1 table can solve issue using union all . create view yourview select col1, col2, ..., coln table1 union select col1, col2, ..., coln table2 union select col1, col2, ..., coln table3 union etc....

android - How do you create a Hotspots on an ImageView -

i want create clickable/hotspots on imageview when clicked trigger animation. have read on several post's creating "hotspots" on imageview way accomplish have not found working examples show how done. can please provide small example of how create hotspot on imageview? not sure if has impact on design images going in pageradapter image names change when user swipes next page.

html - How can I hide part of post title when the webpage shrinks? -

Image
i have list of posts. i want print words of post content post title just gmail ( old design ) $topictitle='social networks'; $smalldescription='the ability bookmark or share content on popular social media platforms'; echo '<p class="title">'.$topictitle.'</p>'.' - <span class="desc">'.$smalldescription.'</span>'; //this prints //social networks - ability bookmark or share content on popular social media platforms and works fine.. but... if user has small monitor or had resized page small the page not enough big title, have new like like this //social networks - ability bookmark or share content //on popular social media platforms will have new line! so, want make profissional gmail while shrinking page, title shrinking too, don't mean size of title, mean title itself, became this //social networks - ability bookmark or share content some of title has been d...

google app engine - Objectify entity -

can pass objectify entity (i.e class annotated @entity ) function accepting com.google.appengine.api.datastore.entity ? no. java typed language. can pass subclasses of com.google.appengine.api.datastore.entity function accepts com.google.appengine.api.datastore.entity. else won't compile.

Anyone know of a Yii extension or method for displaying model relations and table schema (including keys and comments) as a flowchart? -

i can't seem find extension/module/etc nicely. you can access column metadata follows, want way display flowchart or hypergraph in model's index. $m=new mymodel; yii::log(cvardumper::dumpasstring($m->tableschema->columns),'warning'); // echo $m->tojson(); // uses json behavior, give js flowchart show schema there 1 tool in phpmyadmin called designer. written in php , draw nice data model database. should refer code.

Create entirely custom Magento customer login form -

how can create own login form on frontend? don’t want modify template of existing login form, create own. i using magento community 1.7. thank guidance give me. create new template , override layout xml insert own block.

Reset git proxy to default configuration -

i installed socat use git protocol through http connect proxy, create script called gitproxy in bin directory. #!/bin/sh # use socat proxy git through http connect firewall. # useful if trying clone git:// inside company. # requires proxy allows connect port 9418. # # save file gitproxy somewhere in path (e.g., ~/bin) , run # chmod +x gitproxy # git config --global core.gitproxy gitproxy # # more details @ http://tinyurl.com/8xvpny # configuration. common proxy ports 3128, 8123, 8000. _proxy=proxy.yourcompany.com _proxyport=3128 exec socat stdio proxy:$_proxy:$1:$2,proxyport=$_proxyport then configured git use it: $ git config --global core.gitproxy gitproxy now, want reset git default proxy configurations, how can ? you can remove configuration with: git config --global --unset core.gitproxy

internet explorer - GWT JsonpRequestBuilder and codeServer (debug mode) not working in IE8 compatibility mode -

a break point not reach when run gwt app code server parameter debug mode. happens ie8 compatibility mode, works ie8 standard mode , rest of browsers. compiling ie6 , above. same problem goes jsonprequestbuilder, request fired, never returned. thanks. add script below: <iframe src="javascript:''" id='__gwt_historyframe' style='position:absolute;width:0;height:0;border:0'></iframe> just before nocache.js reference.

Do I need a framework to build a REST API in PHP? -

i new php (about 8 months). building web app, ready beta. starting think need make mobile version of app. as understand, should building rest api (please correct me if i'm wrong). not using php framework web app. should be? should begin using framework more implement api? or can build api without framework @ all? short answer no, don't need framework achieve target. but easier if use framework manage api. suggest go lightweight framework , maybe can convert webapp framework too, having 1 "app" return 2 different "things" (web stuff & api). take @ laravel , laravel 4 based rest api or list of popular php rest api frameworks can used build one.

regex - finding, and then efficiently replacing with the reverse in java -

i'm working in java large .txt file database of proteins. proteins have general structure, not 1 uniform enough hard-code "take startindex endindex, reverse, , replace". true uniformity delimited > , e.g.: ...werinweti>gi|230498 [bovine albumin]adfijwoenaonfoaidnfklsadnfathisdatfdaifj>sp|234235 (human) agp1 qwiqwonoqwnroiwqrnoqwirnswelle>gi|... , on. as can see, although actual protein sequence (the long chains of capitals) uniform in chains of capitals, besides that, preceding description can pretty (there lot of times not space between description , sequence). program needs copy original text on new file, go through, add r- after each > (e.g. ...eerfds>r-gi|23423... ) reverse chain of capitals. after process complete, need append end of original text. i have completed r- function, , have completed reversal , appending well, not efficient enough. databases receiving treatment massive, , program takes long. in fact have no idea how long tak...

How to "comment-out" (add comment) in a batch/cmd? -

i have batch file runs several python scripts table modifications. i want have users comment out 1-2 python scripts don't want run, rather removing them batch file (so next user knows these scripts exist options!) i want add comments bring attention variables need update in batch file before run it. see can use rem . looks that's more updating user progress after they've run it. is there syntax more appropriately adding comment? the rem command indeed comments. doesn't inherently update after running script. script authors might use way instead of echo , though, because default batch interpreter print out each command before it's processed. since rem commands don't anything, it's safe print them without side effects. avoid printing command, prefix @ , or, apply setting throughout program, run @echo off . (it's echo off avoid printing further commands; @ avoid printing that command prior echo setting taking effect.) so, in ba...

Why doesn't jQuery .on() work with an AJAX loaded element? -

okay, i've managed .on working on different site, reason being pain in one. here code: $("#tabsection").on("click", "a.tab", function () { alert('bob'); }); and html (which loaded via jquery .load() : <div id="tabsection"> <table border=0 width="750px" cellspacing=0 cellpadding=0> <tr><td class="tab"><a href="javascript:void();" rel="details" class="tab selected">details</a></td> obviously close table , tabsection div. working fine before got loading via ajax. now, cant work @ all. suggestions why wouldnt be? missing here? you loading #tabsection element, means doesn't exist when try hook event. the element hook event have exist when hook up. use element load html. $("#customerform").on("click", "#tabsection a.tab", function () { alert('bob'); });

ios - Seven levels of information hierarchy - UITableView - iPhone -

i have information hierarchy consists of 7 levels. appropriate use uitableview? i'm conscious may deep users navigate information. information decision tree antibiotic prescribing. thank you you possibly mean each level represented uitableview, while levels can browsed through uinavigationcontroller. i think can work, far ux concerned, provided user has enough knowledge of hierarchy not lost in it. the question is: envision other possibilities of showing information?

php - Search MySQL database with regex substitutions -

i want make product search engine user types in product code , bring result, easy. but, want able compensate numbers letters , vice versa. e.g user types 6o12l, product code 60121. what need put in sql query bring products 6o12l and/or 60121? so far have isn't working, keeps bringing same result everytime no matter type in: $searchstring = $_post['query'] ; $searchstring = preg_replace('#\w#', '', $searchstring); $firstletter = substr($searchstring, 0, 1) ; include("db.php") ; $result = $dbh->prepare("select productcode products productcoderegexp '6[o0]12[1l]' , productcode '$firstletter%'") ; $result->execute() ; while($row = $result->fetch(pdo::fetch_assoc)) { echo $row['productcode'].'<br />' ; } i have managed working, have encountered new problem. i'm using str_replace substitute letters numbers ...

php - What is a "Payload"? e.g XML Payload -

Image
while browsing web service docs, came across word " payload ", " xml payload " ... from wikipedia : "*payload in computing (sometimes referred actual or body data) cargo of data transmission. *" does not make sense here. can explain payload / xml payload mean? thanks. they "payload" actual contents, opposed wrapper , boilerplate xml around (meta-data, document type , such). such, variable part of reply. the wikipedia definition makes perfect sense me, "non payload" xml in these examples uninteresting. xml outside wrapping, , payload contents ("cargo"). note "escaped payload" indicates contents other format, may xml escaped. binary data, escaped cdata or base64, example. there could jpeg image there, example (if correctly escaped). or html, encoded xml entities. payload example be: &lt;div&gt;example&lt;/div&gt; which simple example xml-escaped-html payload, when...

php - What is the best generic class or package to use for input validation? -

what best, secured , user-friendly easy use validator class or plugin can use in php coding validate common user inputs e-mail addresses, urls, integers, etc.? e.g. http://code.google.com/p/owasp-esapi-php/ . there better way? or using filter_input best way? e.g. $value = filter_input(input_get, "value", filter_validate_int, array("options" => array("min_range" => 15, "max_range" => 20))); or custom coding? e.g. if (isset($_get["value"])) { $value = $_get["value"]; } else { $value = false; } if (is_numeric($value) && ($value >= 15 && $value <= 20)) { // run code } else { // handle issue } any expert views on this? prefer lazy style, like: filer_input($post); is there that? if you're not familiar such libraries may not user- (developer-) friendly, think should @ symfony2 validator component . installed throught composer, can used standalone...

Is there a way to define a variable on a update mysql query? -

i mean like: update table_name set field_1=if(date_add(data_field,interval 30 hour) >= now(),1,0), field_2=if(date_add(data_field,interval 30 hour) >= now(),1,0) ... well in case need use date_add(data_field,interval 30 hour), 2 times, there way store in variable or it? don't need call 2 times. thanks. sure: set @mydate := date_add(data_field,interval 30 hour); update table_name set field_1=if(@mydate >= now(),1,0), field_2=if(@mydate >= now(),1,0) ... fyi, these called user defined variables

c - Opengl es 2.0 without egl on desktop (windows) -

i have simple program on windows using visual studios 2008. in code use gl functions i.e #include gles2/gl2.h , #include egl/egl.h in code use egl initialization context. shown below. it creates window , createeglcontext. i not displaying result on screen. storing in memory not swapping display , surface buffer. my issues want remove egl.h code how possible. can give me idea. thank in advance glboolean createwindow1 ( escontext *escontext, const char* title, glint width, glint height, gluint flags ) { gluint attriblist[] = { egl_red_size, 5, egl_green_size, 6, egl_blue_size, 5, egl_alpha_size, (flags & es_window_alpha) ? 8 : egl_dont_care, egl_depth_size, (flags & es_window_depth) ? 8 : egl_dont_care, egl_stencil_size, (flags & es_window_stencil) ? 8 : egl_dont_care, egl_sample_buffers, (flags & es_window_multisample) ? 1 : 0, egl_none }; if ( escontext == null ) { ret...

psr 0 - php psr-0 restful webservice library -

is aware of lightweight restful lib namespaced following psr-0 guide lines. looking @ slim, epiphany better structured , namespaced per psr-0 recommendations. slim claims psr-0 compliant not , 'achieves' using own autoloader. any tips appreciated. silex similar slim better architecture imo , psr-0 compliant.

draggable - jquery sortable breaks axis rule. How to fix? -

when use sortable, axis rule becomes inactive ( jsfiddle example ) i want item moving horizontally. can help, please? add axis: x in order limit drag axis: $("#sortable").sortable({ axis: "x", revert: true }); demo

javascript - Quickflip 2 Plugin - only having the image flipped once? -

i using quickflip 2 plugin ( http://jonraasch.com/blog/quickflip-2-jquery-plugin/comment-page-3#comment-3562 ) have images flip image when clicked. however, trying make possible user 1 click on image can flip image on once , not able flip back. in example ( http://jsfiddle.net/gjh29/ ) can see able flip images infinitely many times. trying have them flip once. in order quick flip work properly, heights , widths need set. don't need call $(function() {} ); 2x. should have this: http://jsfiddle.net/hitmandx/khyr9/2/

sql server - Performance of Views in TSQL -

how sql server handle updates on views. worried performance , wanted know overview of how , when views change. a [non-materialized] view stored query gets run when use view name in query. performance [non-materialized] view comes query getting cached, because view's underlying query doesn't change. once view query altered, first time take little longer subsequent ones because there's nothing in query cache. you can use sp_refreshview , have have experienced locking (even within readuncommitted transaction). materialized ("indexed" in tsql/sql server) views different matter.

java - How to flatten an XML file into a set of xpath expressions? -

consider have following example xml file: <ns1:create xmlns:ns1='http://predic8.com/wsdl/material/articleservice/1/'> <article xmlns:ns1='http://predic8.com/material/1/'> <name xmlns:ns1='http://predic8.com/material/1/'>foo</name> <description xmlns:ns1='http://predic8.com/material/1/'>bar</description> <price xmlns:ns1='http://predic8.com/common/1/'> <amount xmlns:ns1='http://predic8.com/common/1/'>00.00</amount> <currency xmlns:ns1='http://predic8.com/common/1/'>usd</currency> </price> <id xmlns:ns1='http://predic8.com/material/1/'>1</id> </article> </ns1:create> what best (most efficient) way flatten set of xpath expressions. note also: want ignore namespace , attribute information. (if needed, done pre-processing step). so want output: /create/article/name /cr...

animation - android 2D bitmap drawing -

can any1 tell me why cant add bitmap onto surfaceview this: steering = new steering(bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher), getwidth()-50,getheight()-50); if use integers instead of "getheight()"-method, bitmap added fine. since want game run on more 1 phone without looking weird want add using 2 methods. can any1 help? thanks! where adding line? if on oncreate wouldnt display image since method getwidth() , getheight() return 0. paint have wait until system have created view. test receiving value try changing code have this: final int width = getwidth(); final int height = getheight(); final bitmap bitmap = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); steering = new steering(bitmap, width-50,height-50); and add breakpoint steering line , debugg it. if getting 0 in width , height have wait view draw. edit: on activity / fragment can add tree observer this: myview.getviewtreeobserver(...

c# - How do I specify an interface return type while still remaining dynamic? -

i'm flipped upside down here what i'm trying create bit of factory works on different types of tickets. i've create iticket interface has couple signatures getopen(); getbyid(int id); now, these methods need return instance or list of instances of same ticket type, thought i'd have interface this list<iticket> getopen(); iticket getbyid(int id); so in practice, hoping create factory method this: public static list<iticket> getopen(iticket ticket) { return ticket.getopen(); } ok, example, went class mocrequest , implemented list getopen() method this: public list<mocrequest> getopen() { //implementation grabs bunch of moctickets out of database , converts them instances of mocticketclass , returns them } i error saying isn't valid implementation because return type mocrequest instead of iticket. thought mocrequest iticket @ stage, in hindsight guess it's bit circular doesn't work. return type needs mocrequest...

I can't load my SmartGWT Datasource -

i'm modifying example of built-in-ds. way example works need select datasource, , table gets filled data there. idea show how same component can adapt multiple data sources. i've managed run example , works, i'm trying modify skip first step - there's 1 data source gets loaded "into" table. puzzles me should trivial reason it's not. i'll paste different parts of code, 1 works: // create list of datasources listgrid grid = new listgrid(); grid.setleft(20); grid.settop(75); grid.setwidth(130); grid.setleavescrollbargap(false); grid.setshowsortarrow(sortarrow.none); grid.setcansort(false); grid.setfields(new listgridfield("dstitle", "select datasource")); // i'm loading 1 need grid.setdata(new listgridrecord[] { new dsrecord("predmeti", "predmeti")}); grid.setselectiontype(selectionstyle.single); grid.addrecordclickhandler(new recordclickhandler() { ...

android - Is View regenerated as ListView scrolls? -

i have custom baseadapter binding listview. loading list of objects custom class. i altering layout of of rows, when data changes, create headers (yeah know there logic still have fix works). my problem is, when scroll listview past orginally-visible, application crashes classcastexception error on headerholder (which see if set breakpoint in catch handler). thinking due view being destroyed , recreated, not sure. can confirm this? public class mycustombaseadapter extends baseadapter { private static arraylist<appointment> searcharraylist; private layoutinflater minflater; public mycustombaseadapter(context context, arraylist<appointment> results) { searcharraylist = results; minflater = layoutinflater.from(context); } public int getcount() { return searcharraylist.size(); } public object getitem(int position) { return searcharraylist.get(position); } public long getitemid(int position) { return position; } public string lastdate = nul...

strange newlines being inserted in python file write -

does have idea or know of situation python inserts newline characters strangely. this piece of code if ((sentanalyze) , len(opstring)!=0): if data[8]!= '': if (data[8] == 'p'): opstring = "1 " + opstring elif (data[8] == 'n'): opstring = "-1 " + opstring elif (data[8] == 'neu'): opstring = "0 " + opstring print "writing :", opstring fw.write(opstring + "\n") when try looking @ print commands , file write commands, there new line inserted in file line numbers. this entire if block in while loop , print command prints lines properly. and yeah opening file in w+ mode. function (partially written here) compute opstring word,tag in simplified_tokens: tok = word + "/" + tag if tok in self.wordtoposition: opstring = opstring+ " " + str(self....

uiprogressview - height of progress view xcode -

is there way change height of progress view bar in xcode? i using xcode 4.3 , need vertical progress bar. rotated bar cannot change height , displays circle. also more effective way rotate progress bar helpful. thanks! some have reported changing it's frame manually work: [self.progressview setframe:cgrectmake(0, 0, 300, 25)]; whereas others have reported cgaffinetransform() works well: [self.progressview settransform:cgaffinetransformmakescale(1.0, 3.0)]; as rotation, use: #define degrees_to_radians(angle) ((angle) / 180.0 * m_pi) [self.progressview settransform:cgaffinetransformmakerotation(degrees_to_radians(angle))];

Setting background of checkbox to white and remove grey unchecked checkmarks in Android -

when set checkbox in android checked="false" there greyed out checkbox , grayed checkmark looks selected. don't want checkmark @ show, , no graying of box. white box no checkmark @ all. not grayed out one. first off may not idea customize check box, if need can create button 2 separate images on/off png. set checkbox drawable button.

smtp - mailer authentication error in Rails 3.2 with gmail or SendGrid -

i'm trying set mailing simple rails 3.2 app. tried gmail, tried sendgrid. getting same error. net::smtpauthenticationerror in userscontroller#create 530-5.5.1 authentication required here's section of environments/development.rb # care if mailer can't send config.action_mailer.raise_delivery_errors = true # change mail delivery either :smtp, :sendmail, :file, :test config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: "smtp.gmail.com", port: 587, domain: "signaldesign.net", authentication: "plain", enable_starttls_auto: true, user_name: env["gmailusername"], password: env["gmailpassword"] } here's users_controller def create @user = user.new(params[:user]) if @user.save usermailer.signup_confirmation(@user).deliver sign_in @user flash[:success] = "welcome!" redirect_to @user else render 'new' end end i'...

android - I have this issue java.lang.NoSuchMethodError -

the project run fine if run descktop version when run android version crush faltal exception glthread java.lang.nosuchmethoderror: com.badlogic.gdx.scenes.scene2d.ui.label. private void buildelements() { // --------------------------------------------------------------- // background. // --------------------------------------------------------------- //image image = new image(logo, scaling.none); //image.width = width; //image.height = height; // --------------------------------------------------------------- // labels // --------------------------------------------------------------- try{ titlelabel =new label("demo", "large-font", color.yellow, skin); poweredbylabel =new label("demo", "large-font", color.yellow, skin); }catch (exception e) { system.out.println(tag + " ( ) " + e.getmessage()); } table.pack(); addactor(titlelabel ); } seems wh...

SOLR high CPU utilization in amazon linux -

i installed solr-3.6 in local windows box , worked fine. i installed solr-4.0 in amazon ec2 linux large instance , cpu usage shot upto 100%. maintained @ 80-90% average cpu power. i thought because of 4.0, installed 3.6 in ec2 again. again cpu usage 80-90% average. with both versions, solr works in ec2. dont know why cpu usage high. in local box java 1.7 installed , in ec2 1.6.0_24. have mapped solr dir ebs volume. /dev/mapper/vg1-solr 8361916 1935928 6342128 24% /home/ec2-user/solr/solr/example/solr is there known issue ? we faced issue yesterday - problem because of leap second on june 30 2012. linux kernel component manages sleep times isn't updated correct time , causes extremely high cpu usage java processes. related question on serverfault , fix derived (for debian): (issue these commands command line) export lang="en_en" date -s "`date`" /etc/init.d/ntp stop ntpdate pool.ntp.org /etc/init.d/ntp start for red hat d...

Receive JSON request from PHP -

in firebug, in post tab see following; json textfieldone "alex" source {"textfieldone :"alex"} but in params tab see _dc 1341332451114 in php code when print_r($_request); get array ( [_dc] => 1341332451114 ) and not json, found in post tab. how solve ? i have no clue why hapenning, have tried debug day update php code: <?php // make mysql connection mysql_connect("localhost", "root", "pwd") or die(mysql_error()); mysql_select_db("db") or die(mysql_error()); print_r($_request); in firebug see above responces under url; post http://localhost/proj/php/result.php?_dc=1341332451114 200 ok 107ms may know ?_dc=1341366375982 is. sending post update 2 ext js4 code model ext.define ('mycomp.model.myclass',{ extend: 'ext.data.model', fields:['textfieldone'] }); view ext.define('mycomp.view.user.myclassview', { extend: ...