Posts

Showing posts from March, 2010

unity3d - App42 API Unity SDK: getTinyUrl() return null when using File Upload Service -

i'm using app42 unity sdk uploading binary files; used work fine, i've started "null" when retrieving tiny url calling filelist[i].gettinyurl() ; (just documentation shows). file uploaded succesfully , tiny url seems broken. regular url long using in app42 private messages, blocking issue. ideas? sometimes when tiny url service not available, might return null, can convert own calling tiny url service app.see tutorial same http://www.codeforest.net/how-to-shorten-url-using-tinyurl-service

java - How to determin the final position or angle of a rotated Image -

Image
i have imageview of wheel spinning on fling. how can detect final position of wheel when rotation complete? , similar wheel of fortune wheel, result depends on wheel stopped is there way detect when fling/rotation finished , final angle? want associate angle 1 of 4 quadrants in circle , set result that. thanks, of code below //////////////////////////gesture detect ///////////////// private class mywheelontouchlistener implements ontouchlistener { private double startangle; @override public boolean ontouch(view v, motionevent event) { switch (event.getaction()) { case motionevent.action_down: rotateanim(); // test // reset touched quadrants (int = 0; < quadranttouched.length; i++) { quadranttouched[i] = false; } allowrotating = false; startangle = getangle(event.getx(), event.gety()); break; case motionevent.action_move: do...

How to use negative regex matching with grep -E? -

this question has answer here: negative matching using grep (match lines not contain foo) 3 answers i'm using following regex via grep -e match specific string of chars via | pipe. $ git log <more switches here> | grep -e "match me" output: match me once match me twice what i'm looking negative match (return output lines don't contain specified string following grep doesn't it: $ git log <more switches here> | grep -e "^match me" desired output: whatever 1 whatever 2 here full output comes command line: match me once match me twice whatever 1 whatever 2 how arrive @ desired output per negative regex match? use -v option inverts matches, selecting non-matching lines grep -v 'match me' another option use -p interprets pattern perl regular expression. grep -p '^((?!match...

file - check if a folder is readable in Java 1.6 -

i trying check if folder readable in java 1.6 following 2 manner: 1) using canread method of file class. it's readable time (canread() return true): final file folder = new file("file.xml"); if(folder.canread()){ // file readable }else{ // file not readable!! } 2) using filepermission class , catch exception. catchs exception time (when folder readable or not): try { filepermission filepermission = new filepermission(folder.getabsolutepath(), "read"); accesscontroller.checkpermission(filepermission); // file readable } catch (accesscontrolexception pace) { // file not readable !! } i have found there issue between microsoft windows os , java 1.6 case. bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6203387 have solution? this quick , dirty, file dir = new file("foo"); if (dir.exists()) { if (dir.listfiles() == null) { // directory not readable } } all io errors handled inside of listfile...

extjs - Any query string to rise and fall -

to handle button events, have find child of parent container. there way address sibling components using ext.componentquery.query syntax? var target=this->up('window')->down('combo'); // there 1 step addressing method , down methods? use nextsibling method: this.nextsibling('combo');

mysql - Find duplicates on multiple columns in a SQL table in order to create UNIQUE index -

i created index called abc on table called table primary key called id , 3 others int columns a , b , c can null . now need index unique, tried : alter table table drop index abc, add unique abc (a, b, c); but have duplicates, mysql answers : #1062 - duplicate entry '1-2-3' key 'abc' i have lot of duplicates, i'm looking easy way search & destroy them all. first guess has been : select * table group abc but sadly seems can't group indexes. is there easy way find duplicates, keep 1 line of each duplicate , delete others ? edit : table id field primary key a , b , c int , can null no need eliminate duplicates first, use ignore option alter table want; alter ignore table table drop index abc, add unique abc (a, b, c); an sqlfiddle test with . if ignore not specified, copy aborted , rolled if duplicate-key errors occur. if ignore specified, 1 row used of rows duplicates on unique key. other conflicting r...

box api - Upload api fails and throws below exception when file is more than 3MB -

i having issue box-sdk ( https://github.com/box/box-windows-sdk-v2 ) upload api. issue : when try upload large file (more 3mb) (file less 3mb works great.) upload api fails , throws below exception. error : tostring : system.aggregateexception: 1 or more errors occurred. ---> system.threading.tasks.taskcanceledexception: task canceled. --- end of inner exception stack trace --- @ system.threading.tasks.task`1.getresultcore(boolean waitcompletionnotification) @ xxxx.program.d__34.movenext() in d:\gaurav\tfs\xxxx\xxxx\program.cs:line 319 ---> (inner exception #0) system.threading.tasks.taskcanceledexception: task canceled.<--- stacktrace : @ system.threading.tasks.task`1.getresultcore(boolean waitcompletionnotification) @ xxxx.program.d__34.movenext() in d:\gaurav\tfs\xxxx\xxxx\program.cs:line 319 innerexception : system.threading.tasks.taskcanceledexception: task canceled. time : 2014-05-28 04:55:59 pm code generating error : using (task<boxfi...

iif - Issue with Specific Nested If Statement in MS Access -

i created nested iif statement in 2010 access , part works. there once line not populate correctly: select iif([qrymarate]![commissionable], iif([qrymarate]![year]="2013", iif([forms]![frmmarate]![chktrueup], [qrymarate]![agentinitial], [qrymarate]![agentrenewal]), iif([forms]![frmmarate]![chktrueup], iif([qrymarate]![prorated], [qrymarate]![agentinitial]*([forms]![frmmarate]![cbomonth]/12), [qrymarate]![agentinitial]), <--- line not populate [qrymarate]![agentrenewal]*([forms]![frmmarate]![cbomonth]/12))), null) agentrate qrymarate; the goal of statement pick out if there should commission amount , either display commission or pro-rate based upon month commission earned. else in statement it's supposed 1 line. not matter put in line not populate. easiest answer ever, iif statement not recognizing y , n possible t/f response, updated prorated iif...

Rails: open-uri, pdf to api post, timeout -

i'm trying upload document drchrono via api. web browser when go url specified , using devise security (authenticate_user!) downloads in 68ms. when run below code timeout error. pdf file 1 page , made using prawn. open('http://' + host + '/recording/' + recording.id.to_s + '/analysis.pdf') |file| params = { 'document' => file.read, 'doctor' => 'https://drchrono.com/api/doctors/' + doctor.id, 'patient' => 'https://drchrono.com/api/patients/' + recording.patient.chrono_id.to_s, 'description' => 'report', 'date' => time.now.strftime("%y/%m/%d").gsub('/', '-') } response = httparty.post('https://drchrono.com/api/documents', :headers => headers, :body => params) data = json.parse(response.body) end my log shows right after timeout started "/recording/131/analysis.pdf" ip @ 2014...

r - Raster correlation and p-values from cor.test -

i trying pixel-wise correlations , significance (p-value) between 2 raster bricks using cor , cor.test . data here: brick 1 brick 2 they're both small, less 2mb altogether. i found following 2 codes (both robert hijmans) previous discussions on stackoverflow , r-sig-geo: #load data require(raster) sa <- brick("rain.grd") sb <- brick("pet.grd") # code 1 funcal <- function(xy) { xy <- na.omit(matrix(xy, ncol=2)) if (ncol(xy) < 2) { na } else { cor(xy[, 1], xy[, 2]) } } s <- stack(sa, sb) calc(s, funcal) # code 2 stackcor <- function(s1, s2, method='spearman') { mycor <- function(v) { x <- v[1:split] y <- v[(split+1):(2*split)] cor(x, y, method=method) } s <- stack(s1, s2) split <- nlayers(s)/2 calc(s, fun=mycor ) } both codes work expected cor function producing correlation...

bash - Linux Script: How to check for any lines that starts with but not contain -

i'm @ following directory... /var/log/homes and script check lines starts 'error' , contains word 'notauthorized' , not contains '13024' or '31071'. within /var/log/homes/, there 700 files, doesn't matter... below have... #!/bin/bash host=`hostname` date=`date` monitor='error' pattern='error' pattern2='notauthorized' ignore=13024 ignore2=31071 logfile='/var/log/homes/*' mailto='test@linux.com' if [ -e $logfile ] if [ `grep -i "$pattern" "$pattern2" "$logfile" | grep -v $ignore $ignore ] echo "errors found in $monitor @ $date - see log $logfile on server $host full details" |mail -s "alert - $errors in logs, please review" $mailto elif [ `grep -i "$pattern2" "$logfile" |wc -l` -lt 1 ] fi else echo "logfile $logfile doesn't exist on server $host @ $date, bad, please investigate" |mail -s ...

mysql - Multiple updates or update ... where in -

which version better (performance)? 1. update my_table set my_col = 1 my_id = 100 update my_table set my_col = 1 my_id = 110 update my_table set my_col = 1 my_id = 120 2. update my_table set my_col = 1 my_id in (100, 110, 120) in case, both ways have equal response time running 3-4 queries. 2nd way faster higher number of queries or updates (bulk updates faster) because reduce, creating,binding connections database query compilation/optimization task of sql engine but bulk updates has 1 downside i.e. locking of tables updating multiple records in single statement, table locked duration. perform bulk updates considering acceptable locking period in mind.

c# - Opening angle bracket "<" in user input causes a 404 error -

the .net app working on encounters error when user enters opening angle brackets "<" input. occurs when want sort of html input such <a href="www.google.com">google</a> i've tried exact same input without "<" , works should. input being read asp:textbox , added parameter sql insert statement. using try catch block catch sqlexception's, particular problem not caught when change catch statement catch(exception err) . know "<" used less operated in sql however, shouldn't problem because input parameter right? why "<" , not ">" in input since both characters valid sql operators? here actual code snippet. try { sql_command.connection = sql_connection; sql_command.commandtext = "insert tabl1 ([id], [fname], [lname], [bio]) values (@id, @first, @last, @bio)"; sqlparameter id, first, last, bio; id = new sqlparameter("@id", id_text.text); first = ne...

makefile - How to confirm what libraries Octave is *actually* using at runtime -

i've built octave (successfully) using atlas libraries (specifically multithreaded libraries: libtatlas.so). all looks during configure , make process (after debugging), after making octave i'm still seeing matrix multiplication operations run in single thread (the atlas libraries should make operation multithreaded). is there way can see library octave actually using when matrix multiplication operations such as: x = rand(10000,10000); y = rand(10000,10000); t=time(); z = x * y; i'm trying determine if still build issue (e.g. octave didn't link in right atlas libraries) or if atlas issue (octave uses right libraries atlas isn't behaving expected). if on linux platform can debug library resolution using ldd . if run on application binary: ldd <the binary file> it output list of how library dependencies have been resolved. a more complex approach set ld_debug libs before running application: env ld_debug=libs <command run a...

c# - Asp.net culture how to set it properly -

i trying set culture in application. here code : thread.currentthread.currentculture = new cultureinfo("fr-ca"); thread.currentthread.currentuiculture = new cultureinfo("fr"); i trying set masterpage.master first. have masterpage.master.resx , masterpage.master.fr.resx . 2 file set embedded ressouce in properties. here's aspx element : <asp:linkbutton runat="server" text="" id="lnklangue" onclick ="lnklangue_click" meta:resourcekey="lnklangue" ></asp:linkbutton> i have set lnklangue.text in both resx file (en , fr). my problem culture in english , never in french. can set culture "fr-ca", nothing work (no french, english). i tried set culture in pageload event, preinit, on button click, etc , nothing work. i using framework 4.0 am missing ? you need override following method on each page needs localized, or inherit base page overrides initializeculture metho...

javascript - Error with PouchDB: TypeError: angular.factory is not a function -

i'm trying figure out how use pouchdb in angularjs. i'm trying follow these instructions https://github.com/wspringer/angular-pouchdb i think i'm having problem understanding syntax creating factories and/or services. far section on "interacting database" app.js 'use strict'; angular .module('myappapp', [ 'ngcookies', 'ngresource', 'ngsanitize', 'ngroute', 'pouchdb' ]) .config(function ($routeprovider) { $routeprovider .when('/', { templateurl: 'views/main.html', controller: 'mainctrl' }) .otherwise({ redirectto: '/' }); }) angular.factory('someservice', function(pouchdb) { // pouchdb. var db = pouchdb.create('testdb'); pouchdb.destroy('testdb'); db.put({_id: 'foo', name: 'bar'}); }); when add "db.put", message see in browser...

mysql - Relational Table Design For Single Object w/Multiple Types -

i creating database web application , looking suggestions model single entity might have multiple types, each type having differing attributes. as example assume want create relational model "data source" object. there shared attributes of data sources, such numerical identifier, name, , type. each type have differing attributes based on type. sake of argument let's have 2 types, "sftp" , "s3". for s3 type might have store bucket, awsaccesskeyid, yoursecretaccesskeyid, etc. sftp have store address, username, password, potentially key of sort. my first inclination break out each type own table non-common fields being represented in new table foreign key in main "data source" table. don't have know table associated each type stored in main table , rewrite queries coming web app dynamically based on type. is there simple solution or best practices i'm missing here? what describing situation want implement tabl...

android - Wait for the countdown timer to finish or the user to click a button -

i'm trying create mini-game loop in user has 10 seconds click button or loses game. when run while game loop, want while loop start timer , either wait timer run out or user click button. also, when code runs, app crashes within while loop. not sure how continue. i'm rather new android. in advance. public class maingame extends activity implements onclicklistener { progressbar progress1; boolean gameon = true; button option1; button option2; button option3; private countdowntimer countdowntimer; private final long starttime = 10*1000; private final long interval= 100; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_game); log.d("mark", "justcreated completed"); initializebuttons();//also initializes timer, buttons, text, etc. log.d("mark", "initialize buttons function completed")...

php - How to create duplicate form from multi dimensional $_POST array -

the form have in theme multi part form , submitting following post data array ( [action] => save [packageid] => 0 [form] => array ( [post_title] => title [post_content] => description [category] => 30,35,7 ) [custom] => array ( [post_tags] => keyword, key, keys [phone_number] => 577xxxxxx [price] => 400 [map_location] => [map-log] => [map-lat] => [map-country] => [map-address1] => [map-address2] => [map-address3] => [map-zip] => [map-state] => [map-city] => ) [check_multi] => 1 ) 1 i want create second form dynamically, using foreach loop , hidden fields name of hidden field match $_post[key] , value of hidden field value of $_post[value] the original form has name set example name="custom[map-log]" would right in thinking can form keys example ...

asterisk - Attended Transfer to gxw410x sip trunk Failed -

i have issue making attended transfer fxo gateway (grand stream gxw4108). i using feature code (*2) commit in call attended transfer. call first initiated , transfer terminated when external pstn phone ring. blind transfer working fine , attended transfer working fine internally issue appears when transferring gxw4108 gateway. here configuration(sip.conf): [gxw410x] host= 192.168.10.239 type=peer insecure=very i using elastix version 2.4 , sniffing traffic: (192.168.10.231: asterisk , 192.168.10.239: gxw4108) invite sip:991xxxxxxxxxxx@192.168.10.239 sip/2.0 via: sip/2.0/udp 192.168.10.231:5060;branch=z9hg4bk5c0ae243;rport max-forwards: 70 from: "100" <sip:100@192.168.10.231>;tag=as1973acc2 to: <sip:991xxxxxxxxxxx@192.168.10.239> contact: <sip:100@192.168.10.231:5060> call-id: 21f5e75c5c575af45b939d0f349a40fc@192.168.10.231:5060 cseq: 102 invite user-agent: fpbx-2.8.1(1.8.20.0) date: sat, 10 may 2014 20:52:01 gmt allow: invite, ac...

Rails Helper method : wrong number of arguments (1 for 2) -

i'm having trouble helper method on rails app. method has 2 arguments , when try call it, error says : wrong number of arguments (2 1). def toggle_like_button(post, user) if user.flagged?(post, :like) link_to "unlike", like_post_path(post) else link_to "like", like_post_path(post) end end in view : <%= toggle_like_button(post, current_user) %> current_user , post both set, don't understand why raised error, did forget inside brackets in method? in advance!

html - navbar-right not working in form_tag using bootstrap 3 -

Image
i'm having problems getting navbar-right work correctly when using form_tag . when use form_tag seem lose of navbar-right styling , floats left. if use pure html <form> tag floats right expected. here gem versions: rails (4.1.1) bootstrap-sass (3.1.1.1) here code i'm using isn't working: <header class="navbar navbar-fixed-top navbar-inverse" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <%= link_to "footb...

javascript - Problems passing '?' in URL to ajax call -

i trying create ajax call weatherunderground. code is: $(".city").autocomplete({ source: function( request, response ) { $.ajax({ // http://autocomplete.wunderground.com/aq?query=san%20f url: "http://autocomplete.wunderground.com/aq?query=", datatype: "jsonp", data: { featureclass: "p", style: "full", maxrows: 12, name_startswith: request.term }, success: function( data ) { response( $.map( data.results, function( item ) { return { label: item.name + item.countryname, value: item.name }; })); } }); }, minlength: 2, select: function( event, ui ) { log( ui.item ? "selected: " + ui.item.label : "nothing selected, input " + this.value); }, open: function() { $( ).removeclass( "ui-corner-all" ).addclas...

verification - how does google verify ownership of a website? -

in order verify own website, google asked me following: download html verification file. [googlexxx.html] upload file http://www.example.com/ confirm successful upload visiting http://www.example.com/googlexxx.html in browser. click verify below. to stay verified, don't remove html file, after verification succeeds. the file provided google contains single line: google-site-verification: googlexxx.html how work? how supposed tell them own domain? it doesn't tell them own it, tells them have write permission it. that's considered enough.

wamp - Set MySQL root password with command prompt on WampServer -

i have installed wampserver version 2.5 on computer. have been trying set mysql root password using command prompt not recognize commands. when type following: mysqladmin -u root status i following error: 'mysqladmin' not recognized internal or external command, operable program or batch file. i following online directions, in order add mysql command prompt in wampserver windows system path, , think did right. i did command line search 'mysqld.exe' file using 'dir mysqld.exe /s /p' and did not directory path. you should navigate in command prompt folder mysqladmin file. try find find interface in windows. try mysqladmin -u root status or whatever need. then can add it's path system variables, reached every folder in command prompt.

send output of two bolts to a single bolt in Storm? -

what easiest way send output of bolta , boltb boltc. have use joins or there simpler solution. , b have same fields (ts, metric_name, metric_count). // kafkaspout --> logdecoder builder.setbolt(logdecoder_bolt_id, logdecoderbolt, 10).shufflegrouping(kafka_spout_id); // logdecoder --> countbolt builder.setbolt(count_bolt_id, countbolt, 10).shufflegrouping(logdecoder_bolt_id); // logdecoder --> httprescodecountbolt builder.setbolt(http_res_code_count_bolt_id, http_res_code_count_bolt, 10).shufflegrouping(logdecoder_bolt_id); # , want send countbolt , httprescodecountbolt output aggregator bolt. // countbolt --> aggregatwbolt builder.setbolt(aggregate_bolt_id, aggregatebolt, 5).fieldsgrouping((count_bolt_id), new fields("ts")); // httprescodecountbolt --> aggregatwbolt builder.setbolt(aggregate_bolt_id, aggregatebolt, 5).fieldsgrouping((http_res_code_count_bolt_id), new fields("ts")); is possible ...

nest - elasticsearch scoring unique terms vs ngram terms -

i've figured out how return results on partial word result using ngrams. i'd arrange (score or sort) results based on term first , partial term. for example, user searches movie db 'we'. want 'we marshall' , similar show @ top, , not 'north northwest'. (the 'we' in 'northwest'). currently mapping title field: "title": { "type": "string", "analyzer": "ngramanalyer", "fields": { "term": { "type": "string", "analyzer": "fulltermcaseinsensitive" }, "raw": { "type": "string", "index": "not_analyzed" } } } i've created multifield ngramanalyzer custom ngram, term using keyword tokenizer standard filter, , raw not_indexed. my query follows: "query": { "function_score": { "functions...

html - How do I "<img src='url'..." without having the domain in the url? -

it's silly question can't find right way it. i making wordpress theme myself , in css, specifying image sources full domain. example: #header { background: #ffffff url("http://mydomain.com/wp-content/themes/mytheme/images/header-bg.jpg"); } i want make sure works if install theme in domain. proper way specify source in case? you have use relative paths css file, example if have following structure: /mytheme/images/header-bg.jpg /mytheme/style.css then @ style.css make rule this: #header { background: #ffffff url("images/header-bg.jpg"); }

ruby - Setting up Rails on Hostmonster -

i'm able run rails s through ssh , see app start on own machine i'm unable access app web. app directly under home folder , have symbolic link pointing public_html public folder of rails app, tutorial explains. tried setting subdomain , every other step in tutorial no avail. highly appreciated. you need application server phusion passenger, unicorn or puma run ruby app in production environment. typically, you'll integrate application server web server's (apache, nginx) environment. i don't know hoster, if have root access, can use of these application servers. the built-in server start running rails server meant testing purposes on local machine. has not been made security, performance, stability or other production-environment criteria in mind.

jquery - CSS change element on Navbar focus -

so particular version of general problem - macstyle search can pretty nifty - it's supper annoying when combined dropdown menu - it's considered focus until drop down clicked @ point dropdown transitioned away mouse. .mac-style { width: 100px; -webkit-transition: width 1s ease-in-out; -moz-transition:width 1s ease-in-out; -o-transition: width 1s ease-in-out; transition: width 1s ease-in-out; } .mac-style:focus{ width: 260px; } http://jsfiddle.net/mdxqr/5/ i know can use :hover elements nearby + or inbetween ~ , there anyway specify search bar expansion long on navbar focused? , have narrow when element somewhere on page other on navbar focused? i don't see pure css solution work small jquery script solve it. if apply class search field when focused , add events actions make shrink, clicking outside .navbar , remove class. demo $(function () { $(".mac-style").focus(function () { $(this).addclass(...

ms access - Running a report showing current record from subform -

firstly, database using navigation form has tabs down side allow user navigate through forms , forms within have sub forms. now issue have i'm trying run report using macro , condition shows current record. if view form on own (not through navigation form) button works (happy days) when use through navigation form (which how user using it) asks me enter id record first. technically report still run relies on user entering correct id. this condition: [childid]=[forms]![frmmealchoice]![childid] there way navigate subform in condition? sorry if doesn't make sense can't think of better way of explaining it, appreciated. as stated in comments figured out went instantly after posting question. interested here ammeded condition; [childid]=[forms]![frmmainnavigation]![navigationsubform]![childid]

android - How to set the image resource of a dynamic imageview using multiple buttons -

hi i'm new programming , android development. i'm working on project , hoping can me. i have 2 activities 1 monthselect, contains buttons 1 each month of year. other activity quotedisplay, contains dynamic imageview, array list of images , swipe gesture detector. i'm trying make each button open imageview on different image array list , allow me scroll through images normal using swipe gestures. for example if february button pressed imageview displays first image of february , can swipe left second image in february. or if may button pressed imageview displays first image of may , allows me scrolls through images please. iv tried using intents different info in each make unique read somewhere saying work hasn't activity keep opening same image. unfortunately don't know other methods , learning thought task figure out. i have included simplified version of code if can i'd appreciate much. monthselect class public class monthselect extends activ...

Separate fields in R when no delimiter exists -

i have dataset following: structure(list(info = c("acacia melanoceras 0.0369 0.0427 0.0267 0.0298 0.0501 0.0042 ", "acalypha diversifolia van 0.0670 0.0439 0.0281 0.0427 0.0464 -0.0148 ", "acalypha macrostachya vin 0.0657 0.0621 0.0441 0.0522 0.0473 -0.0173 ", "adelia triloba 0.0481 0.0350 0.0202 0.0174 0.0286 -0.0349 ", "aegiphila panamensis 0.0437 0.0312 0.0166 0.0148 0.0194 -0.0497 ", "alchornea costaricensis 0.0568 0.0781 0.0502 0.0221 0.0734 -0.0153 " )), .names = "info", row.names = c(na, 6l), class = "data.frame") it has 1 column , looks this info 1 acacia melanoceras 0.0369 0.0427 0.0267 0.0298 0.0501 0.0042 2 acalypha diversifolia van 0.0670 0.0439 0.0281 0.0427 0.0464 -0.0148 3 acalypha macrostachya vin 0.0657 0.0621 0.0441 0.0522 0.0473 -0.0173 4 adelia triloba 0.0481 0.0350 0.0202 0.0174 0.028...

how can i get the first and last word of element in array php -

i trying first , last word of element in array, i've tried code didn't proper result foreach(unserialize($q['qlite']) $qkey => ql) { foreach($ql zp) { $response = $zp[0]; echo '$response'; } } and result got array( [0] => michael jordan best player of time [23] => 23 ) what want first value "michael" , last value "time" foreach($ql $zp) { $response = $zp[0]; $words = explode(' ', $zp[0]); echo $words[0]; echo $words[count($words) - 1]; } as explained in comment, need split string each word , return first , last of array created split.

java - libgdx Group is not affected by parent Table.row() -

i'm trying create in-game window, using table class. when added groups of images table, seems row() method has no influence groups, in same place. using images instead of groups works. ps. used group overlap images (kinda border hover effect), don't know better way that. thanks public class mygroup extends group{ public mygroup(image bg, image thumb){ this.addactor(bg); this.addactor(thumb); } } public class actionscreen extends table { mygroup[] group =new mygroup[8]; (int i=0;i<8;i++){ group[i] = new mygroup(new image(skin.getdrawable("item-bg")),new image(skin.getdrawable("item-bg-over"))); if (i==4){ row(); add(group[i]).top().padleft(100); } else{ add(group[i]).top().padleft(100); } } group's, default, have 0 size, have manually set size. in mygroup constructor, you...

ios - "directory not found for option" Flurry Analytics Library -

whenever reopen xcode project, these errors cause flurry analytics library: ld: warning: directory not found option '-l/users/...' ld: warning: directory not found option '-lfiles/flurry' ld: library not found -lflurry_5.0.0 clang: error: linker command failed exit code 1 (use -v see invocation) at first, when project opened, not build, if drag flurry library frameworks (even though visibly there), build, there still 2 warnings. if delete library search paths, error , warnings go away, when reopen project, come back. is there anyway fix warnings not there , don't have re-add library every time open project? there reference issue library. remove existing references in library search paths. remove library if present inside project folder. copy library inside project folder "flurry". reference library relative path (not absolute) in library search path "$(srcroot)/flurry"

Fading in text in Android using AnimationUtils.loadAnimation -

i grateful if explain me why works: private void startanimating() { textview logo1 = (textview) findviewbyid(r.id.shizzle); final animation fade1 = new alphaanimation(0.0f, 1.0f); fade1.setduration(3000); logo1.startanimation(fade1); } but doesn't work @ me: private void startanimating() { textview logo1 = (textview) findviewbyid(r.id.shizzle); animation fade1 = animationutils.loadanimation(this,r.anim.fade_in); logo1.startanimation(fade1); } the fade_in.xml associated above is: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/android" android:shareinterpolator="false"> <alpha android:fromalpha="0.0" android:toalpha="1.0" android:duration="3000"> </alpha> thanks help! works me: create 2 file in folder /res/an...

css - List view in Sencha Touch inside of Tab panel with scroll -

i have list view in tab panel. tab panel has 2 tab bars 1 @ top , other @ bottom. have 2 tab bars floating, when list scrolls, scrolls behind these tab bars @ top , @ bottom. everything except now, top portion , bottom portion of list behind tab panel , unclickable. also, when list loads first time, need list start beneath top tab bar. and, on reaching end of list, need list end right above bottom tab bar, items in list clickable. i managed doing: .x-tabbar + div .x-scroll-view { padding-top: 3.2em; } but, fixes problem @ top of list. @ bottom, no matter how padding-bottom give .x-scroll-view, bottom doesn't budge. how fix this? appreciated! thanks! edit: know can add spacers list , set height shown here: https://fiddle.sencha.com/#fiddle/26i , i'm looking css-only solution without need adding additional containers. .x-tabbar + div .x-scroll-scroller{ padding: 3.2em 0; } should it.

C++ class using Codeblocks -

i learning c++ through c++ primer book. creating class objects. ireally not know program work. using codeblocks 13.12 , have copy code: #include <iostream> #include "sales_item.h" int main() { sales_item book; //read isbn, number of copies sold, , sales price std::cin>>book; //write isbn, number of copies sold, total revenue, , average price std::cout<<book<<std:endl; return 0; } after there error(i not because there small red square on right of code line: #include "sales_item.h" i tried created class(the author not ask that) , 2 files created: sales_item.h.h #ifndef sales_item_h_h #define sales_item_h_h class sales_item.h { public: sales_item.h(); virtual ~sales_item.h(); protected: private: }; #endif // sales_item_h_h and second one: sales_item.h.cpp #include "sales_item.h.h" sales_item.h::sales_item.h() { //ctor } sales_item.h::~sales_item.h() { ...

html - How to balance two dynamic table rows height using jquery -

i have 2 dynamic tables here.tables rows details comes dynamically.how can balance 2 dynamic table rows height using jquery fiddle here http://jsfiddle.net/kannankds/2yvj3/14/ <table> <tr> <th>name</th> <th>lastname</th> </tr> <tr> <td>name1 name2 name3</td> <td>name1</td> </tr> <tr> <td>name1 name2 name3</td> <td>name1</td> </tr> </table> <table> <tr> <th>details1</th> <th>details2</th> </tr> <tr> <td>sadsad</td> <td>asdsd</td> </tr> <tr> <td>sadsad</td> <td>asdsd</td> </tr> </table> you can apply following css td , th elements: td,th { white-space: nowrap; } demo

c++ - Add extra namespace in node MSXML -

i want create node follows using msxml dom ( msxml6.h ) <name xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c> <child>child content</child> .... </name> msxml dom allows add 1 namespace of prefix using createnode() how add namespaces? setproperty() seems little different. should use createattribute() hack? okay? or better approach? well no 1 ever answered this. i'm giving own solution here. may helps time. instead of adding exact namespace, can add attribute like: xmlns:ns="http://example.com/path/to/whatever" where attribute name xmlns:ns , value being http://example.com/path/to/whatever and add this! done.

asp.net mvc - Html.Kendo Grid Edit Cancel issue -

i using html.kendo grid in mvc application. facing issue in grid edit cancel. dynamically changing grid data, once changed data, if edit cancel, binding default data not dynamically changed data. how retain dynamically changed data in grid edit cancel.

c# - Recursion and return a function -

i have following code in javascript , write same in c#. don't know how recursion , returning function together. function findsequence(goal) { function find(start, history) { if (start == goal) return history; else if (start > goal) return null; else return find(start + 5, "(" + history + " + 5)") || find(start * 3, "(" + history + " * 3)"); } return find(1, "1"); } i thought work isn't. public static func<int, string, string> findsequence(int goal) { var find = new func<int, string, string>(start, history => { if (start == goal) return history; else if (start > goal) return null; else return (find(start + 5, "(" + history + " + 5)") || find(start * 3, "(" + history + " * 3)")); }); return find; }

algorithm - Distance between two nodes in weighted directed graph -

which algorithm optimized searching shortest distance between 2 nodes in positive weighted directed graph? i know dijkstra option calculates src nodes. same floyd-warshall. one additional issue. need distance node source , destination. for example: src - f, dest - f need calculate 2.45 in example, not 0 dijkstra get. can modify dijkstra? i've implemented 1 http://www.vogella.com/tutorials/javaalgorithmsdijkstra/article.html graph http://www.math.cornell.edu/~numb3rs/blanco/net_dif.png if algorithm find shortest path 1 vertex another, , b algorithm find shortest paths between vertex , other nodes, proven fact optimal complexity of not better optimal complexity of b. i.e. cannot compute path single vertex, have compute paths other nodes. in simple words, how can sure found shortest path if don't know paths other nodes? however, though there exist no algorithm complexity better algorithm b, particular implementation of might made more optimized implementat...

Remove mutiple values from a hash in perl -

i need iterate through hash in perl , if key multiple values present in form of array , take first value. code snippet while (my ($key, $value) = each(%args)) { print "$key-----------------------------$value\n\n"; if ($key =~ /submit\.([\w-]+)/) { $submitfield = $1; } elsif ($key =~ /action/) { $submitfield = $value; } if (ref($value) ) { if (%min_args) { print ("min args not found aborting request"); $m->comp('/x-locale/errors/404.m'); $m->abort(); } print "multiple value found $key"; $value = shift @$value if ref($value) eq "array"; $args{$key} = $value; print "value changed $args{$key}\n\n"; print data::dumper->dump([$value]); print "<pre>" . data::dumper->dump([%args]) . "</pre>"; } } the problem if pass in more 1 key having ar...

jquery - jqGrid setselection true not work -

i have jggrid list of object, want select rows on load page. code multiselect: true, loadcomplete: function(){ var ids = $("#listdafatturare").jqgrid('getdataids'); for(var = 0; <= ids.length; i++){ $("#list").jqgrid('setselection', i, true); } }, but don't run, in view see selected 1 row. don't understand problem, try debug code , apparently there no problems. any ideas? i resolved in mode: loadcomplete: function(){ var i, count, $grid = $("#list"); var rowarray = $("#list").jqgrid('getdataids'); (i = 0, count = rowarray.length; < count; += 1) { $grid.jqgrid('setselection', rowarray[i], true); } },

scroll - Reverse scrolling with HTML5 -

is possible create reverse scrolling effect html5 , javascript on 2 parts of screen, this? http://nationallgbtmuseum.org/#/home/ you can override scrolling jquery. simple this: ​$(window).scroll(function() { // todo scrolling });​​ if want create page linked, need 2 main section on page. left , right side. while left content scrolled, reverse content of right section, , every time when window scrolled need offset-from top. after set top position of right section. here example: http://jsfiddle.net/338r8/25/

sql - How would you select records from a table based on the difference between 'created' dates with MySQL? -

here dummy data: | id | created @ | | 367 | 2014-05-28 22:55:36 | | 367 | 2014-05-28 22:57:06 | | 369 | 2014-05-28 23:06:02 | | 369 | 2014-05-28 23:08:05 | | 369 | 2014-05-28 23:18:07 | | 350 | 2014-05-28 23:12:56 | | 261 | 2014-05-28 21:17:11 | | 261 | 2014-05-29 22:27:43 | what i'd select this, ids (obviously not primary key in case) created_at date has difference of 24hrs or more. in case above data, id 261 has 2 records in there, created on 24hrs apart. in collection returned i'd want see id 261 in there. what effective way structure kind of query? slower option select id, time_to_sec(timediff(max(created_at),min(created_at))) seconds_difference table group id having seconds_difference > 3600*24 faster option select t1.id, time_to_sec(timediff(t2.created_at, t1.created_at) seconds_difference table t1 inner join table t2 on (t2.id = t1.id , t2.created_at > t1.created_at) time_to_sec(timediff(t2.created_at, t1.created_at) > 3600*...

.net - Pause OWIN/WebAPI2 SelfHost service -

is there way programmatically change environment variables of owin/webapi2 host after started , running? there many samples creating windows service owin self-host app. easy , straightforward: call webapp.start<>(..) in onstart() method, catch idisposable returned , dispose in onstop . ok. but trying onpause/oncontinue. want change owin environment variable enable\disable custom owin middleware intercept requests , return 503, example, when service paused. problem idisposable returned webapp.start<>(..) not contain public info service started it. , cannot find way access host/context/settings of running owin host accessed middlewares after change'em. surely 1 can add middleware/contoller react on specific web requests, don't want allow possibility of calling these commands public. local machine's admin rights - accepted way call it.

java - TargetNamespace in CXF simple frontEnd -

i using cxf simple frontend uses xml configs stead of annotations creating soap web services. now have created service: <simple:server id="locationsettingservice" serviceclass="com.my.own.webservice" address="/locationsettingwebservice"> <simple:servicebean> <bean class="com.my.own.webserviceimpl"> </bean> </simple:servicebean> <simple:ininterceptors> <ref bean="addressinghandler" /> <ref bean="authhandler" /> </simple:ininterceptors> <simple:databinding> <bean class="org.apache.cxf.aegis.databinding.aegisdatabinding" /> </simple:databinding> </simple:server> after deployment wsdl is: <wsdl:definitions name="locationsettingwebservice" ... targetnamespace="http://own.my...