Posts

Showing posts from June, 2011

assembly - Segment ignored in effective address with nasm -

i trying write simple bootloader in x86 assembly using nasm. @ several places in code, have use effective address of form [es:di] . code compiles without error, @ run time, segment ignored. instance, for mov ax, 0x07c0 mov es, ax mov di, 0x10 lea eax, [es:di] right after lea , registers : eax=00000010 edi=00000010 es =07c0 00007c00 0000ffff 00009300 but eax should have been 7c10 . problem occurs @ point of program (including when nothing has been done before), , program runs in real mode. my question is: normal? missing something? how can fix this? intel's manual may not super clear on this. or may not obvious look, @ least. if read section 7.3.16.1 ( address computation instruction ), says: the lea (load effective address) instruction computes effective address in memory ( offset within segment ) of source operand , places in general-purpose register. so, yes, i'd result expected one.

How can I add horizontal-space in between columns, when using python to append several lists onto a file? -

for item in zip(xcoords, ycoords, zcoords): out = open("file.txt", "a") print (item) out.write( "ar" "%s %s %s \n" %(item)) out.close() i want 4 columns separate each other. code prints, ar123 ar213 ar312 have tried adding space this: item in zip(xcoords, ycoords, zcoords): out = open("file.txt", "a") print (item) out.write( "ar" " " "%s " " %s " " %s \n" %(item)) out.close() note added space putting " " in between.

Cordova : [Error: Please install Android target: "android-21" -

i updated cordova + ionic in app, after installed android-sdk v22 via android sdk manager. but after running command: cordova build android i following message: running command: /users/peter/workspace/myapp/platforms/android/cordova/build [error: please install android target: "android-21". hint: open sdk manager running: /users/peter/adt-bundle-mac/sdk/tools/android require: 1. "sdk platform" android-21 2. "android sdk platform-tools (latest) 3. "android sdk build-tools" (latest)] error building 1 of platforms: error: /users/peter/workspace/myapp/platforms/android/cordova/build: command failed exit code 2 may not have required environment or os build project error: /users/peter/workspace/myapp/platforms/android/cordova/build: command failed exit code 2 @ childprocess.whendone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) @ childprocess.emit (events.js:110:17) @ maybeclose (c

r - How do I write a loop to run and save outputs from a glm with multiple predictors -

i trying create function in r run glm on number of different columns of data in 1 matrix using predictors second matrix , write results matrix csv file. have managed single predictor glm using: x<- matrix(sample(10,100,t),10) colnames(x)<- c("f5", "f10", "f15","f20","f25","f30", "f35", "f40", "f45","f50") # matrix dependant variables y<- matrix(runif(10, min=1, max= 50)) #the matrix predictor m<-matrix(nrow=dim(x)[2],ncol=9) #the matrix store output in colnames(m)< c("species","intercept","slope","pval.i","pval.b","disp","dev.null","dev.res","dev.expl") #the headings of output file names species ns<-colnames(x) (k in 1:dim(x)[2]){ glm1<-glm(x[,k]~y,family=poisson) #calculate glm print(g1<-summary(glm1)) #print output in file # filling rows in results table m[k,

php - How to get a good parameter from an image for a future recognition -

i working on image recognition app using php , need find parameter store in database. have 5000+ image loop trought need kind of filter. using akaze ( based on opencv lib) , store number of keypoints returned akaze_features function think parameter not optimal. here have experience kind of problem? there other parameters besides keypoints use classification? appreciated.

javascript - jQuery 2.1 | Remove source substring of duplicate substring -

i wish preserve following (as opposed preceding) duplicated substring of comma-delimited string while removing preceding duplicating substring. 1- initial state of string before duplicate appended : aaa,bbb,ccc,ddd,eee 2- bbb dynamically appended string : aaa,bbb,ccc,ddd,eee,bbb 3- preceding bbb must removed : aaa,ccc,ddd,eee,bbb how can following function, or function matter, reproduce seek? function unique(list) { var result = []; $.each(list, function(i, e) { if ($.inarray(e, result) == -1) { result.push(e); } }); return result; } the quick , easy way reverse array, use duplicate removal function , reverse back: function unique(list) { var result = []; $.each(list, function(i, e) { if ($.inarray(e, result) == -1) { result.push(e); } }); return result; } var arr = ["aaa", "bbb", "ccc", "ddd", "eee", "bbb"]; console.log(unique(arr.reve

playframework - Play framework 2.3.8: Static assets not working in Production -

before week upgraded play (2.2.3) project 2.3.8. started app activator run when tried load image public folder in java controller, loaded , did not have issue. when try start app using, activator start it did not loads. seems there no public folder within in universal folder. caused problem. how resolve it? place our static assets in 2.3.8 project? how package production?

select - Selecting all record in mysqli -

i want select record in mysqli, using following syntax $stmt->get_result(); but getting single data, want select data , apply while loop on data. thanks in advance wrap in while loop: $stmt->get_result(); while ($row = $result->fetch_array(mysqli_num)) { $rs[]=$row; //or process here. } or use http://php.net/manual/en/mysqli-result.fetch-all.php

parsing - Is there a complete test for GLR parser? -

is there complete series tests test if glr parser correctly written? i'am writing glr parser, want find tests code. can't figured out complete test suit self because of missing conditions perhaps. i've written tests test parser. don't know if fail on other conditions. need "a complete test", may lot of people adding test cases test. promise parser can handle cases. glr parser can handle context-free grammar, lot of conditions needed tested.

ios - AFHTTPRequestOperationManager file upload returns 500 server error -

im trying upload camera taken photo webservice afnetworking. this upload part code : cgsize newsize = cgsizemake(500.0f, 500.0f); uigraphicsbeginimagecontext(newsize); [_imagedata drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; uiimage* newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); nsdata *imgdata = uiimagejpegrepresentation(newimage, 0.9f); afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; nsdictionary *parameters = @{@"user": "test_user"}; [manager post:@"http://www.mywebsite.com/webservice.aspx" parameters:parameters constructingbodywithblock:^(id<afmultipartformdata> formdata) { manager.responseserializer = [afhttpresponseserializer serializer]; [formdata appendpartwithformdata:imgdata name:@"image"]; } success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"success: %@", responseo

java - Best way to access a database -

i'm relatively new java. i'm tinkering small program uses jframe few fields query , insert database. i have class nothing creates database connection. there, have other classes perform select or insert database functions. each of these starts creating new object database connection class. connection closed when finished. being new this, wanted see if best way access database, ie: creating , closing brand new connection each time button pressed. performs task needed, if there's more efficient or sensible way i'd love know. i can provide whatever code may need see. thanks! usual way access database java connection pool. recommend one: http://jolbox.com/ in database interaction code creates connection pool (actually borrows connection pool) , after requests close connection (actually returns connection pool). public class dao { private final datasource ds; public void foo(...) { connection connection = ds.getconnection();

html - Issues with JavaScript clock -

i'm having issue modifying javascript code include seconds on clock displayed. i've tried highlight additions i've made source via \|/\|/ before , after section in both html , javascript. sorry if it's not clear. there isn't way bolden code sections. i understand html enough: <body> <div id="wrapper"> <div id="toppadding"><br><br><br><br></div> <br><br> <div id="clock"> <span id="hour"></span><span id="colon" class="on">:</span><span id="minute"></span> \|/\|/ <span id="colon" class="on">:</span><span id="second"></span> \|/\|/ <!-- <span id="suffix"></span> --> </div> <div id="thedate"> <span id="day"></span>, <

html - CSS hover text over image on hover -

Image
i following tutorial hover effect on images text pops , background turns dark. tutorial here . i having small problem hover effect, when mouse hovers on image, want image go dark , entire image covered, when set ul.img-list li height 100% takes 100% of text, can set height height of image, when height changes based on window size, won't cover properly. missing something? html: <div class="column large-6"> <ul class="img-list"> <li> <a href="#"> <img src="https://www.ricoh.com/r_dc/r/r8/img/sample_08.jpg" /> <span class="text-content"> <span>hello@!</span> </span> </a> </li> </ul> css: ul.img-list { list-style-type: none; margin: 0; padding: 0; text-align: center; } ul.img-list li { display: inline-block; height: 100%; margin: 0 1em 1em 0; position: relative; width:

aps - Why is enpoint.sh not creating a cert or a config directory -

why enpoint.sh not creating cert or config directory. when use script, creates , deploys scripts successfully. config folder , cert not created. there steps missing congratulations! endpoint configured successfully endpoint url: ......countermgmt this script not supposed create config directory or certificates. unpacks scripts package , creates .htaccess files redirect incoming requests. the config folder , certificates created when provision fist application instance.

java - Using private static nested class to implement Singleton -

i learning singleton pattern. learnt classic way implement create static field of singleton class type, hide constructor using private access modifier, , provide public getinstance() method. however, thought of way of implementing without using private constructors: public class swrapper { private static singleton holder = new singleton(); private static class singleton{ /* implementation without private constructor*/} public static singleton getinstance() { return holder; } question: implementation work? (i think can't sure.) if does, there advantages or disadvantages using implementation? it's singleton, it's eagerly initialized (not lazily initialized), it's not interesting. use of name holder suggests attempting initialization-on-demand holder idiom : public class singleton { private static class holder { static final singleton instance = new singleton (); } public static singleton getinstance() {

scala - Scalaz nested Validation: could not find implicit value -

playing scalaz validationnel, have following nested validations trying flatten: import scala.xml.{nodeseq, node, elem} import scalaz._ import scalaz._ val duration: validationnel[string, int] = // ... val nodes: validationnel[string, nodeseq] = // ... val r: validationnel[string, list[mytype]] = (duration |@| nodes) { (d, ns) => val n: validationnel[string, list[mytype]] = ns.tolist.traverse[({ type l[x] = validationnel[string, x] })#l, mytype](extractmytype(_, d)) n }.flatmap(identity) // ... private def extractmytype(n: node, d: int): validationnel[string, mytype] = //... when compiling sbt, get: [error] myclass.scala:xx: not find implicit value parameter f0: scalaz.bind[scalaz.unapply[scalaz.apply,scalaz.validationnel[string,int]]{type m[x] = scalaz.validationnel[string,x]; type = int}#m] [error] val r = (duration |@| nodes) { (d, ns) => ^ i using sca

Unable to install pip in Docker -

unable install pip in docker running ubuntu version 14.04. see below log. root@57da7dd8a590:/usr/bin# apt-get install pip reading package lists... done building dependency tree reading state information... done e: unable locate package pip root@57da7dd8a590:/usr/bin# did apt-get update before that? and then apt-get -y install python-pip

How to create a UIImageView in swift programatically in a separate function? -

i want programatically create image view in function. hold background of image view , logos - in other image views can function , wan't have same thing on each one. i created blank swift file , put following in it: import foundation import uikit func background() { var imageview : uiimageview imageview = uiimageview(frame:cgrectmake(10, 50, 100, 300)); imageview.image = uiimage(named:"image.jpg") self.view.addsubview(imageview) } the error got on self.view.addsubview(imageview) line. error message use of unresolved identifier 'self' . tried removing word self line said instead view.addsubview(imageview) use of unresolved identifier 'view' . my question doing wrong? thanks edit: so have changed now, correct? import foundation import uikit class myviewcontroller: uiviewcontroller { func background() { var imageview : uiimageview imageview = uiimageview(frame:cgrectmake(10, 50, 100, 300));

Referencing worksheets in excel spreadsheet by index rather than name in r -

im trying use xlconnect in order import worksheets datasource if use code below subsequent error library(xlconnect) wk = loadworkbook("/users/sebastianzeki/desktop/sequencingscripts/bedtools/bedtools2-master/cohortcomparisons/pancancercommonscnas.xlsx") amp_genesall_cancer = readworksheet(wk, sheet="amp_genes.all_cancer.txt", header=true) error: illegalargumentexception (java): sheet index (-1) out of range (0..25) one work around convert names numbers of worksheets still need have control on how each 1 imported rather importing 1 dataframe. not sure how though assuming wk = code runs correctly, , see 'formal class workbook' object appear, have misspelled sheet name. index -1 means string given title not match. to use indexes, use: amp_genesall_cancer = readworksheet(wk, sheet=1, header=true) with 1 being sheet number

mysql - SQL Query in PHP date -

i'have problem in sql query in php: if : $result = mssql_query("select xx x join x on x x = '".$var1."' , x between '20150401 00:00:00' , '20150401 23:59:59' ") that's work but if : $day=date("d/m/y",time()); $explodate = explode("/", $day); $datestart = $explodate[2].$explodate[1].$explodate[0]." 00:00:00"; $dateend = $explodate[2].$explodate[1].$explodate[0]." 23:59:59"; $result = mssql_query("select xx x join x on x x = '".$var1."' , x between '".$datestart."' , '".$dateend."' ") that's doesn't work ! i don't understand why have idea ? thanks kiss principle . date('y-m-d 00:00:00')."' , '". date('y-m-d 23:59:59') or $today = date('y-m-d'); // ... ... "between '" . $today . " 00:00:00' , '" . $today . "

ruby - Trouble installing compass for sass/scss -

i on mac (yosmite) , in terminal trying install compass can start using sass. run: sudo gem install compass and huge error: caspars-mbp:~ casparwylie$ sudo gem install compass building native extensions. take while... error: error installing compass: error: failed build gem native extension. /system/library/frameworks/ruby.framework/versions/2.0/usr/bin/ruby -r ./siteconf20150401-47466-qqmsir.rb extconf.rb checking ffi.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/system/library/frameworks/ruby.framework/versions/2.0/usr/bin/ruby --with-ffi_c-dir --with

r - Can't add points to a plot: Error: A continuous variable can not be mapped to shape -

i'm trying add points generated plot dataframe used in original plot looks this: > head(df) fa va ca rs ch fsd tsd d p s cluster q 1 7.4 0.29 0.50 1.8 0.042 35 127 0.99370 3.45 0.50 10.2 1 7 2 10.0 0.41 0.45 6.2 0.071 6 14 0.99702 3.21 0.49 11.8 2 7 3 7.8 0.26 0.27 1.9 0.051 52 195 0.99280 3.23 0.50 10.9 3 6 4 6.9 0.32 0.30 1.8 0.036 28 117 0.99269 3.24 0.48 11.0 1 6 5 6.8 0.37 0.28 1.9 0.024 64 106 0.98993 3.45 0.60 12.6 1 8 6 6.2 0.25 0.44 15.8 0.057 39 167 0.99804 3.14 0.51 9.2 3 5 i generate plot this: > ggplot(data=df, aes(x=p, y=tsd, color=cluster )) + + geom_point() + + geom_point(data=centers, aes(x=p,y=tsd, color='center')) + + geom_point(data=centers, aes(x=p,y=tsd, color='center'), size=52, alpha=.3, show_guide=false) now need add more points plot. dataframe want add looks this: > head(df2) fa va ca rs ch fsd tsd d

jquery - Reading in a local csv file in javascript? -

[edit] solved problem using d3 , nevermind thanks! so have csv file looks this, , need import local csv file client side javascript: "l.name", "f.name", "gender", "school type", "subjects" "doe", "john", "m", "university", "chem i, statistics, english, anatomy" "tan", "betty", "f", "high school", "algebra i, chem i, english 101" "han", "anna", "f", "university", "phy 3, calc 2, anatomy i, spanish 101" "hawk", "alan", "m", "university", "english 101, chem i" i need parse , output like: chem i: 3 (number of people taking each subject) spanish 101: 1 philosophy 204: 0 but now, stuck on importing javascript. my current code looks this: <!doctyp

android - VideoView inside Fragment -

edit: thought had problem implementation of fragment caused videoview not work, turned out implementation correct , had problem layout xml of videoview. ill keep code example of correct implementation of videoview inside fragment using viewpager:) this fragment: import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.media.mediaplayer; import android.media.thumbnailutils; import android.net.uri; import android.os.bundle; import android.provider.mediastore; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.imageview; import android.widget.mediacontroller; import android.widget.textview; import android.widget.videoview; import uk.co.senab.photoview.photoview; import uk.co.senab.photoview.photoviewattacher; public class screenslidepagefragment extends fragment { private context context = null; //todo make

javascript - Passing a function with parameters -

i want pass function parameters function without evaluating it. this method doesn't work: function first (id) {...} function second (func) { func(); } second(first(id)); this method can't use because number of parameters not same: function first (id) {...} function second (func, id) { func(id); } second(first, someid); you can use #bind partial application: second( first.bind(null, id) )

html - Wrapping items vertically inside DataList when re-sizing browser -

i have 3 column datalist , i'm trying wrap 3 items appear horizontally vertically. believe problem prevents happening 3 column datalist should change 1 column datalist. at moment i'm trying wrap 'boxer' divs verically no success. any ideas how achieve this? <div class="dottedx"> <div class="wrapping"> <asp:datalist id="datalist2" runat="server" datakeyfield="productid" datasourceid="sqldatasource2" bordercolor="black" cellpadding="5" cellspacing="5" repeatdirection="horizontal" repeatcolumns="3" borderwidth="0px" > <itemtemplate> <div id="boxer" class="column"> <asp:image id="image1" runat="server" imageurl='<%# "~/images/topimages/" & eval("image") %>' cssclas

c# - Check if a Winform CheckBox is checked through WINAPI only -

my problem goes : need check if winform checkbox different program checked or not winapi only. here how catch underlyined c# hwnd: first hwnd's of desktop enumwindows , enumchildwindows , go on each 1 , getwindowtext compares wanted text window text , if there match - return it. just make things clear - can catch underlying hwnd. if print text , class name winform checkbox wanted. now, checkbox want check has windowsform.10.button.app.0.33c0d9d5 class name. function ask if valid checkbox: bool isvalid(){ if(!handletocontrol) return false; long_ptr styles = getwindowlongptr(handletocontrol, gwl_style); bool ischeckbox = ((styles & bs_auto3state) == bs_auto3state); ischeckbox = ischeckbox || ((styles & bs_autocheckbox) == bs_autocheckbox); ischeckbox = ischeckbox || ((styles & bs_checkbox) == bs_checkbox); return ischeckbox; } now, function work (i checked on many native checkboxes , winform checkboxes) , can validate if it's val

html - stuck with positioning images using css -

Image
im making website, , need include page actress meryl streep. im trying postion image of beside awards. picture below shows page looks right now. wondering how make picture aligns right of text instead of below it? thanks. this html code: <div class="info"> <a id="awards"><h2>awards: </h2></a> <h3>academy awards</h3> <h4>won</h4> <ol> <li>best supporting actress (kramer vs. kramer) - 1979</li> <li>best actress (sophie's choice) - 1982</li> <li>best actress (the iron lady) - 2011</li> </ol> <h4>nominated</h4> <ol> <li>best supporting actress (the deer hunter) - 1978</li> <li>best actress (the french lieutenant's woman) - 1981</li> <li>best actress (silkwood) - 1983</li> <li>best actress (out of africa) - 1985</li> <li>best actress (ironweed) - 1987</li> <li>best actr

Concatenation of a variant number of keys of a dictionary Python (recursion?) -

hello stackoverlow members, i'm trying concatenate keys (string) on hand, , values (list) on other hand, of dictionnary. for better understanding, here have @ beginning: dict = {'bk1': {'k11': ['a1', 'b1', 'c1'], 'k12': ['a2', 'b2', 'c2']}, 'bk2': {'k21': ['d1', 'e1'], 'k22': ['d2', 'e2'], 'k23': ['d3', 'e3']}, 'bk3': {'k31': ['f1', 'g1', 'h1'], 'k32': ['f2', 'g2', 'h2']} } and here @ end: newdict = {'k11_k21_k31': ['a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1'], 'k11_k21_k32': ['a1', 'b1', 'c1', 'd1', 'e1',

git - Ansible SSH private key in source control? -

i have been developing ansible playbook couple of weeks, therefore, experience such technology relatively short. part of strategy includes using custom ansible_ssh_user provisioning hosts throughout inventory, however, such user need own ssh key pair, involve sort of plan holding/storing correspondent private key. on production environment, playbook cloned/pulled , run inside playbook node role provision rest of infrastructure. at first, thinking put private key inside playbook git repository, having second thoughts nonetheless, because of obvious security reasons , common sense around it, hence reason need consult matter. with set on table, here follow-up questions: in ansible-based development environment, sane/reasonable hold private ssh key in source control? would practice advised only development environments whereas local git branch inside playbook node used hold actual production ssh private key? would better address case scenario via ansible vault instead?, ha

javamail - Unable to read BCC field of sent mails in java -

i facing 1 problem while extracting bcc address incoming mail. here sample code used. public emailvo dumpenvelope(message m) throws exception { emailvo emailvo = new emailvo(); if ((addresses = m.getrecipients(message.recipienttype.bcc)) != null) { emailvo.setbcc(this.getaddresses(addresses, "bcc")); } } i getting null value in bcc. while debugging found bcc recipient's name in header field not able access header. code issue or there specific setting while sending mail not include bcc fields? you can check message object contains details mails. bcc part of mail hidden, per knowledge can retrieve information mail headers. address[] addresses = m.getheader("your header name here"); this give details regarding particular header tag in mails. for e.g. address[] addresses = m.getheader("delivered-to"); this tag give information recipients of mail, include bcc. you can add custom headers

javascript - Refresh form (Ctrl+F5) doesn't fire Retrieve Plugin in CRM 2011 -

i need update entity1 based on creation of entity2 (math calculation) while form of entity1 open. when refresh entity1 form, field has old value until close , open entity1 form (the caching issue). i found out doesn't fire retrieve plugin. there way overcome issue refreshing form? first , foremost: latest crm has xrm.page.data.refresh() update form data "automagically" (not mention fact fields self-refresh when changed via plugins). if upgrading not option, i'd setup "watcher" function this: // attach form load event function keepyourfieldinsync() { setinterval(function(){ var current = xrm.page.getattribute("yourfield"); // not shown here, updated value server var fetched = fetch_yourfield_value_from_odata_or_soap(); if(fetched != current){ xrm.page.getattribute("yourfield").setvalue(fetched); // if users aren't allowed set field han

wpf - Re establishing clients connection with WCF service -

i have wpf application communicates wcf service provides data updated wpf application on ui on continues basis. service hosted on nettcp. now, if reason wcf app loses lan connection , after few seconds connection established again, wpf app not able resume connection service. welcomed. you make socket on wpf client, accept connection service, if service online again sends data packet in collection connected, if client recieves packet requests connection service again, "resume" connection

Currying a function with a variable in J -

i can create function multiplies 2 2&\* , , indeed 20 = (2&\*)10 what want create factory-function makes these order. so, want monad f s.t. ( f y ) x == (y * x ) whilst (\*& 2) 3 works ((\*&) 2) 3 doesn't, trying explicitly: (3 : 'y&*') 2 produces syntax error. where going wrong ? a verb creates verb adverb 1 in j: f =: 1 : 'm&*' 2 f 2&* (2 f) 5 10 (i.10)f 5 0 5 10 15 20 25 30 35 40 45 or tacitly: f =: &* 2 f 2&* h =: 3 :'...' won't work because produces verb , h y wants noun. g =: 4 :'x&* y' fine , equivalent f . [1]: or conjunction

c# - How to unload unsued COM objects/libraries after a complete restart? -

here thing. i'm connecting via com devices @ knx/eib. - , want ready worst-case anyways - application crashes leaving objects , libraries exposed somewhere, somehow. noticed when restart app have trouble connection again. error connection procedure working normally. connect procedure working not, randomly. bad! after time (several minutes) seems work again after series of complete fails. think see pattern now. doesn't work after crash no clean disconnect. guess there objects hold connection device why can't new connection. why ask question. question: how unload unused objects kill undead connections? how make windows check unused libraries unloaded? i want tell windows, "i messed badly , need continue work. please clean mess me, can start fresh! deserve 2nd chance?" edit: scenario app has crashed , closed. have no references anymore. no clause or anything. app can started again. can clean mess has been made before, programmatically? edit 2: hans

How to wait for result of speech recognition in android? -

i using recognition listener speech recognition in android. basic construct of class follows: class speechinput implements recognitionlistener { intent intent; speechrecognizer sr; boolean stop; public void init() { sr = speechrecognizer.createspeechrecognizer(context); sr.setrecognitionlistener(this); intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model,recognizerintent.language_model_free_form); intent.putextra(recognizerintent.extra_calling_package,context.getpackagename()); intent.putextra(recognizerintent.extra_max_results,3); } ... } i stuck in situation want run android recognition listener in loop, on lines of: for(int i=0; i<n; i++) { // processing code sr.startlistening(intent); } now, want wait output before starts listening again. in order achieve this, tried use locking mechanism follows: for(int i=0; i&l

php - i want to use left and inner join in 3 tables in mysql? -

these tables. first 1 appusers table. create table if not exists `appusers` ( `id` int(11) unsigned not null auto_increment, `email` varchar(50) not null, `is_active` tinyint(2) not null default '0', `zip` varchar(20) not null, `city` text not null, `country` text not null, `created` timestamp not null default current_timestamp on update current_timestamp, primary key (`id`) ) engine=innodb default charset=latin1 auto_increment=23 ; second table stickeruses table. create table if not exists `stickeruses` ( `id` int(11) not null auto_increment, `user_id` int(11) not null, `sticker_id` int(11) not null, `count` int(11) not null, primary key (`id`) ) engine=innodb default charset=latin1 auto_increment=24 ; third table devices create table if not exists `devices` ( `id` int(11) not null auto_increment, `user_id` int(11) not null, `regid` varchar(300) not null, `imei` varchar(50) not null, `device_type` tinyint(2) not null, `notification` tinyint(2) not null default

php - try to develop a own Extension , it can not running on xampp. the own dll was complied vs2012 -

when start xampp apache server shows warning: php starup: myext : unable initialize module module compiled build id=api20131226 ,ts php compiled build id=api20131226 ,ts,vc11 these options need match but compiled project vs2012 my xampp version xampp-win32-5.6.3 my php src code 5.6.3 vc11 my english bad. add '#define php_compiler_if "vc11"' @ cpp beginning

Php check if image is greyscale function memory leak -

i'm using function check if image greyscale or not, file paths , names loaded in correctly , runs fine. however it's started give usual memory exhausted errors i'm wondering causing this? fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 32 bytes) in ... on line 51 the line 51 $b[$i][$j] = $rgb & 0xff; how can optimize function use less memory, possibly half image work out average or if average high? function checkgreyscale(){ $imginfo = getimagesize($this->filelocation); $width = $imginfo[0]; $height = $imginfo[1]; $r = array(); $g = array(); $b = array(); $c = 0; ($i=0; $i<$width; $i++) { ($j=0; $j<$height; $j++) { $rgb = imagecolorat($this->file, $i, $j); $r[$i][$j] = ($rgb >> 16) & 0xff; $g[$i][$j] = ($rgb >> 8) & 0xff; $b[$i][$j] = $rgb & 0xff; if ($r[$i][$j] == $g[$i][$j] &&am

android - Viewpager is Not Scrolling when kept with Recylerview -

Image
i using viewpager , recyclerview in framelayout. <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".homeactivity"> <android.support.v4.view.viewpager android:id="@+id/top_container" android:layout_width="match_parent" android:layout_height="300dp" /> <android.support.v7.widget.recyclerview android:id="@+id/regular_view" android:cliptopadding="false" android:paddingtop="300dp" android:layout_width="match_parent" android:layout_height="match_parent" /> i want hide viewpager on scroll of recyclerview vertically. working. scroll of viewpager not working. why happening ? here example drawer layout used implement left navigation drawer

Wordpress http post 404 -

i have error in wp every time http post 404 i have ready error field names , not that, if fields named random names, or no fields, still 404 error. it happens http post 404, if on same server or not. this happens when permalink set "post name" any fixing error gratefully appreciated cleared cache , restarted router (dynamic ip) , worked, host must have confused me hacker

jquery - is it possible to style the overflow of a div to have a lower opacity -

i trying implement twitter-like image cropper. have image loaded div handles cropping wonder there way can show overflow of div @ lower opacity inside div? cant find styling rules accomplish this. <div style="position: relative; width: 300px; height: 300px;" class="jwc_frame"> <img src="data:image/" style="position: absolute; top: 0px; left: 0px; width: 300px;" class="jwc_image" id="preview"><div class="jwc_loader">upload image</div> </div> you may use trick: fiddle inside container i've put 2 div same image. 1 "crop" , other full image , opacity (at half), make opacity image have overflow visible , place crop 1 on other position absolute. .image { width:400px; height:300px; overflow:visible; opacity:0.5; } .image-top { width:400px; height:300px; overflow:hidden; position:absolute; top:0; left:0; }

java - String !equals of edittext not working -

with of cursor c , c1 ,i checking 2 database edittext.if not equal,then move notfound activity. below posted code: if (c.getcount() > 0) { ..... .... } else if(c1.getcount()>-1){ .... .... } else{ if(!(edittext.gettext().tostring()).equals("c") && (!(edittext.gettext().tostring().equals("c1")))) { ---->not working intent i2=new intent(plate.this,notfound.class); startactivity(i2); } } my problem if(!(edittext.gettext().tostring()).equals("c") && (!(edittext.gettext().tostring().equals("c1")))) not working.i not sure what's wrong in that. the expression in if statement seems little muddled there parentheses in statement changes how works: !(edittext.gettext().tostring()).equals("c") && (!(edittext.gettext().tostring().equals("c1"))) if simplify it, calling first expression edittext.gettext().tostring() new variable a (notic

git - Django rest framework and south migrations inside my repo - how to set it up correctly? -

i'm using django==1.6.5 , djangorestframework==3.0.3 south==0.8.4 . , using virtualenv. in settings installed_apps have both rest_framework.authtoken , rest_framework . isn't rest_framework.authtoken redundant? when run migrations creates migrations in /users/andi/.virtualenvs/my_virtualenv/lib/python2.7/site-packages/rest_framework/authtoken/migrations , of course not in project's repo. question: how can set django rest framework produce migrations inside project directory, that, after running schemamigration locally, thing have run on server migrate ? you using django 1.6.5, in version migrations not introduced may give error on running migrations because django rest framework auth token migration tries import migrations django.db upgrade south package 0.8.4 1.0.1 version solve problem please check following link related south version 1.0.1 http://south.readthedocs.org/en/latest/releasenotes/1.0.html

java - Communication error between jsp and servlet? -

there dropdown list in jsp page in there several websites name e.g google.com etc. , there textbox used keyword search. also there servlet file used webcrwaling. when select of url dropdown shoukd connect servlet retrive links of particular keyword. how achieve pls help.. .jsp file <%@ page import="java.sql.*" %> <%resultset rs=null; %> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title> select website name dropdownlist </title> <link href="desktop/style.css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="8b4513"> <% connection conn=null; try { class.forname("com.mysql.jdbc.driver").newinstance(); conn=drivermanager.getconnection ("jdbc:mysql://localhost:3306/tendermysql","root","root"); statement stmt=conn.cr

ios - how to use AVKit to playback the HTTP stream video -

var url:nsurl! = nsurl(string: "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8") var playitem:avplayeritem! = avplayeritem(url: url); var player:avplayer! = avplayer(playeritem: playitem); var playerlayer:avplayerlayer! = avplayerlayer(player: player); self.view.layer.addsublayer(playerlayer); player.play() when run these code, there crash, told me how use avkit playback video? thx ^ ^ try this: //stream url let movieurl:nsurl? = nsurl (string: "http://your url") if let url = movieurl { self.avplayer = avplayer(url: url) self.avplayerviewcontroller.player = self.avplayer } //button action @ibaction func live(sender: uibutton) { self.presentviewcontroller(self.avplayerviewcontroller, animated: true) { () -> void in self.avplayerviewcontroller.player?.play() }

user interface - GUI customisation support in Reporting/OLAP servers -

i have been researching olap servers such tableau, jasper, birt ihub, etc. appears none of them provide reasonable support customise user interface. of them use browser rendering system changing default screens or "viewer" windows not encouraged (possible?). i not want write full fledged j2ee application , drop jar files in war. have done in past , expecting improved support type of requirements. any pointers? thanks additional info. may swiss tool, iccube, can you. iccube ships in-memory olap engine , built in web reporting application. can embed software seamless in other web applications, adjusting look-and-feel , customer branding relatively simple. as reseller of iccube in netherlands, have implemented iccube @ several clients looking affordable dashboard solution blend product. based on our customers' enthusiasm think can succeeded in that. you can view live demo's on our website. tons of info available @ iccube´s site. if want more, can