Posts

Showing posts from February, 2012

javascript - When I get data with ajax I cant Post it -

product.php function getdata(getdatafrom, resultclass){ $.get(getdatafrom, function(data) { $(resultclass).html(data); }); } getdata('get.php?action=porsiyondurum2&id=<?php echo $urunid; ?>','#porsiyondurum2'); get.php $action = htmlspecialchars(mysql_real_escape_string($_get['action'])); if($action=="porsiyondurum2"){ $id = htmlspecialchars(mysql_real_escape_string($_get['id'])); $urunporkont = mysql_query("select * porsiyon urunid='$id'"); $urunporkonts = mysql_num_rows($urunporkont); while($urunporkontv = mysql_fetch_array($urunporkont)){ $porid = $urunporkontv['id']; $porname = $urunporkontv['name']; $porucret = $urunporkontv['ucret']; echo '<tr><form action="post.php?action=porguncelle&id='.$porid.'" method="post" targ...

ios - The number of digits on textField -

i'm working on app , need on uitextfield . i want make number of digits appear specific (e.g. 3) knowing numbers shown on uitextfield value of slider between range of 1 0 (i need range,) numbers between them (0.5 , 0.6 ...). the numbers getting 6 digits (0.123456) , show less that. i have tried funcion after added uitextfielddelegate : func textfield(textfield: uitextfield, shouldchangecharactersinrange range: nsrange, replacementstring string: string) -> bool { ... } but it's not working. got 1 use function: @ibaction func testfield(sender: uitextfield) { let thelength = sender.text!.characters.count if thelength = >= 3 { let therange = range(start: sender.text!.startindex, end: sender.text!.startindex.advancedby(3)) var newdi = sender.text!.substringwithrange(therange) sender.text = newdi } } also nothing changed. note: have more uitextfields fix. use this. textfield.text = string(format: "%0.1f...

vectorization - Vectorize MATLAB code -

let's have 3 m-by-n matrices of equal size: a , b , c . every column in c represents time series. a running maximum (over fixed window length) of each time series in c . b running minimum (over fixed window length) of each time series in c . is there way determine t in vectorized way? [nrows, ncols] = size(a); t = zeros(nrows, ncols); row = 2:nrows %loop on rows (except row #1). col = 1:ncols %loop on columns. if c(row, col) > a(row-1, col) t(row, col) = 1; elseif c(row, col) < b(row-1, col) t(row, col) = -1; else t(row, col) = t(row-1, col); end end end this i've come far: t = zeros(m, n); t(c > circshift(a,1)) = 1; t(c < circshift(b,1)) = -1; well, trouble dependency else part of conditional statement. so, after long mental work-out, here's way summed vectorize hell-outta everything. now, approach ba...

php - My PDO Statement doesn't work -

this php sql statement , it's returning false while var dumping $password_md5 = md5($_get['password']); $sql = $dbh->prepare('insert users(full_name, e_mail, username, password, password_plain) values (:fullname, :email, :username, :password, :password_plain)'); $result = $sql->execute(array( ':fullname' => $_get['fullname'], ':email' => $_get['email'], ':username' => $_get['username'], ':password' => $password_md5, ':password_plain' => $_get['password'])); if pdo statement returns false , means query failed. have set pdo in proper error reporting mode aware of error. put line in code right after connect $dbh->setattribute( pdo::attr_errmode, pdo::errmode_exception ); after getting error message, have read , comprehend it. sounds obvious, learners ove...

Read TTL from an ICMP message received via Python raw sockets -

i'm building traceroute-ish tool determine number of hops required udp packet reach address using 1 probe. this, want extract ttl icmp message receive after sending probe. i'm doing following , receiving icmp message: data, source = in_socket.recvfrom(d_bufsize) but have no idea how turn data can read ttl from. in_socket declared this: in_socket = socket.socket(socket.af_inet, socket.sock_raw, icmp_proto) here, icmp_proto protocol number icmp (obtained doing icmp_proto = socket.getprotobyname("icmp") ). any appreciated! but have no idea how turn data can read ttl from. pyping way: def header2dict(self, names, struct_format, data): """ unpack raw received ip , icmp header informations dict """ unpacked_data = struct.unpack(struct_format, data) return dict(zip(names, unpacked_data)) … packet_data, address = current_socket.recvfrom(icmp_max_recv) icmp...

java - Best practice for Decorator design pattern -

in right place decorator design pattern shines, noticed in many applications few mistakes made while using decorator. an exemple (using java.io ) demonstrate problem bad using of decorator. public outputstream foo(...){ return new bufferedoutputstream(...); } the problem method, return bufferedoutputstream outputstream , user may decorate again object bufferedoutputstream (he don't know method return buffered stream), here got double buffering free (worsing more performance nothing). another exemple : public void foo(outputstream os){ bufferedoutputstream bos = new bufferedoutputstream(is); ... } here exemple, user may supply bufferedoutputstream foo decorate internal use, user may want increase performance providing buffered stream, in reality he's making more worse, not fault, don't know method inside (black box). so can tell me best practices using decorator design pattern, not java.io general use decorator?

java - Test a Spring Controller with JUnit that depends of Spring Security -

i have spring application , building junit tests test controller . the problem inside controller call code: final authentication authentication = securitycontextholder.getcontext().getauthentication(); final string username = authentication.getname(); in other words, need authenticate before calling controller . wrote junit test code: private mockmvc mockmvc; @test public void getpagetest() throws exception{ final processfilecontroller controller = new processfilecontroller(); mockmvc = standalonesetup(controller).build(); mockmvc.perform(get(uri.create("/processfile.html")).sessionattr("freetrialemailaddress", "")).andexpect(view().name("processfile")); } and when run gives me nullpointerexception right on final string username = authentication.getname(); because authentication null since did not login. the question is: there way mock authentication? ideas welcome. thank you. ...

django - Models not linked after resolving circular import issue -

i'm creating app allows users create reviews of locations. had issue circular imports in django resolved after looking @ post: django - circular model import issue what did rid of import in locations.models , lazy import of review model. in django admin, can create review , assign location. however, when open location in django admin, doesn't have linked reviews. haven't found far suggest why location not showing review created. or tips appreciated. django = 1.9 python = 2.7 thanks locations.models.py: class location(models.model): ... reviews = models.foreignkey('reviews.review', null=true, blank=true, related_name="location_reviews") reviews.models.py: from locations.models import location class review(models.model): ... location = models.foreignkey(location, on_delete=models.cascade) if have foreign key review.location , means each review belongs 1 location. class review(models.model): ... locati...

Add ViewPagerIndicator Library Project to my Project in Android Studio -

the viewpagerindicator open source project useful in android apps indicating viewpager page user viewing. want add open source project project working on. question is, how do this? should take out individual files needed viewpagerindicator , add them project? should import entire viewpagerindicator project project? normal practice using open source projects this? should noted viewpagerindicator not , cannot standalone jar file according github page. i went file > project structure > modules > clicked + sign > import modules, chose project. had delete sample part , keep library part. had remove android support jar, , when had compile errors, had whatever android studio told me solution red light bulb.

c# - Avoid Null Checking by using lambdas -

in article avoid null checks replacing finders tellers author gives ruby example avoid null checking, if object returned block run, if not isn't. data_source.person(id) |person| person.phone_number = phone_number data_source.update_person person end i'd same thing in c# using lambda function having trouble coming example same type of thing. create object factory accept id number , lambda function? well don't know ruby , don't understand exact example given, suspect like: datasource.update(id, person => person.phonenumber = phonenumber); where datasource.update would: have signature of void update(string id, action<person> updateaction (or possibly return bool indicate whether or not found person) be implemented as: find person given id if doesn't exist, return immediately otherwise, execute given action, , update backing store modified object or more (and closer original ruby): datasource.withperson(id, person =...

java - How can I use SQLite in Quartz? -

i'm trying use quartz sqlite in application . when read documentation here notice didn't mention sqlite among databases available. say: jdbcjobstore works database, has been used oracle, postgresql, mysql, ms sqlserver, hsqldb, , db2. use jdbcjobstore, must first create set of database tables quartz use. can find table-creation sql scripts in “docs/dbtables” directory of quartz distribution. so, question: which setup script use setting quartz sqlite table? use derby script applied sqlite script. the problem when trying schedule trigger in previous inserted job. part of code: // , start off scheduler.start(); map<string, string> map = new hashmap<>(); map.put("key", "value"); jobdatamap jdm = new jobdatamap(map); jobkey key = new jobkey("job1", "key1"); if(!scheduler.checkexists(key)){ jobdetail job = newjob(hellojob.class).withidentity(key).storedurably().usingjobdata(jdm).build(); addj...

count - MySql: hard match on same table -

i have table containing products shop's orders +----------------------------+ | orders_id | products_model | +----------------------------+ | 1000 | aa0000001 | | 1000 | bb0000002 | | 1000 | cc0000001 | | 1001 | aa0000001 | | 1002 | bb0000001 | | 1003 | cc0000001 | | 1004 | bb0000001 | | 1004 | aa0000001 | +----------------------------+ every order can have, of course, 1 or more items i need list of orders containing items code starting aa or bb (or both) don't want list orders containing items code starting evey other code type. example: +-----------+ | orders_id | +-----------+ | 1001 | | 1002 | | 1004 | +-----------+ order 1000 has excluded because has 'cc' item beside 'aa' , 'bb' ones order 1003 has excluded because has 'cc' item i started experimenting compare count of matching records , count of records every order........

sql - Casting varchar as date -

i think i've read every thread on topic , none of them solving problem. first of all, database i'm working has date fields set varchar data type, drives me insane because have cast or convert whenever i'm working queries involving dates. the query i'm working @ moment supposed pull list of medical patients have diagnosis, diagnosis has have been given before date. here's i've got. select distinct pd.patientid, pd.patientname, pmh.dateofonset pmh.diagnosiscode patientdemographic pd join patientmedicalhistory pmh on pd.patientid = pmh.patientid pmh.diagnosiscode = '401.1' , cast(pmh.dateofonset date) > cast('12/31/2014' date) i'm getting error says "conversion failed when converting date and/or time character string." it's telling me error on line 1 though (the select distinct line) that's not helpful , i'm not sure need fix. as mentioned, dateofonset field has varchar data type, , n...

java - How to property file value in Spring boot config class -

how use application.properties file in config class application.properties datasource.username=test config.class @configuration @enabletransactionmanagement @enablejparepositories( entitymanagerfactoryref = "abcfactory", transactionmanagerref = "abcmanager", basepackages = { "com.emp.repository" }) public class empconfig { @value("${datasource.username}") string username; @bean(name = "empdatasource") public datasource empdatasource(string url, string username, string pwd) { drivermanagerdatasource datasource = new drivermanagerdatasource(); datasource.setdriverclassname("xxx"); datasource.seturl(url); datasource.setusername(username); datasource.setpassword(pwd); return datasource; } } how can pass property in username set field. depending on how ini...

r - Plotting dose response curves with ggplot2 and drc -

Image
in biology want plot dose response curves. r package 'drc' useful , base graphics can handle 'drm models'. however, add drm curves ggplot2. my dataset: library("drc") library("reshape2") library("ggplot2") demo=structure(list(x = c(0, 1e-08, 3e-08, 1e-07, 3e-07, 1e-06, 3e-06, 1e-05, 3e-05, 1e-04, 3e-04), y1 = c(0, 1, 12, 19, 28, 32, 35, 39, na, 39, na), y2 = c(0, 0, 10, 18, 30, 35, 41, 43, na, 43, na), y3 = c(0, 4, 15, 22, 28, 35, 38, 44, na, 44, na)), .names = c("x", "y1", "y2", "y3"), class = "data.frame", row.names = c(na, -11l )) using base graphics: plot(drm(data = reshape2::melt(demo,id.vars = "x"),value~x,fct=ll.4(),na.action = na.omit),type="bars") produces nice 4-parameter dose response plot. trying plot same plot in ggplot2, stumble upon 2 issues. there no way of directly adding drm model curve. need rewrite 4-pl function , add in f...

memory - How MySQL client and PDO receive big result with fetch method -

if had big table (1m rows) i send select * table (without limit, ...) i use pdo prepared query i fetch result only one pdo::fetch method (not fetchall) what happens @ mysql communication layer? 1) mysql server send rows mysql client , mysql client send first row php? (so lot of memory used on php server , mysql server) 2) mysql client fetch 1 row on network mysql server? (so lot of memory used on mysql server only) (php 5.3.3 , libmysqlclient1.6) it depends on buffering mode choose , mysql client version. in case data used in mysql server side. buffered , unbuffered queries

jquery - Javascript join two json and compare -

i have code: var json = '[{"id":113,"price":55,"start":"sun, 24 apr 2016 00:00:00 +0000","user_id":8},{"title":"","start":"2016-04-25t23:00:00.000z","price":"115.7"},{"title":"","start":"2016-05-06t23:00:00.000z","price":"115.7"},{"id":114,"price":45,"start":"sun, 08 may 2016 00:00:00 +0000","user_id":9},{"title":"","start":"2016-05-08t23:00:00.000z","price":"115.7"},{"id":111,"price":55,"start":"wed, 01 jun 2016 00:00:00 +0000","user_id":11},{"title":"","start":"2016-06-01t23:00:00.000z","price":"115.7"},{"id":110,"price":53,"start":"fri, 03 jun 2016 00:00:0...

define a terminal that is a subset of ID in xtext -

i to create terminal can matched id, not fully. while id terminal id : '^'?('a'..'z'|'a'..'z'|'_') ('a'..'z'|'a'..'z'|'_'|'0'..'9')*; the terminal define is terminal type: (('a'..'z'|'a'..'z')?('a'..'z'|'a'..'z'|'_'|'0'..'9')*)? because type can match id getting rule_id errors, can in case? ______edit__________ domainmodel : (elements+=xtype)*; terminal type: ('a'..'z'|'a'..'z')('a'..'z'|'a'..'z'|'0'..'9'|'_')*; myid: type | id ; xtype: datatype | entity; datatype: 'datatype' name=myid; entity: 'entity' name=myid ('extends' supertype=[entity])? '{' (features+=feature)* '}'; feature: (many?='many')?...

java - JavaMail API has trouble to work with the Gmail -

i'm working on tutorial @ http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/javamail/javamail.html shows how send email javamail api. so wrote following code snippet public class emailsessionbean { private int port = 465; private string host = "smtp.gmail.com"; private string = "xxx@gmail.com"; private boolean auth = true; private string username = "xxx@gmail.com"; private string password = "mypassword"; private protocol protocol = protocol.smtps; private boolean debug = true; public void sendemail(string to, string subject, string body) { // create properties object contain settings // smtp protocol provider. properties props = new properties(); props.put("mail.smtp.host", host); props.put("mail.smtp.port", port); switch (protocol) { case smtps: props.put("mail.smtp.ssl.enable", true); break; case tls: props.put...

javascript - How to change window center and width of an image on mouse move event -

i have dicom image , want apply w/l on image. in normal terms, trying change color of image drag mouse on it. becomes white when try change it. here's doing. this part of code. var imagedata = ctx.getimagedata(0, 0, img.width, img.height); var data = imagedata.data; var pixels = imagedata.data, len = pixels.length; var = 256 * slope / window_width, b = 256 * ((intercept - window_level) / window_width); (i = 0; < len; += 4) { //pixval = * (pixels[i] * 256 + pixels[i + 1]) + b; //pixels[i] = pixels[i + 1] = pixels[i + 2] = pixval if (pixels[i + 3] == 0) continue; var pixelindex = i; var red = pixels[pixelindex]; // red color var green = pixels[pixelindex + 1]; // green color var blue = pixels[pixelindex + 2]; // blue color var alpha = pixels[pixelindex + 3]; var pixelvalue = * (red * 256 + green + b); pixels[i] = pixels[i + 1] = pixels[i + 2] = pixelvalue; pixels[i + 3] = 0xff; //console.log(pixelv...

Moving a sprite (SpriteKit) along a UIBezierPath in steps -

Image
i able generate uibezierpath use skaction.followpath in order make sprite follow path after calling runaction. this, can make sprite follow bezier path start of path endpoint. however, i'm going following: generate fixed path, such uibezierpath this path have 10 points along it using button press, move sprite (currently on starting point along path) 1 "move" along next point. using button presses, i'll continuously move sprite along fixed path in 10 discrete steps probably similar example i'm trying achieve candy crush level map. in this, have curvy path along there points move character along in discrete steps. thank help! instead of using bezier path why not store points in array. each time touch button pop off end of array , skaction.moveto(yourpoint)

php - Symfony : Error creating form (BirthdayType) and methods note functionning proprely -

i've been trying create form people can create account in database. the form ask 3 things : first name, last name , date of birth (text in french in code). i keep on having these errors : neither property "startdatetime" nor 1 of methods "addstartdatetime()"/"removestartdatetime()", "setstartdatetime()", "startdatetime()", "__set()" or "__call()" exist , have public access in class "appbundle\entity\candidats". is because didn't declare type correctly in entity when created ? here's entity class : <?php namespace appbundle\entity; use doctrine\orm\mapping orm; /** * candidats * * @orm\table(name="candidats") * @orm\entity */ class candidats { /** * @var string * * @orm\column(name="nom", type="string", length=30, nullable=false) */ private $nom; /** * @var string * * @orm\column(name...

java - Translucent JLabel not properly showing background -

i have following line: label.setbackground(new java.awt.color(0, 150, 0, 50)); i place in mousereleased method within mouseadapter. basically, want make label highlight in translucent green when click on it. i have several labels in panel, mouseadapter added them. my problem this: -when click on label, shows translucent green color, showing background of jlabel, not 1 click on. no matter label click on, paints background of same label. -whenever click on label, repeats same background. -weirdly, every time click on jlabel, opacity of green color seems increase, if painting translucent green on each time click on new jlabel. any tips on what's going on? should try post sscce on this? or there simple answer i'm missing. reason didn't post sscce yet code large , spread across multiple files, must trim out first. see backgrounds transparency probable problem , couple of solutions.

ios - Swift CGAffineTransformScale to a scale, not by a scale -

let's scale uilabel using cgaffinetransformscale so: let scale = 0.5 text = uilabel(frame: cgrectmake(100, 100, 100, 100)) text.text = "test" uiview.animatewithduration(2.0, delay: 0.0, options: uiviewanimationoptions.curveeasein, animations: { self.text.transform = cgaffinetransformscale(self.text.transform, scale, scale) }, completion: {(value : bool) in print("animation finished") }) this works great when want scale uilabel half. if call same code again, end scale of 0.25, scales again half. would possible use cgaffinetransformscale scale size of half original uilabel frame, instead of scaling cumulatively? swift 3 : text.transform = cgaffinetransform.identity uiview.animate(withduration: 0.25, animations: { self.text.transform = cgaffinetransform(scalex: scale, y: scale) })

vba - Requery combo boxes in Access 2013 -

i've created 2 dependent combo boxes in form. if choose category in first box, filter list of products available in second. i've saved category-product selections table called test , categories 1 row each. what i'd display product in product combo box if select category in test. example, if select category=condiments , product=ketchup in form, it's added test. then, next time select category=condiments in form, products combo box (the box type, not dropdown) show ketchup. seems work if have 1 row in test. if add more rows, productcombobox not change. here's how form constructed. in rowsource categorycombobox, select everything select * categorytable in rowsource productcombobox, filter products based on category selected select * producttable producttable.categoryid=[forms]![formtest]![category] the form source products left joined category on categoryid. in on change event categorycombobox , on current event form, requery productcombobox pro...

Android Studio doesn't generate Drawable from VectorDrawable for old versions -

i use android studio 2.0 , support vectordrawable library. gradle: android { compilesdkversion 23 buildtoolsversion "23.0.3" defaultconfig { minsdkversion 8 vectordrawables.usesupportlibrary = true } aaptoptions { additionalparameters "--no-version-vectors" } } but when try load icon in menu on old device: menuitem misubjects = menu.add(r.id.menu_navigation, action_subjects_id, order, r.string.action_subjects); misubjects.seticon(contextcompat.getdrawable(this, r.drawable.ic_labels_gray_24dp)); icon vector androidstudio must generate , drawable old versions (raster drawable). if isn't when how need use it? vector example ic_labels_gray_24dp.xml <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportheight="24.0" android:viewportwidth="24.0"> <path...

java - Android - Memory Leak? -

Image
based on below picture , fact number of objects grows on time. safe there memory leak in code? also, how go debugging it? first can use memory monitor watch memory change,according this . second can run app , click "cause gc" button gc,if allocated heap size growing more , more,then can try mat here .

c++ - How do I stop Qt's setStyleSheet from resetting designated colors on my form and buttons? -

so i've got 152 qpushbuttons in program. each button represents item , each item has color designating status. code below colors right button when asked user input, however, when code colors specific widget, resets other styles have on form. reset includes buttons colored code. how stop this? here simplified code: qstring input = qstring(ui -> lineedit -> text()); ui->lineedit->clear(); int number = input.toint(); if(status[number] == 1) { qstring stylestring = qstring("#shelf"+input+"{background-color: rgb(0, 150, 255);}"); this->setstylesheet(stylestring); } else if(status[number] == 2) { qstring stylestring = qstring("#shelf"+input+"{background-color: rgb(255, 0, 0);}"); this->setstylesheet(stylestring); } else if(status[number] == 3) { qstring stylestring = qstring("#shelf"+input+"{background-color: rgb(0, 255, 0);}"); this->setstylesheet(stylestring); } you should set styleshe...

java - Lockback exclude logger from root -

i have few packaged , want separate logging. <property name="a" value="com.a"/> <property name="b" value="com.b"/> <property name="c" value="com.c"/> <logger name="${a}" level="debug"> <appender-ref ref="file_a"/> </logger> <logger name="${b}" level="debug"> <appender-ref ref="file_b"/> </logger> <logger name="${c}" level="debug"> <appender-ref ref="file_b"/> <!-- yes b --> </logger> <root level="debug"> <-- used other logs -> <appender-ref ref="stdout"/> <appender-ref ref="root_file"/> </root> so have file_a file_b , root_file; root_file contains info writes root logger , b , c loggers. how can exclude file_a file_b info root_file ? or in words how can excl...

android - requestPermissions() for gps inside a service . Error:"location provider requires ACCESS_FINE_LOCATION permission." -

the problem facing giving gps permissions application through service writing. tried finding example achieve , examples shows writing gpslocation finder in activity, in case, implement in service. the service code follows: public class travelservice extends service{ private locationmanager locmanager; private locationlistener loclistener; @override public void oncreate() { super.oncreate(); locmanager = (locationmanager) getsystemservice(location_service); loclistener = new locationlistener() { @override public void onlocationchanged(location location) { locmanager.requestlocationupdates("gps", 5000, 100, loclistener); } @override public void onstatuschanged(string provider, int status, bundle extras) { } @override public void onproviderenabled(string provider) { } @override ...

android - Insert record to MySql from AndroidStudio only works when application Start -

i have application insert parameters in mysql table stored in hosting. when start app first time , send information register succesfully added db. continue using application. if later try add registry, nothing happen, insert not realized. if close (kill) application , start again , send insert again works perfectly. in resume can send insert when first start app. i checked debug , seems ok, if same log in both cases. my android code following: public class asynccall extends asynctask { this button call asynctask: sentbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { parametros.add(new basicnamevaluepair("categoria",intent.getstringextra("categoria"))); parametros.add(new basicnamevaluepair("titulo",intent.getstringextra("titulo"))); parametros.add(new basicnamevaluepair("latitud",double.tostring(latlng.latitude))); ...

hadoop - Sqoop import as ORC ERROR java.io.IOException: HCat exited with status 1 -

i trying import table netezza db using sqoop hcatlog ( see below) in orc format suggested here sqoop command: sqoop import -m 1 --connect <jdbc_url> --driver <database_driver> --connection-manager org.apache.sqoop.manager.genericjdbcmanager --username <db_username> --password <db_password> --table <table_name> --hcatalog-home /usr/hdp/current/hive-webhcat --hcatalog-database <hcat_db> --hcatalog-table < table_name > --create-hcatalog-table --hcatalog-storage-stanza 'stored orc tblproperties ("orc.compress"="snappy")'; however , failed following exception. after spending few hours , have no clue why failing. / lead appreciated. 16/04/21 19:51:22 error tool.importtool: encountered ioexception running import job: java.io.ioexception: hcat exited status 1 @ org.apache.sqoop.mapreduce.hcat.sqoophcatutilities.executeexternalhcatprogram(sqoophcatutilities.java:1148) @ org.apache.sqoop.mapreduce.hcat.sqo...

opengl - Read depth values while stencil testing(same texture) -

i know bad idea read/write from/to same texture/location, because result in undefined behaviour. in case, if depth testing disabled , read depth values in shader, ok stencil testing @ same time reading depth values within same texture? in opinion there should not problems, because i'm not reading stencil buffer values in shader. or, there hardware related problems when texture bound reading in shader , opengl uses stencil testing? this texture filled depth/stencil values. wan't avoid heavy brdf lighting(directional light) calculations on specific pixels(the sky). example code: //contains depth/stencil texture(deferreddepthstenciltextureid). //two fbo's sharing same depth/stencil texture. lightaccumulationfbo->bind(); glenable(gl_stencil_test); glstencilfunc(gl_equal, 1, 0xff); //disable writing stencil buffer, i.e. bits write-protected. glstencilmask(0x00); gldisable(gl_depth_test); glenable(gl_blend); glblendfunc(gl_one, gl_one); //additive blending. light...

unity3d - In Unity, how to prevent animations from messing with the movement? -

the problem: i have character model nav mesh agent component. moves destination tell move (using navmeshagent.destination property). but fails use animation controller downloaded store. character won't run it's destination; instead, endlessly run around in circles. i'm not sure why happens, suppose running animation somehow cripples character's ability turn. inspector, in import setting of relevant .fbx file shows: average angular y speed: 0.0 deg/s . what really, fail understand why keeps happening though have explicitely set navmeshagent.updateposition , navmeshagent.updaterotation properties true . way understand documentation , should make character move nav mesh agent wants move, , not else (animations included) wants move? how should fix problem? how should force animation not meddle in movement? do animation in place , use code movement , can uncheck root motion , use state machine values better movement or use root motion , let mec...

javascript - Change part of a string with jQuery -

i'm sure simple, can't figure out. i have html: <img src="/7290/9200572193_f95fb66c50_m.jpg" /> which need change <img src="/7290/9200572193_f95fb66c50_b.jpg" /> this isn't same image, _m.jpg , _b.jpg are. how can jquery? you can do: var imgsrc = "/7290/9200572193_f95fb66c50_m.jpg"; imgsrc = imgsrc.replace("_m.jpg", "_b.jpg");

enhancing a VHDL code for a mips processor main decoder block -

i new vhdl programming , here want enhance following code in point : entity maindec port(op: in std_logic_vector(5 downto 0); memtoreg, memwrite: out std_logic; branch, alusrc: out std_logic; regdst, regwrite: out std_logic; --jump: out std_logic; aluop: out std_logic_vector(1 downto 0)); -- declarations end maindec ; -- hds interface_end architecture untitled of maindec signal controls: std_logic_vector(8 downto 0); signal jump_2 : std_logic; begin process(op) begin case op when "000000" => controls <= "110000010"; -- rtype when "100011" => controls <= "101001000"; -- lw when "101011" => controls <= "001010000"; -- sw when "000100" => controls <= "000100001"; -- beq when "001000" => controls <= "101000000"; -- addi when "000010" => controls <= "000000100"; -- j when others => controls <= "---------"; -- ...

ios - Setting UIScrollView Width -

i have uiscrollview added viewcontroller. , view on top of scrollview. have done following: placed scroll view inside original view , set top, left, right, , bottom constraints. unchecking constrain margins. added uiview within scrollview (to hold labels , such) , added top, left, right, , bottom constraints, constrain margins unchecked. , set equal widths original view i add image view , 3 labels inside view placed within scroll view. , add top, left, right, bottom, , height constraints them. the scroll view works , view scroll , labels , image view centered wide. i wondering how make view not wide , cannot scroll horizontally, vertically. add equal-widths constraint between view inside scroll view, , root-level view of view controller.

ruby on rails - ActiveRecord many_to_many association confusion -

i creating quiz in rails , drawing blank on associations. i have 3 tables know going there. users |___id |___name quizzes |___id |___user_id questions |___id |___question |___poss_answer_one |___poss_answer_two |___poss_answer_three |___answer |___test_version this started with. functionality of site follows: a user can select questions 3 categories add active quiz (quizzes). user have 1 quiz @ time because when finish or restart new one, entry quizzes table re-created. so user has_one quiz , quizzes belongs_to users. next assuming quiz has_many questions , because questions re-usable , can included in many different quizzes, require join table? if quiz_questions |___id |___question_id |___quiz_id in case require has_many through. once done know how model associations, confusing myself because of wording. probably need habtm association (see railscasts ) class quiz < activerecord::base has_and_belongs_t...

ios - Add Object to an NSMutableArray that is an element of an NSDictionary -

in code below, declare nsdictionary , fill empty nsmutablearrays designated numeric keys: nsdictionary *result = [[nsdictionary alloc] init]; for(float = 0; < 120; += 0.25){ [result setvalue:[[nsmutablearray alloc] init] forkey:[nsstring stringwithformat:@"%.2f", i]]; } now if have object want add 1 of arrays , key of array want add (for example if want add string array key 4.25), how add object array? [result[@"4.25"] addobject: @"astring"]; note code won't work written. need create dictionary mutable if going add key/value pairs after it's created.

python - Inserting user data with stored procedure gives error when committing -

this code gives error on conn.commit line. error: ('hy000', "[hy000] [mysql][odbc 3.51 driver]commands out of sync; can't run command (2014) (sqlendtran)") whenever call sp id keep increasing in table record not inserting. @app.route("/insert_user") def insert_user(): try: conn = pyodbc.connect("driver={/usr/local/lib/libmyodbc3.so};server=localhost;database=user_data;user=user;password=user_pass;option=3;autocommit = true") cur = conn.cursor() cur.execute("{call insert_user_sp(0,'aby@gmail.com','345','male','1992-01-12','www.facebook.com','abc','xyz','p','jr','english','i student')}") conn.commit() except error e: print e finally: cur.close() conn.close() since you're using mysql on linux, recommend using mysql python package rather pyodbc . use p...

php - Laravel 5.2 Validation Error not appearing in blade -

i want show validation error in view page while user giving wrong input. it's ok it's not saving in database while user giving wrong input. there no error message in user view page. if find error, please me out. here controller: public function saveuser(request $request){ $this->validate($request,[ 'name' => 'required|max:120', 'email' => 'required|email|unique:users', 'phone' => 'required|min:11|numeric', 'course_id'=>'required' ]); $user = new user(); $user->name= $request->input(['name']); $user->email= $request->input(['email']); $user->phone= $request->input(['phone']); $user->date = date('y-m-d'); $user->completed_status = '0'; $user->course_id=$request->input(['course_id']); ...

How to give value for form input using Spring and Freemarker -

i using spring mvc , freemarker. i have created form , want put default value forminput <@spring.forminput "command.name"/> please give suggestions. you can specify default value in spring mvc controller. mention freemarker. specify default value using freemarker, follow variable name ! , default value. example, documentation ( http://freemarker.org/docs/dgui_quickstart_template.html ): <h1>welcome ${user!"visitor"}!</h1> however, said, documentation not seem show way specify default way within form. leaves me conclusion need set value in "command object" or "backing object" being sent form rather using template itself.

qt - Sockets comunication between QTScript and Python -

i'm trying communicate external python script c++ program allows qt-scripting. goal partially control c++ program (using qtscript api functions) python code. i know how create basic socket server/client in python: #server code import socket server = socket.socket() server.bind (("localhost", 8080)) server.listen(10) client, client_adress = server.accept() while true: message= cliente.recv(1024) if message== "quit": break print "received:", message client.send(message) print "goodby" cliente.close() server.close() ... #client code import socket client = socket.socket() client.connect(("localhost", 8080)) while true: message = raw_input(">" ) client.send(message) if message == "quit": break print "goodby" but can't found info on how in qtscript (no javascript experience), know there qtcpsocket class , i'm not sure start snipet py...

java - android studio issue about plugin or sdk location -

enter image description here i don't know why give me issue when try use plugin. therefore, have tried again , again use plugin, failed. my sdk location : c:\users\edlin\sdk2 my jdk location : c:\users\edlin\java\jdk1.8.0_91 i have set java_home path. i'm using windows 8.1 . sdk path problem?

algorithm - Time complexity of Canny edge detector -

i writing research paper new steganography algorithm. have used canny edge detector @ point in algorithm. in paper need write time complexity of novel approach, in turns depends on time complexity of canny edge detector. problem on web find reference time complexity of canny. i've read original canny paper. unable deduce , need here. canny edge detection consists of a convolution of image blur kernel, four convolutions of image edge detector kernels, computation of gradient direction, non-maximum suppression, and thresholding hysteresis, steps (1), (2), (3), , (4) implemented in terms of convolutions of image kernels of fixed size. using fft, it's possible implement convolutions in time o(n log n), n number of elements. if image has dimensions m × n, time complexity o(mn log mn) these steps. the final step works postprocessing image remove high , low values, dropping other pixels aren't near other pixels. can done in time o(mn). therefore, overa...

Class Not Found exception with exec-maven-plugin when run on Linux -

i trying run testng tests. project organization - src->test->java->com->shn->library below command works in windows fails in linux. mvn -x clean exec:java -dexec.mainclass="com.shn.library.runsuitesinparallel" -dexec.classpathscope=test -e error seen in linux on running same command - [error] failed execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project uaf: exception occured while executing java class. com.shn.library.runsuitesinparallel -> [help 1] org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project uaf: exception occured while executing java class. com.shn.library.runsuitesinparallel @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:217) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:153) @ org.apache.maven.lifecycle.internal.mojoexecutor.exe...

php - Can't send a lot of variables from android to server -

i have problem android studio. have lot of variables(76 variables) in android when want sent them server have problem. can't send data server. when try reduce variable became 2 variable work. can explain that? private void orderproses(string merk,string tipe,string tipe_mesin,string transmisi,string warnaint,string warnaext,string pernahlaka,string lamakepemilikan,string silinder,string kondisibeli,string kondisiumum, string fiturmobil,string speedometer,string ukuran,string harga,string penjual,string nohp,string s1,string s2,string s3,string s4,string s5,string s6,string s7,string s8,string s9,string s10,string s11,string s12,string s13,string s14,string s15,string s16,string s17,string s18, string o1,string o2,string o3,string o4,string o5,string o6,string o7,string o8,string o9,string o10,string o11,string o12,string o13,string o14,string o15, string setelah1,string setelah2, string setelah3, stri...