Posts

Showing posts from July, 2015

HTML - Get data for each button -

i'm trying have login , register button, when login button gets clicked want specify it's login action , when it's register action want specify in url. there sort of attribute define default data in there url (plus input data)? this current code: <form class="login-form" onsubmit="return validate();" method="get" action="php/login.php"> <input class="login-element credential" placeholder="username" id="username" name="username"/> <button class="login-element button" type="submit">login</button> <button class="login-element button" type="submit">register</button> </form> <form class="login-form" onsubmit="return validate();" method="get" action="php/login.php"> <input class="login-eleme

ios - Uniquie notification for each Beacon ( more than 20 beacons) -

i'm building ios app, in wish handle more 20 ibeacons. beacons added web portal have handled app. since there ios restriction number of region monitored 20, i'm unable give different local notifications beacons in same region (having same uuid). is there way handle this? a few points: the 20 region limit applies number of clregion objects can registered single app. it not mean can detect 20 beacons. since each clregion object can leave major and/or minor nil (making fields wildcard), each 1 can match billions of beacons. beacon apps typically use local notifications, not push notifications. the way set many different notifications come many different beacons this: define single wildcard region matches of beacons. (or few regions if needed background triggering). start monitoring and ranging each of these regions. in didrangebeacond:inregion callback keep flag each individual beacon see if have sent notification before. if not, set flag true ,

php - create parent and its child tree in codeigniter -

i working in codeigniter.i want display parent agent , child agent under parent agent. parent agent data display this array ( [0] => stdclass object ( [id] => 1 [introducer_code] => 0 [designation] => 2 [cader] => [code] => [name] => vinod [area] => [d_w_s] => rajendra [gender] => male [dob] => 2014-12-01 [age] => 25 [mobile_no] => 123456789 [village] => vadodara road [city] => vadodara [district] => vadodara [state] => 1 [pincode] => 391212 [pan] => bcd1234587 [nominee] => rajendra [n_relation] => father [n_age] => 35 [d_o_j] => 2014-12-22 [amount] => 100 [bank_acc] => 0123467 [bank_add] => vadodara [branch_id] => 102 [uname] => [pass] => [enc_pass] => d

user interface - Python GUI, on saving calculated output -

i'am making application electrical calculations. provide input, calculations done within class called earthcalc(frame) , , have called class as: root = tk() c = earthcalc(root) now, class i'm trying save calculated outputs dictionary [defined outside class] may able save output in notepad. not working! have saved input data output data blank: def save_data(): filename = tkfiledialog.asksaveasfilename(initialfile='untitled.txt',defaultextension=".txt",filetypes=[("all files","*.*"),("text documents","*.txt")]) try: file = open(filename, 'w') mydata = {"conductor material" : c.conductor_material.get(), "soil resistivity" : c.a.get(), "earth fault current" : c.b.get(), "fault clearance time" : c.c.get(), "electrode type" : "pipe", "electrode length" : c.d.get(), "diameter of pipe" : c.e.get(), "

MQTT for Android chat applications / Limiting topic access -

i'm trying create chat application android using mqtt, there limited information on how that. so far i've set mqtt broker user can listen , publish topics (surely that's not 1 wants in chat applications). i'm using mosquitto broker , it's listing set of features in it's documentation: topic access added lines of format: topic [read|write|readwrite] <topic> it possible define acls based on pattern substitution within topic. form same topic keyword, using pattern keyword. pattern [read|write|readwrite] <topic> the patterns available substition are: %c match client id of client %u match username of client the substitution pattern must text level of hierarchy. pattern acls apply users if "user" keyword has been given. example: pattern write sensor/%u/data allow access bridge connection messages: pattern write $sys/broker/connection/%c/state so far thought of doing

Using design patterns in laravel 5 -

what design patterns can use in large projects laravel 5 ? there tutorials or books learn design patterns ? building large project can't solved applying design patterns, need dive little more deeper , learn architectural patterns, find 1 closest project case, , apply it. in of times can merge multiple architectural patterns full solution. design patterns: solves re-occurring problems in software construction. architectural patterns: fundamental structural organization software systems. for more details design patterns can check nice article http://www.mahmoudzalt.com/blog/software-design-patterns/ however list of interesting architectural patterns used apply before coming own one ports , adapters (layered architecture) hexagonal architecture onion architecture clean architecture domain driven design pattern cqrs (command query responsibility segregation) event sourcing use case driven development or use case architecture command oriented interfac

php - Magento: Limit text field size in product custom attribute to 80 characters -

i have problem using following tip magento forum: quote : 1 option add backend model attribute. in model write own beforesave function process length of given value , trim desired length. class should extend mage_eav_model_entity_attribute_backend_abstract code: public function beforesave($object) { $attrcode = $this->getattribute()->getattributecode(); if ($object->hasdata($attrcode)) { $object->setdata($attrcode, substr($object->getdata($attrcode),0,50)); } return $this; } my question is: how , implement snippet? put in /app/code/core/mage/eav/model/entity/attribute/backend/default.php had no effect. first @ all, you'll never should place custom code core files. destroys upgradabillity. create own custom modules under app/code/local. there can create model extends mage_eav_model_entity_attribute_backend_abstract. may link helps create module: http://www.smashingmagazine.com/2012/03/01/basic

gradle - Android Proguard please correct the above warnings -

i'm developing application, have following proguard error: error:execution failed task ':app:proguardrelease'. > java.io.ioexception: please correct above warnings first. it refers to: warning:there 162 unresolved references classes or interfaces. so can't generate apk. seems problem happened when used multidexenabled in config. before (as remember) didn't error @ all. here gradle settings: apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "id2tel.nextgen" minsdkversion 14 targetsdkversion 21 versioncode 10 versionname "0.0.10" renderscripttargetapi 21 renderscriptsupportmodeenabled true multidexenabled true } buildtypes { release { minifyenabled true proguardfiles

ghc - How Cabal can be configured to use target-prefixed readelf executable -

when cabal build second time get: readelf: readprocesswithexitcode: runinteractiveprocess: exec: not exist (no such file or directory) from strace confirmed looks readelf executable on system have target prefix , x86_64-pc-linux-gnu-readelf . is there way configure cabal and/or ghc specific location of readelf ? there no such way @ moment. https://ghc.haskell.org/trac/ghc/ticket/10974 we'll -pgmreadelf .

war - Deploying Java Servlet applications on Windows with IIS -

i have develop jsp-servlert application (i.e. war file) running on tomcat server. want run same web application on iis without tomcat. currently following url: http://www.helicontech.com/articles/deploying-java-servlet-applications-on-windows-with-iis/ but while configuring java hosting package per mentioned in above article, giving error download jetty 8. other softwares same package getting download , install successfully. when checked logs, found downloading jetty url: " http://dist.codehaus.org/jetty/jetty-hightide-8.1.7/jetty-hightide-8.1.7.v20120910.zip " , codehaus services has shutdown. can me install jetty iis or other option deploy war iis? thanks, sameerk definately easiest option, @ time of writing, use microsoft's httpplatformhandler can install on iis 8+ (windows 8 or windows server 2012 @ least). you need to: install iis on machine install jdk install jetty on windows (just download zip , unpack it) create war file copy war

javascript - Controller being called twice in Ionic (AngularJS) -

in angular project user accepts eula automatically redirected dashboard, however, on redirect dashboardcontroller seems being called twice, dashboardcontroller being called on route itself, have checked see if have accidently called again in template havn't. below route & controller. doesn't appear matter if access url directly or via redirect on eula controller, same result. the routes .config(function($httpprovider, $stateprovider, $urlrouterprovider) { $httpprovider.interceptors.push('httprequestinterceptor'); $urlrouterprovider.otherwise('/'); $stateprovider .state('login', { url: '/', templateurl: 'templates/login.html', data: { requirelogin: false } }) .state('eula', { url: '/eula', templateurl: 'templates/eula.html', data: { requirelogin: true } }) .state('dashboard'

jung2 - Visualize MySQL Data using JUNG -

i have pull out data mysql database , have visualize data in network format using jung. i have connected program mysql database. don't know how extract vertexes database jung. can me this? can use jung visualize mysql data? this how have extracted vertex , edges data database string query = "select x, y table1 column= 'r '"; preparedstatement pest = connection.preparestatement(query); resultset rs = pest.executequery(); while (rs.next()) { name1[i] = rs.getstring("x"); g.addvertex(name1[i]); name4[l] = rs.getstring("y"); system.out.println(name2[l]); if (name3[k] != null) { g.addvertex(name3[k]); } else g.removevertex(name3[k]); i++; k++; } (k = 1; k < 20; k++) { if (name3[k] == null) { = 1;

math - Rank Average with PHP -

in excel there's function rank average ( see documentation ). i wish same in php. looking online, find lot of ranking solutions, not lot of take duplicates account , when do, result not same excel giving me @ all. it's important though. ideally, i'd need function requires score , array compare with, , give me rank it. example actual date excel: $array = array(5.80,6.00,6.00,5.60,3.20,3.00,3.60,5.70,3.60,1.90,5.00,5.80,3.00,3.80,5.00,3.00,6.00,5.70,5.00,4.90,4.20,3.60,5.00,4.90,4.90,3.00 3.30,4.80,4.60,4.10,4.70,6.00,3.30,4.30,4.30,3.00,3.10,6.00,1.90,3.80,5.00,2.00,2.80,3.00,4.20,3.00,5.50,6.00,5.00,5.00); $score1 = 5.80; $score2 = 6.00; $rank1 = rankavg($score1, $array); //should return 7.5 $rank2 = rankavg($score2, $array); //should return 3.5 function rank_avg($value, $array, $order = 0) { // sort if ($order) sort ($array); else rsort($array); // add item counting 1 0 array_unshift($array, $value+1); // select indexes vith value $keys = a

objective c - How to collapse ViewController in UISplitViewController -

i have splitviewcontroller have instantiated in code. mastervc = [[masterviewcontroller alloc] init]; detailviewcontroller *detailvc = [[detailviewcontroller alloc] init]; mastervc.detailviewcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:detailvc]; ... _splitviewcontroller = [[uisplitviewcontroller alloc] init]; _navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:mastervc]; ... _splitviewcontroller.viewcontrollers = @[_navigationcontroller, mastervc.detailviewcontroller]; _splitviewcontroller.preferreddisplaymode = uisplitviewcontrollerdisplaymodeallvisible; ... self.window.rootviewcontroller = _splitviewcontroller; 90% of time want both viewcontrollers displayed in settings app, does. there instances want toggle visibility of left _navigationcontroller few minutes , later go default 2-column setup. how can collapse left side? way can think of redefine self.window.rootviewcontroller , set mastervc.detailviewcontroll

android - Can't load images from external storage in M preview -

i have app stores it's images on external storage. have been working great until tried new m preview. i use picasso (i tried ion) load images , images "file:///mnt/sdcard/ appname /image1.jpg" uri. i don't errors @ all, i'm guessing m has changed permissions read external storage. have tried googling come empty. writing images external storage works normal way. although siris_cac answer explained wasn't caused problem. turns out can't use "file:///mnt/sdcard/appname/image1.jpg" load file external storage in m. i guess might have to http://www.androidpolice.com/2015/05/28/android-m-feature-spotlight-external-storage-can-be-adopted-as-true-internal-storage-or-accessed-normally-with-no-additional-apps/ i guess wrong begining not using enviroment.getexternalstoragedirectory() when loading images, when saving them. so load images use: "file:///" + environment.getexternalstoragedirectory().getpath() + "/appnam

javascript - Extract multiple data from DOM in jQuery? -

there node this <img src=​"http:​/​/​x.jpg" data-latitude=​"0" data-longitude=​"0">​ in jquery, can extract 2 data attribute this: a=node.data("latitude") b=node.data("longitude") i wondering whether there way extract multiple data attributes in 1 time, this: latlng = node.data([latitude, longitude]) // not working latlng = node.data(); this return object { latitude:0, longitude:0 }

SocketException: A system call received a parameter that is not valid + setTcpNoDelay -

i'm getting following error in socket programming, please me identify root cause of error. socketexception: system call received parameter not valid. @ java.net.plainsocketimpl.socketnativesetoption(native method) @ java.net.plainsocketimpl.socketsetoption(plainsocketimpl.java:597) @ java.net.plainsocketimpl.setoption(plainsocketimpl.java:340) @ java.net.socket.settcpnodelay(socket.java:894) @ com.testsocket.run(testsocket.java:112)

Android Animation to load viewgroup / layout on drag/swipe the view(Button) -

Image
i need on showing layout(screen) animation on windowmanager screen1: windowmanager having button < while drag/ swipe button viewgroup/ layout need load on screen visibility gone previously. like notification bar, when swipe top bottom visible top bottom same here left right screen 2:animation while drag button on windowmanager screen 3:after animation fill view displayed

java - What is wrong with my database code? -

i'm trying check if string key in netflix column. public boolean checkserial(string key){ boolean isvalid = false; sql = "select * keys netflix=?"; try{ ps = con.preparestatement(sql); ps.setstring(1, key); rs = ps.executequery(); if(rs.next()) isvalid = true; }catch(sqlexception e){ system.out.println(e); } return isvalid; } com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'keys netflix='ipman'' @ line 1 keys mysql reserved keyword. possibly you'll error if there's nothing wrong query. either you've avoid using mysql reserved keywords, can found at https://dev.mysql.com/doc/refman/5.0/en/reserved-words.html or use appropriate quotes keywords if don't want change existing table. like, select * `keys` netflix=? note: it

c++ - OpenCV histogram of an irregular shape -

Image
i'm comparatively new opencv. wondering if possible histogram of contour (which can perfect rectangular or irregular in shape) found findcontour. thanks in advance. edit: this i'm trying achieve. want analyse area in contour detect defects (by analyzing histogram of area ?) , declare piece defective or good. images attached. good sample. (contour detected outlined in gray color) defective sample. (defect around top left corner) you may misuse histogram. contour of image should binary-valued, color-less matrix which not represent grayscale-level of pixels, boundaries . meanwhile, histogram tool analyzing how grayscale-valued of pixels distribute in 2d image, isn't it? thus, why want profile histogram of binary-valued matrix might not analyzing image? histogram not right t ool contour analysis though. what may histogram should two-bar histogram because contoured matrix contains binary values. might not helpful analysis.

pointers - Understanding deref -

the following rust deref example http://doc.rust-lang.org/book/deref-coercions.html , except i've added assert. my question why assert_eq deref equal 'a'? flip side question is: why need * once i've manually called deref ? use std::ops::deref; struct derefexample<t> { value: t, } impl<t> deref derefexample<t> { type target = t; fn deref(&self) -> &t { &self.value } } fn main() { let x = derefexample { value: 'a' }; assert_eq!('a', *x.deref()); // true // assert_eq!('a', x.deref()); // compile error assert_eq!('a', *x); // true println!("ok"); } first, let's spell out generic types specific example: 'a' char , have (not valid syntax): struct derefexample<char> { value: char, } impl<char> deref derefexample<char> { type target = char; fn deref(&self) -> &char { &se

vba - Excel 2010 Find Holiday Date In Worksheet -

i have workbook has worksheets monday saturday timetable. have dates in each worksheet , additional worksheet has public holidays , need macro search public holidays in monday-saturday worksheets , if date found place name of public holiday 6 vacant cells underneath date. the below example shows australia day holiday date found in tuesdays's worksheet , has populated corresponding holiday name holidays worksheet 6 vacant cells below. worksheet "tuesday" 26-jan 02-feb 09-feb 16-feb 23-feb australia day australia day australia day australia day australia day australia day australia day australia day worksheet holidays holiday 2016 australia day 26/01/16 friday 25/03/16 easter saturday 26/03/16 easter monday 28/03/16 anzac day 25/04/16

qt - How can I get paint events with QtWebEngine? -

i extended qwebengineview . #ifndef myqwebengineview_h #define myqwebengineview_h #include <qwebengineview> class myqwebengineview : public qwebengineview { public: myqwebengineview(qwidget *parent = 0); ~myqwebengineview(); protected: virtual void paintevent(qpaintevent *); }; #endif // myqwebengineview_h but can't paintevent(qpaintevent *) called. #include "myqwebengineview.h" #include <qpaintevent> #include <qpainter> #include <qwebengineview> #include <qwidget> myqwebengineview::myqwebengineview(qwidget *parent):qwebengineview(parent) { qdebug() << "myqwebengineview(" << parent << ")"; qdebug() << "qt::wa_paintonscreen: " << testattribute(qt::wa_paintonscreen); //setattribute(qt::wa_paintonscreen, true); } myqwebengineview::~myqwebengineview() { } void myqwebengineview::paintevent(qpaintevent * event) { qdebug() << "paintevent(&q

Issue in getting iteration data from rally API -

i using following url iteration data rally. parse json data received. def query = urlencoder.encode("(project.name contains \"1 prime infrastructure\")", "utf-8") def rallyurl = " https://us1.rallydev.com/slm/webservice/v2.0/iteration?query= "+query+"&fetch=true&start=1&pagesize=200" the issue giving 0 records. when change name other project data comes. probably because of default workspace username , password. want project data different workspace. have access workspace. can tell how set workspace before making api call can iteration data ?? thanks, you can include workspace parameter in url override default: &workspace=/workspace/12345 you can further refine results specific project: &project=/project/12345 or specific hierarchy: &projectscopeup=true &projectscopedown=true

javascript - Web application stops after console warning -

Image
i facing problem in web application. whenever 592 console messages not shown. in console window, stops application. not move next. at starting 1 more warning there synchronous xmlhttprequest on main thread deprecated because of detrimental effects end user's experience. more help, check http://xhr.spec.whatwg.org/ . would please suggest why warning happened , solution this. let's go point point, synchronous xmlhttprequest on main thread deprecated because of detrimental effects end user's experience. this warning comes when try make synchronous ajax call. might have use either simple xmlhttprequest object or jquery make ajax call. why synchronous ajax calls deprecated? read 'async' attribute explanation of 'open' method here . simple xmlhttprequest object var xmlhttp = new xmlhttprequest(); xmlhttp.open("get","ajax_info.txt",**true**); // definition: open(method,url,async) xmlhttp.send(); using jquery,

c - malloc and realloc size of integer array -

i want able realloc amount of space program reads in numbers. example when running should able read number of integer , print them out 'int array: (all inputs)' have tried far: int main(int argc, char **argv) { int = 0, n, num; int *a; = malloc(sizeof(a)); while(scanf("%d",&num) == 1) { a[i] = num; i++; } n = sizeof(a)/sizeof(a[0]); printf("int array: "); (i = 0; < n; i++) { printf("%d ", a[i]); } return 0; } you first reserve specific amount of memory i.e: if user inputs more 10 items realloc block of memory of 20 integers , copy last 10 items new block , on. size_t block_length = 10; size_t current_length = 0; int *a = malloc(sizeof(int) * block_length); // store 10 integer if (a == null) donotcontinue_allocationfailure(); current_length += block_length; // ... input first ten numbers, check if count numbers lesser // block_length void *ptr; p

gtk - How to use Glib g_spawn*() functions replace fork() -

i have program want use glib cross-platform running. found glib's process control g_spawn*() functions difficult use. don't know how replace basic use of unix system function fork(). #include <stdio.h> #include <unistd.h> int main(int argc, char **argv) { pid_t pid = fork(); if (pid == 0) { printf("here child process\n"); } else if (pid > 0) { printf("here parent process\n"); } else { // fork failed printf("fork() failed!\n"); return 1; } return 0; } the g_spawn*() functions description here,it need fill lot of arguments , need other functions bind io,i don't know how use them replace fork(), try run scripts in "gchar **argv," argument. need work fork(),don't want run exec(). click here ! the process spawning api in glib designed replace common pattern of using fork() , exec() toget

jsx - Photoshop Script for flattening TIFF -

i using photoshop cs5.5, there way write javascript can for each of tiff image under folder many sub-folders if tiff file has more 1 layer then flatten image , save original psd? you can read opening files on this answer . flattening image simple: var docref = app.activedocument; docref.flatten(); i don't know mean "save original", can see classes , options saving documents on page . that's quite useful site, way, lists many other classes , respective options.

performance - How to get high frame rate while using putpixel() in C? -

i working code print pixels. //c code #include<graphics.h> #include<conio.h> int main() { int gd = detect, gm; initgraph(&gd, &gm, "c:\\tc\\bgi"); (int i=0;i<100;i++) { for(j=0;j<200;j++) { putpixel(i, j, green); } } getch(); closegraph(); return 0; } is there way of achieving faster response c compiler while using putpixel() in code? speed console gets colored execution of putpixel() pretty slow, wondering if there other library use speed printing pixel process on screen using c on windows system or linux one? putpixel() pretty slow, no matter framework or library use. try create bitmap , calculate memory address of each pixel yourself. cross-platform frameworks allow such thing sdl , allegro . see also: http://lazyfoo.net/sdl_tutorials/

Can I delete the folder androidTest if I don't do test in Android studio? -

i find there folder named androidtest in android studio project, can delete folder androidtest if don't test in android studio? thanks! yes, can delete if don't wanna use it.

android - How can I specify the latest commit version in Gradle -

i'm using gradle in android project,and have added dependencies in build.gradle file.for reasons,i want point latest commit 1 of dependencies.for example: dependencies { ... compile 'com.github.ozodrukh:circularreveal:1.1.0@aar' } i'm specifying circularreveal 's version 1.1.0@aar,and know has fixed bugs have not released yet.how can specify commit in gradle?i know basics cocoapods ,and can done this: pod 'afnetworking', :git => 'https://github.com/gowalla/afnetworking.git', :commit => '082f8319af' can done in gradle? appreciated. you can not directly gradle, there gradle plugins , tools can use achieve this. you can using jitpack , external tool. need specify jitpack repository: repositories { maven { url "https://jitpack.io" } // define other dependency repositories, if } then include dependency: dependencies { compile 'com.github.gowalla:afnetworking:082f83

mysql - order by: if two or more result match with limit 1 then randomize -

select * my_database order priority desc limit 1 my_database: name | priority ################## dave | 100 pat | 100 jo | 99 1: what's deciding factor when there's 2 possible results , limit set 1? 2: can add randomization between 2 possible matches? how? 1: what's deciding factor when there's 2 possible results , limit set 1? unless specify ordering primary key (or combination of fields make clear db how order), cannot predict of 2 possible results display. database engine determine that. i tried query (example: http://www.sqlfiddle.com/#!9/e2df77/2 ) select * test order priority desc limit 1 , pat showed up. tried select * test priority = 100 order priority desc limit 1 , dave showed up. moral: don't count on results unless tell database unambiguously how order information. 2: can add randomization between 2 possible matches? how? you can order query using rand() . select * test priority = 100 order priorit

c - Point file pointer to buffer in memory rather than a file on disk -

i trying have file* in c can write string buffer in memory rather file on disk. i know functionality exists in fmemopen function, not running program on linux not solution me. have seen implementations mac well, programming cortex m4 arm processor, can't use well. any solutions out there potentially work when programming cortex m4? edit: clarify, need end file structure because need pass file* library function using (libjpeg's jpeg_stdio_dest() , jpeg_stdio_src() functions) takes in file* argument.

socrata - How do I do column contains with API -

with gui can filter on column contains. api not seem allow that. there anyway api? what think you're looking like soql function, available on text . you'll need make sure you're using latest version of dataset's api, , can find instructions on how locate that in developer portal's changelog. for example: https://open.whitehouse.gov/resource/9j92-xfdk.json?$where=position_title '%25assistant%25'

How to get a MySQL field's content with PHP? -

i've been working on website's database , had problem recently: want user read field of row, when field of same row submitted. i.e: user_id=1 user_name=fran user_pass=potato referedby_id=0 referedby_name=empty when going inside www.website.com/form.php?referedby_id=1 i want user see "so, fran refered you?" i've been learning php , decided try this: $referedbyid = mysqli_real_escape_string($con,$_post["referedby_id"]); //in case it's 1 because of url $sel_referedbyname = "select user_name users user_id='$referedbyid'"; //then should select of user_name "fran" $run_referedbyname = mysqli_query($con, $sel_referedbyname); //then query select $check_referedbyname = mysqli_fetch_field($run_referedbyname); //and 1 content of query's result $refername = $check_refername->user_name; //as query result object want convert text if(isset($_post["register"]) && $check_user == 0 &am

unity3d - Unity position y is escaping -

i started tutorial https://unity3d.com/learn/tutorials/projects/roll-a-ball/moving-the-player , don't understand why, after clicking play, position y automaticly, changing value. following tutorial , don't miss. efect ball after clicking play disappearing immediately.. maybe had similar problem? using unityengine; using system.collections; public class playercontroller : monobehaviour { public float speed; private rigidbody rb; // use initialization void start () { rb = getcomponent<rigidbody>(); } void fixedupdate() { float movehorizontal = input.getaxis ("horizontal"); float movevertical = input.getaxis ("vertical"); vector3 movement = new vector3 (movehorizontal, 0.0f, movevertical); rb.addforce (movement * speed); }} the player object's y-coordinate automatically changing means it's falling downward automatically. remember gravity enabled rigid bodies automatically , maybe haven't attached ri

c# - ASP.Net WebAPI has different content type in different user agents -

i trying learn asp.net webapi, , having hard time figuring out going on. created small application contains action this: public ihttpactionresult hello() { return ok("hi"); } this works fine, @ in browser. see: <string xmlns="http://schemas.microsoft.com/2003/10/serialization/">hi</string> this using chrome. use extension see content type , text/xml . want check things out further use postman rest client test it. there see: "hi" , content type application/json . confused. figured postman changing content type, sure installed rest client returned application/json . in internet explorer attempts download result json file. heck going on. there way can have universal content type? web api can serialise responses xml or json. reads content-type http header determine one. use fiddler examine requests brower. postman passes application/json content type default - json response. you can add following code webapiconfig file

php - mysqli_prepare() Query working on localhost but not when uploaded online, variables on prepared statements -

i appreciate effort taking time read post , answer problem. i making login system of item inventory list client's website. i keep getting these errors online when testing login form : warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: number of variables doesn't match number of parameters in prepared statement in /home/greyan/public_html/shoplogin/login.php on line 44 fatal error: call undefined method mysqli_stmt::get_result() in /home/greyan/public_html/shoplogin/login.php on line 48 what troubles me happens when upload online in web server not when viewing site through localhost. //function sanitize values received form. prevents sql injection function clean($str) { $str = trim($str); global $conn; return $conn->real_escape_string($str); } //sanitize post values $username = clean($_post['username']); $password = clean($_post['password']); //input validations if($username == '') { $errmsg_arr[] = '*username m

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

i have created angular spa webapi backend using adal js authentication.as there no roles in ad, need manually add role claims in order give users access different api controllers. the roles stored in database. expecting inject claim through call webapi after authentication ad. webapi code might this. identity.addclaim(new claim("role", "user")); var ticket = new authenticationticket(identity, props); var accesstoken = startup.oauthbeareroptions.accesstokenformat.protect(ticket); is possible replace adal idtoken new token? is viable solution or there other better way handle this? as initial token generated azuread, possible edit token add new claim? appreciated. graph api supporting group claims. see here: http://justazure.com/azure-active-directory-part-4-group-claims/ if @ examples on page, users assigned groups , app can check group in claims. in current version of portal, need app manifest , modify it.

How to Display an Image in PDF, which is retrieved from MySql Database :JSP and iText -

i have stored image in mediumblob in mysql. want retrieve image , put in itext pdf. i have manange work out blob datatype. doesnt work medium blob. after have retrieved image , stored in blob datatype. after tried convert bytes. httpsession session=request.getsession(); string name=""; string birthdate=""; string address=""; string gender=""; string doctor=""; string disease=""; string pregnant=""; string nursing=""; string pan=""; string smoking=""; string allergies=""; string medicines=""; string treatment=""; string email=session.getattribute("email").tostring(); session.setattribute("email",email); blob image0 = null; blob image1 = null; blob image2 = null; blob image3 = null; blob image4 = null; byte[] image

Python: absolute path error in mac -

i using python on mac , open pdf file present in different directory directory main python code running. tried different options there error saying file doesn't exist when file present or [error no. 2] file cannot opened. here code use: helpfile = os.path.abspath('~/help/help.pdf') self.help_btn = tk.button(self.help_frm, text="help!", width=8, command = lambda: os.system("open "+helpfile)) could 1 please. abspath not expand ~ user's home directory, calculates absolute path of file based on path relative current working directory. from docs , equivalent to: normpath(join(os.getcwd(), path)) so in code, helpfile being set "/path/to/cwd/~/help/help.pdf" to expand ~ , use os.path.expanduser .

ios - Importing Parse into a Xcode project -

i'm trying build application in xcode using parse backend. trying initialize parse project having issues. imported files needed , create bridging-header. trying enable local datastore , add application id , client key. problem need understanding why code process not auto generating me. when type parse , dot symbol not getting options. can me figure out going on please! import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { parse.enablelocaldatastore() // t66osscwrm1ldzc73n7nzybts6yaufpcongniekl // f06jg1mzoebstknscwkksgbu1cpqcnkv5xuod1zi return true } } the key , token not generated application need download parse website, signed paser using line below, values copied parse. parse.setapplicationid("come parse", clientkey: "c