Posts

Showing posts from September, 2012

java - How to show Admob interstitial in libGDX -

my app cant show interstitial. if run app test device id shows me interstitial test window google. without test device id shows me nothing. make same steps intergrate smart_banner. app shows smart_banner not interstitial. possible work wrong class... there exist interstitial class use adview class. have no idea did know tutorial including interstitial in libgdx ? public class mainactivity extends androidapplication { private adview adview; private adview fulladview; private relativelayout layout; private final string adcode = "xxx"; private final string fulladcode = "xxx"; @override public void oncreate(bundle savedinstancestate) { ... // create layout layout = new relativelayout(this); // admob view fulladview = new adview(this); fulladview.setadunitid(fulladcode); fulladview.setadsize(adsize.medium_rectangle); view gameview = initializeforview(new fpgame(new requesthandler(adview, fulladview)), cfg); ... adreques...

c++ - Iterator invalidation rules -

what iterator invalidation rules c++ containers? preferably in summary list format. (note: meant entry stack overflow's c++ faq . if want critique idea of providing faq in form, the posting on meta started this place that. answers question monitored in c++ chatroom , faq idea started out in first place, answer read came idea.) c++03 (source: iterator invalidation rules (c++03) ) insertion sequence containers vector : iterators , references before point of insertion unaffected, unless new container size greater previous capacity (in case iterators , references invalidated) [23.2.4.3/1] deque : iterators , references invalidated, unless inserted member @ end (front or back) of deque (in case iterators invalidated, references elements unaffected) [23.2.1.3/1] list : iterators , references unaffected [23.2.2.3/1] associative containers [multi]{set,map} : iterators , references unaffected [23.1.2/8] container adaptors stack : inherited underly...

Peer-to-server audio streaming using WebRTC -

i understand establish peer-to-peer connection initiator peer initialises shared signaling channel initialises rtcpeerconnection object (pc) requests local stream(s) using getusermedia registers local mediastream pc creates sdp offer , sends peer trickles ice candidates registers remote ice candidate begins connectivity checks receiver peer listens , processes remote offers delivered registers remote ice candidate begins connectivity checks generates sdp answer , sends peer but webrtc use case peer-to-server received streams processed on node.js server. in use case server has publicly routable ip address , listening new rtcpeerconnection requests. because of this, of steps involved establish peer-to-peer connection seem unnecessary case. q1 how steps establish peer-to-server connection differ peer-to-peer connection establishment? particularly q2 still need signaling channel? q3 still need step trickle ice candidates? your peer-to-serv...

c# - How to import only types, not instances? -

i'm importing dlls export iplugin class using mef (system.componentmodel.composition) [importmany(typeof(iplugin))] attribute. here's code use fetch extensions: aggregatecatalog catalog = new aggregatecatalog(); catalog.catalogs.add(new assemblycatalog(assembly.getexecutingassembly())); catalog.catalogs.add(new directorycatalog(appdatahelper.exedir + "/module/")); compositioncontainer container = new compositioncontainer(catalog); compositionbatch batch = new compositionbatch(); batch.addpart(this); however, far see, corresponding property hold instances afterwards. how import types (preferrably type objects) of extensions can create instances myself? you can't, mef works creating single instance of every compatible , exported type finds. the easiest way around import factories , use them create actual instances. the interface like: interface ipluginfactory { iplugin createinstance(); string typename {get;} } and search mef...

c++ - Construct object without arguments where superclass requires arguments -

i'm implementing class inherits superclass. superclass requires arguments constructor. subclass instantiatable without requiring arguments. superclass looks this: class otherclass { public: otherclass(yetanotherclass *yac); }; class superclass { public: superclass(otherclass *c); }; i'd this: class myclass : public superclass { public: myclass() : superclass(otherclass(yetanotherclass)) {} }; in order avoid having when instantiating member of myclass : yetanotherclass * only_used_once = yetanotherclass(); otherclass * also_used_just_once = otherclass(only_used_once); myclass what_i_actually_want = myclass(also_used_just_once); is possible? a similar question showed solution of creating static method produces arguments needed parent constructor, hope there's simpler way there. with : struct dataclass { dataclass() : yetanotherclass(), otherclass(&yetanotherclass) {} yetanotherclass yetanotherclass; otherclass otherclass;...

Rails routes and ajax -

i have problem: my routes: match 'questions/get_label/:id' => 'questions#get_label' ,:as => :question_get_label, :via => :post my js: $.ajax({ url: 'questions/get_label/'+id, type: "post", success: function(){ //$('.preloader').hide() } }); server answer: no route matches [patch] "/questions/get_label/2" what miss?

c# - Method input parameter as namespace -

let's have these objects namespace myresponses.interfaces.iinterface1 { partial class exresponse { object1 myobj; bool flag; } } namespace myresponses.interfaces.iinterface2 { partial class exresponse { object2 myobj; bool flag; } } namespace myresponses.interfaces.iinterface3 { partial class exresponse { object3 myobj; bool flag; } } and need method check flags in exresponse objects. method receive object inside myresponses.interfaces namespace. something like: bool checkflaginresponse(myresponses.interfaces response, type responsetype) { return (response responsetype).flag; } i call this? checkflaginresponse(myexresponse, myexresponse.gettype()) it sounds broken design, if have similar types same members (and same simple name) no type relationship between them. if generated code , types declared partial types in generated code, potentially fix making them implem...

javascript - IE 9 and 10 yield unexpected and inconsistent MediaError's -

we have set of html blocks -- around 50 of them -- iteratively parsed , have audio objects dynamically added: var someaudiowrapper = function(name) { this.internal_player = new audio(); this.internal_player.src = this.determinesrcfromname(name); // mp3 this.play = function() { if (someotherconditionsaremet()) { this.internal_player.play(); } } } suppose generate 40 80 of these on page load, same set particular configuration. in browsers tested, basic strategy appears work. audio load , play successfully. in ie's 9 , 10, transient bug surfaces. on occasion, calling .play() on inner audio object fails. upon inspection, inner audio object has .error.code of 4 ( media_err_src_not_supported ). file's .duration shows nan . however, happens occasionally, , random subset of audio files. e.g., usually file_abc.mp3 plays, generates error. network monitor shows successful download in either case. , attempting reload file via console fail...

php - Error using substr() -

i getting error while using substr : warning: substr() expects parameter 3 long i new php , not locate problem. appreciate help. here code: function prepare_string($passed_string,$length) { $matches = array("`","!","@","®","©","~","#","$","%","^","&","*","-","=","+","|","\\","[","{","]","}","(",")",";",":","\"","'",",","<",">",".","?","/","\'","\\","'","’"); $passed_string =substr($passed_string,0,$length); for($i=0;$i<count($matches);$i++) { $passed_string = str_replace($matches[$i],"_",$passed_string); } ...

Jacobi method in Scilab, what is wrong with my implementation -

hy, i have below jacobi method implementation in scilab, receaive errors, function [x]= jacobi(a,b) [n m] = size (a); // determinam marimea matricei //we check if matrix quadratic if n<>m error('matricea ar trebui sa fie patratica'); abort; end we initialize zeros matrix x = zeros(n,1) // matrice cu zerouri x = [0, 0 ... 0] // initializarea variabilelor itmax=1000.; //numar maxim de iteratii eps=0.0000000000000001 // toleranta maxima nrit=0; ready=0; while (ready==0) i=1:n s=0 j=1:n if i<>j s=a(i,j)+x(j); end end y(i)=(1/a(i,i))*(b(i)-s); end abso = norm(x(1),y(1)); i=2:n if abso<norm(x(i),y(i)) abso=norm(x(i),y(i)); end end nrit=nrit+1; if((nrit==itmax)|(abso<eps)) ready=1; end x=y; end i=1:n disp(y(i),'rezidurile medii'); end x what wrong it! sincerly, i don't know errors , noticed there i...

Edit binding IIS 8 by C# or by appcmd -

how modify existing binding in configurated site in iis 8 (windows 8)? try command prompt. only can add new binding command prompt running administrator mode: > c:\windows\system32\inetsrv>appcmd set site /site.name:test /+bindings.[protocol='http',bindinginformation='*:80:mitest'] in command prompt use: > c:\windows\system32\inetsrv>appcmd set site "test" /? to see set binding options, , not exist command "set binding binding id". by c# code use: string windir = environment.getenvironmentvariable("windir"); string comando = windir +"\\system32\\inetsrv\\appcmd.exe set site /site.name:test /+bindings.[protocol='http',bindinginformation='*:80:mitest']"; system.diagnostics.processstartinfo procstartinfo = new system.diagnostics.processstartinfo("cmd", "/c " + comando); procstartinfo.redirectstandardoutput = true; procstartinfo.useshellexecute = false; ...

ios - dispatch_sync inside dispatch_sync causes deadlock -

i read on objc.io going asynchronous can't find explanation dispatch_queue_t queuea; // assume have dispatch_sync(queuea, ^(){ // (a) dispatch_sync(queuea, ^(){ // (b) foo(); }); }); once hit second dispatch_sync we’ll deadlock: can’t dispatch onto queuea, because (the current thread) on queue , never going leave it. as long understand dispatch_sync add work item (i avoid using word "block" may confuse) queuea, work item send queuea 's target queue, gcd preserve thread threadworkitem work item when reach (b), i'm in thread threadworkitem (suppose threadworkitem name of thread), think enqueuing work item queuea no problem. people @ time, queuea preserved, queuea blocked -> causes deadlock, confuses me i read many threads related this, such deadlock dispatch_sync , why can't use dispatch_sync on current queue? , why dispatch_sync() call freezing? , ... can't find explanation. dispatch_sync blocks queue, bloc...

node.js - Socket.io loading very slow -

first time run web server main page loading 25 s , remove line: <script src="/socket.io/socket.io.js" type="text/javascript"> </script> page working fine. why socket.io slow ? var app = express() , server = require('http').createserver(app) , io = require('socket.io').listen(server); io.enable('browser client minification'); // send minified client io.enable('browser client etag'); // apply etag caching logic based on version number io.set('log level', 1); // reduce logging io.set('transports', [ 'websocket' , 'flashsocket' , 'htmlfile' , 'xhr-polling' , 'jsonp-polling' ]);

internet explorer - Websocket-Rails and IE 8 -

i'm working on real-time chat application using websocket-rails gem , having difficulty in getting real-time updates happen in internet explorer 8. there's option @ bottom of initializer enables ie8/9 compatibility enabling cors: # supporting http streaming on internet explorer versions 8 & 9 # requires cors enabled "/websocket" request. # list here origin domains allowed perform request. config.allowed_origins = ['http://localhost:3000'] i've enabled development , worked sporadically , unpredictably. able have message appear once or twice never consistently , have since not been able recreate again. does have experience getting websocket-rails , ie work? in advance. you can try websocketjs, polyfill websocket i rather use polyfill have socket connection, trying emulate 1 using http requests.

ios - Why use Localizable Strings in objective c vs Traditional Hash Maps? -

question in title. looking simple answer if use nslocalizedstring , don't have write own code detect , load resources per locale, , instead rely on used , reliable code provided system. saves time in development , debugging, , code easier understand other developers familiar system.

python - Django Integrity error _id may not be null, ForeignKey id assignment -

i'm having issues understanding way django (v1.6.5) assigns id different objects when saving. taking minimal example: #models.py class book(models.model): title = models.charfield(max_length=10) class page(models.model): number = models.smallintegerfield() book = models.foreignkey(book) the following view throws "integrityerror,book_id may not null" when saving my_page, tend book_id exist since save() has been called book @ stage. #view.py my_book = book(title="my book") #solution1 : having my_book.save() here my_page = page(number = 1, book = my_book) my_book.save() print("book id",my_page.book.id) #book.id exist @ point! #solution2: my_page.book = my_book my_page.save() #throws integrityerror exception there easy solutions make code above work know wrong first approach. missing or glitch/limitation in way django handles foreignkeys? i see point, current behavior seems more explicit. my_book python object, ...

html - How to fit table rows that are too big for page display? -

i have table: table.tablesorter { border: 1px solid #d9d9d9; } table.tablesorter thead tr th, table.tablesorter tfoot tr th { background-color: #04659d; border-bottom: 1px solid #0f5e76; border-left: 1px solid #0f5e76; font-weight: bold; text-align:left; padding: 5px 19px 5px 9px; color: #fff; } some of text in table big , being cut page, have try using word-wrap:break-word; , setting width nothing working text still overflows? any tips on how can fix this? give table element fixed table-layout : table.tablesorter { ... table-layout: fixed; } from css2.1 specification (linked above): 17.5.2.1 fixed table layout with (fast) algorithm, the horizontal layout of table not depend on contents of cells; depends on table's width, width of columns, , borders or cell spacing.

cocoa - Custom "open in " action title for iOS app that opens a document type -

i have app can open custom document type (according https://developer.apple.com/library/ios/qa/qa1587/_index.html ) when tap on file in application, menu of apps can open file in: "open in google drive", "open in myapp", "mail" i noticed mail app doesn't have "open in " prefix. myapp designed "upload" file type. possible change text reads "upload via myapp?" apple uses private apis own apps, , that's why can display mail option differently. other apps, "open in myapp", myapp whatever you've set bundle display name.

Grails 2.4.0 upgrade - env variables -

what doing wrong here? i'm moving grails 2.4.0 (windows 7 enterprise) , having troubles environment variables set correctly. here's stuff.... grails_home c:\grails\grails-2.4.0 java_home c:\program files\java\jdk1.7.0_51 yet when run-app cmd prompt this: c:>echo %grails_home% c:\grails\grails-2.3.7 and also...here entire path variable %grails_home%\bin;%java_home%\bin;c:\oracle\product\11.2.0\client_32\bin;%system‌​root%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\wind‌​owspowershell\v1.0\;c:\program files\sliksvn\bin;c:\program files (x86)\actividentity\activclient\;c:\program files\actividentity\activclient\ given above... when run-app following. wrong , relate env variables? c:\users>grails run-app picked java_tool_options: -djava.vendor="sun microsystems inc." error opening zip file or jar manifest missing : c:/grails/grails-2.3.7/lib/org. springframework/springloaded/jars/springloaded-1.2.0.release.jar error oc...

php - mySQL Order by Most Commented and Least Commented -

i'm trying order list of items based on amount of comments each topic shown below: $page = $_get['page']; $query = mysql_query("select * topic cat_id='$page' limit $start, $per_page"); if (mysql_num_rows($query)>=1) { while($rows = mysql_fetch_array($query)) { $number = $rows['topic_id']; $title = $rows['topic_title']; $description = $rows['topic_description']; //get topic total $sqlcomment = mysql_query("select * comments topic_id='$number'"); $commentnumber = mysql_num_rows($sqlcomment); // trying order output echo topic total asc or desc echo " <ul> <li><h4>$number. $title</h4> <p>$description</p> <p>$topictime</p> <p>$commentnumber</p> </li> </ul> "; } } else { echo "<p>no records available.</p><br>"; } what best way order each echo $num_rows (asc/desc values)? note: i've updated full ...

python - parser class, passing in a way to specify column changes -

a bit stuck here on way go this. have class simple parser of csv files encapsulates data in self.data parameter , offers methods data. import os collections import namedtuple app import config class csvreader(): def __init__(self, csv_name): self.csv_name = csv_name def read_csv(): open(os.path.join(config['csv_path'], self.csv_name)) f: c_read = csv.dictreader(f) self.csvrow = namedtuple('csv_entry', c_read.fieldnames) self.data = [self.csvrow(**row) row in c_read] # ... the problem having presents when want different data representations different columns. here's sample data: name is_registered role 'crow' '1' '3' 'not crow' '0' '2' in case, want more this: name is_registered role 'crow' true 'bird' 'not crow' false 'user' for part, lot remain string. however, wan...

UnsatisfiedLinkError Java OpenCV and executable jar Eclipse -

sorry not have solution problem. can me? i have application on eclipse , work correctly opencv, if export in jar executable jar, have error command prompt when launching jar: exception in thread "main" java.lang.unsatisfiedlinkerror: no opencv_java249 in java.library.path @ java.lang.classloader.loadlibrary(unknown source) @ java.lang.runtime.loadlibrary0(unknown source) @ java.lang.system.loadlibrary(unknown source) @ grafic.windowinterface.windowsvalidate(windowinterface.java:695) @ grafic.windowinterface.validate(windowinterface.java:677) @ grafic.windowinterface$4.widgetselected(windowinterface.java:388) @ org.eclipse.swt.widgets.typedlistener.handleevent(typedlistener.java:248) @ org.eclipse.swt.widgets.eventtable.sendevent(eventtable.java:84) @ org.eclipse.swt.widgets.widget.sendevent(widget.java:1053) @ org.eclipse.swt.widgets.display.rundeferredevents(display.java:4169) @ org.eclipse.swt.widgets.display.readanddispa...

javascript - "undefined" values from regex exec -

i'm begginer. want put indexes of searched string (regex + exec) array after pressing "run" button. musing arr.push. have problem inside while loop - because of closures. array [undefinde, undefined.....]. string taken textarea.value look @ jsfiddle code http://jsfiddle.net/andre81/exrqq/8/ function trimreport () { 'use strict'; var reporttxt = document.getelementbyid('raportinput'); var str = reporttxt.value; var re = /\<tr\>/gmi; var result = []; var val; var match; var div = document.getelementbyid('output'); while (match = re.exec(str)) { val = match.index; result.push(val.lastindex); div.innerhtml = div.innerhtml + val + '<br>'; //console.log(match.index); }; div.innerhtml = div.innerhtml + result + '<br>'; //console.log(result); }; //initial func...

c - does nested struct initialization depend on scope? -

i can't figure out. why compile: typedef struct { int foo[3]; } a_t; typedef struct b { char tag; a_t foo; } b_t; const a_t default_a = { { 1, 2, 3 } }; int main(int argc, char **argv) { const b_t default_b = { 'a', default_a }; return 0; } and not: typedef struct { int foo[3]; } a_t; typedef struct b { char tag; a_t foo; } b_t; const a_t default_a = { { 1, 2, 3 } }; const b_t default_b = { 'a', default_a }; int main(int argc, char **argv) { return 0; } > gcc tp.c tp.c:13:1 error: initializer element not constant tp.c:31:1 error: (near initialization ...default_b.foo...) the change scope of declaration default_b. why make difference? can tell, either both valid, or should both wrong. gcc (v4.7.3) accepts first , not second. driving me nuts. [[edit]] follow-up question bonus points: given second program not compliant c standard, how may accomplish same thing in standard-compliant way? ie: global, cons...

html - How to wrap Font-Awesome with CSS? -

Image
i using bootstrap & font awesome, , looking make this: i have this: i want this: markup: <div class="alert alert-success"><i class="fa fa-paperclip icon-alert"></i> edited!</div> css: .icon-alert { font-size: 30px; float: left; margin-right: 10px; opacity: 0.7; } you'll need set height container , can hide overflow of nested font-awesome icon, using overflow:hidden . css : .clipped-alert{ overflow:hidden; height:55px; } html : <div class="clipped-alert alert alert-success"> <i class="fa fa-paperclip fa-5x icon-alert pull-right text-success"></i> edited! </div> demo

javascript - Set height on div with CSS3 transform (rotate) -

Image
goal i'm working on collapsible sidebar using jquery animation. have vertical text on sidebar acts label , can swap on animateout/animatein effect. normally use image of text i've swapped vertically, , switch out on animation, css3 transforms i'd work instead. problem the problem i'm facing setting height on rotated container makes expand horizontally (as it's rotated 90deg) doesn't work. tried set width (hoping expand vertically, acting height), has odd effect of causing width of parent container expand well. fix? how can set height on rotated (transformed) element without affecting width of parent container? far have been unable this. live example here's fiddle demonstrates problem: fiddle the collapse-pane class have rotated , contains span have text inside. you'll notice has width set, widens border, affects parent container. the code: css: .right-panel{ position:fixed; right:0; top:0; bottom:0; border...

bash - How to print a character using Shell script -

below script acquire mac of machine , store within config file. my problem within each line have character " " , dont print inside file, how can write file using " " mac=$(ifconfig eth0 | grep -o -e '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') echo " view.sslverificationmode = *3* view.autoconnectdesktop = *true* view.autoconnectbroker = *true* view.kiosklogin = *true* view.noninteractive = *true* view.fullscreen = *true* view.nomenubar = *true* view.defaultbroker = *viewcs* view.defaultuser = *cm-${mac//:/_}* " > /etc/vmware/view-mandatory-config; sed -i 's/*/"/g' /etc/vmware/view-mandatory-config with cat , here-doc can use multi-line input without escaping charaters mac=$(ifconfig eth0 | grep -o -e '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') cat << eot > /etc/vmware/view-mandatory-config view.sslverificationmode = "3" view.autoconnectdesktop = "true" view.autoconnectbroker ...

ocr - How to Read Text From Bitmap in C#? -

i creating program relies heavily on image recognition. doing taking screenshot, , determining whether pre-determined image exists in location of screenshotting. however, program, need able take screenshot of location in there text, numbers. regular, in same font, different numbers every time. how can turn kind of information bitmap integer can use in code? thanks. this not easy task, optical character recognition (ocr). there similar conversation here. ocr tesseract interface you might want @ this: http://www.leadtools.com/sdk/ocr/default.htm?srcorigin=google-cpc-ocr%20api&matchtype=e&adpos=1t2&gclid=cljxx4gx6k8cfda2paodaxth1q even beyond ocr, need scan image , find actual text, , might tricky well. if text not in same location find in "computer vision" space.

c# - How to retrieve the selected group in a LongListSelector? -

i using longlistselector showing group s contact (one contact can belong multiple group s) class group { public string name { get; set; } } class contact { public string name { get; set; } public list<group> groups { get; set; } } i use code below build itemssource longlistselector public list<keyedlist<group, contact>> groupedcontacts { { list<group> groups = ...; list<contact> contacts = ...; list<keyedlist<group, contact>> result = new list<keyedlist<group, contact>>(); foreach (group gr0up in groups) { var temp = c in contacts c.groups.contains(gr0up) select c; list<contact> groupedcontacts = new list<contact>(temp); result.add(new keyedlist<group, contact>(gr0up, groupedcontacts)); } return result; } } as can see code above, single contact object can used i...

opencv - Accelerated SVM training for HOG algorithm -

let's have perfect 3d model of rigid object looking for. i want find object in scene image using histogram of oriented gradients (hog) algorithm. one way train svm render object on top of bunch of random backgrounds, in order generate positive training examples. but, there faster, more direct way use model train svm? 1 doesn't involve rendering multiple times?

objective c - Adding a NSDictionary to a NSArray duplicates the first NSDictionary every time -

so pulled json data web service stored in nsarray called _infofromjson . each array element in _infofromjson has dictionary of key/value pairs. goal add them myvehicleobject nsmutablearray for (nsdictionary* mydictionary in _infofromjson) { myvehicleobject *vehicleinmembersprofile; vehicleinmembersprofile = [[myvehicleobject alloc] init]; vehicleinmembersprofile.make = [[_infofromjson objectatindex:carcount] objectforkey:@"make"]; vehicleinmembersprofile.carname = [[_infofromjson objectatindex:carcount] objectforkey:@"nickname"]; vehicleinmembersprofile.year = [[_infofromjson objectatindex:carcount] objectforkey:@"year"]; carcount ++; [self.myvehicleobject addobject:vehicleinmembersprofile] ; }; with above code sort of achieved it, keeps adding same 1st dictionary myvehicleobject , inserts same nsdictionary 4 times in past have used this: [self.myvehicleobject addobject:[vehicleinmembersprofile copy]] ; when it...

javascript - Replacing an image with another image on click -

i have 6 images sorted on 3x2 grid on page. html looks this. <div id="wrapper"> <div id="list"> <ul> <li> <img src="images/2.png" /> </> <p>tekst</p> </li> <li><img src="images/3.png" /><p>tekst</p></li> <li><img src="images4.png" /><p>tekst</p></li> </ul> </div> <div id="list2"> <ul> <li><img src="images/5.png" /><p>tekst</p></li> <li><img src="images/6.png" /><p>tekst</p></li> <li><img src="images/7.png" /><p>tekst</p></li> </ul> </div> with css positioned them correctly on page. like, darker version, aka image, of image, when click it. if click again moves tot initial one. this has happen every 6 images. don...

ios - AVAudioPlayer does not audibly play, throws no errors, calls no delegate method -

encountering weird issue. i'm trying use avaudioplayer play simple sound file disk. maintain strong reference via property arc doesn't kill prematurely. said in title, no sound, errors , no delegate methods called--including didfinishplaying (which expect). thing seems "happen" hear 2 quiet clicks... now weird part...if set breakpoint before [_player play], step over, audio plays fine!! confirms me have set things correctly, , makes me think else stepping on shared avaudiosession thread? i'm not sure. total lack of delegate calls odd--it seems something should called whenever avaudioplayer finishes. i using openears speech recognition, call suspendlistening on before attempting play audio. have tried disabling openears entirely, try , isolate cause--but had no effect, either. perplexing. appreciate help! -(void)playaudionotewithpath:(nsstring *)filepath { nserror *error = nil; avaudiosession *audiosession = [avaudiosession sharedinstance]; ...

objective c - iOS: __weak vs (weak) -

are there differences between these 2 lines of code? __weak iboutlet uitextfield *usernamefield; @property (weak) iboutlet uitextfield *usernamefield; what if declare either of these in interface section of .h or .m files? yes. first example declares weak instance variable called usernamefield , second declares weak property called usernamefield , , instance variable called _usernamefield accessed property. if declare in @interface section of .m file, can accessed in .m file (unless mess objective-c runtime).

javascript - Why the .php gets saved/opened instead of the new page being showned when I click on a button? -

Image
i have following generatelink function creates page lpe when click button in lpe page asks me if want open iat.php file instead of showing ginstruct1.html shown in following. can please guide me doing wrong? so expect following page following html show when click on concepts , images study : <html> <!-- thin people fat people --> <p style="margin-left:30px">in task, classifying concepts , images 1. each concept or image appear in center of screen, example,</p> </br> </br> </br> <img src="gse-gpe-02.png" class ='instritem' style="margin-left:33%;"/> </br> </br> </br> <div style="text-align:center">press <b>space bar</b> continue.</div></html> however when click on button receive following : here's index2_4.html generatelink function: function generatelink() { var linktext; if (math.random() < 0.5) { ...

setinterval - Call JavaScript function after 1 second One Time -

i have managed make div hide on click after 400 milliseconds using setinterval function. issue runs continually, need function execute once. after quick search discovered setinterval can stopped clearinterval. using incorrectly? closeanimation function being executed on click. modelled code after code on page: http://www.w3schools.com/jsref/met_win_setinterval.asp function closeanimation() { setinterval(function(){hide()}, 400); clearinterval(stopanimation); } var stopanimation = setinterval({hide()}, 400); if needs run once can use settimeout settimeout(function () { //do once }, 1000);

c - When we search word in txt file how we could colour in txt file -

hi make code @ c find string in txt file code has result how many times found string , pos first character want colour string in txt file when find string had no idea how can code: #include<stdio.h> #include<stdlib.h> #include<string.h> main() { file*fp; char fname[100]; char data[20]; char choice; char key[10]; char*ptr; int counter=0; int pos_start; printf("program start-up....\n"); printf("enter file name: "); gets(fname); fp=fopen(fname,"r"); if (fp==null) { printf("error:file can not opened\n"); printf("program closed...\n"); exit(1); } printf("file opened successfully\n"); printf("do want search string(y/n)"); scanf(" %c",&choice); while ((choice!='y') && (choice!='n')) { printf("do want search string(y/n)"); scanf(...

actionscript 3 - Trying to make a game where i dodge meteorites falling from the sky. as3 -

im trying make game meteorites falling sky... far have got 1 falling , dissapearing isnt looping. how make multiple meteorites come down @ different locations , keep looping code far var randomx:number = math.random() * 400; test_mc.x = randomx; test_mc.y = 0; var speed:number = 10; test_mc.addeventlistener(event.enter_frame, movedown); function movedown(e:event):void { e.target.y += speed; if(e.target.y >= 500 ) { test_mc.removeeventlistener(event.enter_frame, movedown); } } instead of having 1 test_mc object, define array , counter variable track when new meteorite should added: var meteorites:array = new array(); var counter:int = 0; instead of adding event listener single meteorite add event listener stage , have trigger game loop: stage.addeventlistener(event.enter_frame, gameloop); function gameloop(e:event):void { counter ++; if (counter>=10) { // add new meteorite every 10 frames counter = 0; meteorites...

java - is it possible to edit a class file in tomcat and recompile that single file? -

i have exam system @ hand written tomcat , , found there bug in programme, don`t have source code, decompile using jd-gui, want simple, replace line of code resultset rs = conn.createstatement().executequery("select id examinee "); with resultset rs = st.executequery("select id examinee "); how can it,i want compile single java file class,i tried javac,but many errors, below decompiled file want modify package maozf.admin; import java.io.ioexception; import java.io.inputstream; import java.io.objectinputstream; import java.io.printwriter; import java.sql.connection; import java.sql.resultset; import java.sql.statement; import java.util.hashmap; import javax.servlet.requestdispatcher; import javax.servlet.servletcontext; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import javax.servle...