Posts

Showing posts from February, 2011

ios - When using auto layout I am not getting correct response after one complete rotation -

Image
i have been using auto layout feature storyboard .now added in view controller , added width , height constraints 300 , 200 respectively,thereafter added horizontal , vertical alignment contraint .all works in 1 rotation i.e portrait,landscape,upside down , upside rotation completes response changes .i attaching screenshot reference. its seems testing simulator , please try same scenario device . may problem occurring in simulator .

machine learning - MAP estimation (predictive distribution) -

yes, old exam question unfortunately can't find solution. suppose part of team has trained n temperature prediction models. models use readings set of sensors measure weather conditions on given day , predict temperature following day. i-th model determined vector of parameters wi , estimates conditional probability p(y | x, wi) of observing temperature y if sensor state x. furthermore, based on historical data team has prior belief on models given p(wi) = 2i/(n(n+1)) ∈ {1, . . . , n}. given measured sensor state today x* please write down predictive distribution p(y*| x*) temperature tomorrow using map estimation. we didn't cover predictive distributions. map estimate want estimate parameters wi on basis of observed sensor data x. how can fit y in here? any hints appreciated :-)

javascript - How can I get the value in an array of array Object? -

var data=[ { 'name':'yash', 'phoneno':['123456','654123'] }, { 'name':'rahul', 'phoneno':['789456','789456'] } ]; for(i=0;i<data.length;i++) { alert(data[i].phoneno.length); for(j=0;j<data[i].phoneno.length;j++) { alert(data[i][j].phoneno); } how can access value array 'phone' object data ? tried this,but not working. thank in advance var data=[ { 'name':'yash', 'phone':['123456','654123'] }, { 'name':'rahul', 'phone':['789456','789456'] } ]; for(i=0;i<data.length;i++) { alert(data[i].phone.length); for(j=0;j<data[i].phone.length;j++) { alert(data[i].phone[j]); } } replaced phoneno...

Get the key of a hash by knowing only one item inside the value which is an array in Ruby -

i want able key called "needed key" string out of considering value of "known_value hash = { "needed key" => { :key1 => ["know_value", "unknown_value"], :key2 => ["stuff", "more_stuff"] } "otherhash" => { :key1 => ["unknow_value", "unknown_value"], :key2 => [] } } in short how able retreive "needed key" code if know "know_value". using "know_value" out of need "needed key". thank help. hopefully clear enough, otherwise please ask me clearer. this way extract desired key efficient in sense avoids construction of temporary, intermediate arrays, such hash.keys , flatten , hash[key] , , on. target = "known_value" hash.each_key.find { |k| hash[k].each_value { |a| a.include?(target) } } #=> "needed key" this assumes, of course, looking key satisfies requirement. ...

wcf - The type or namespace name 'ServiceHost' does not exist in the namespace 'System.ServiceModel' -

Image
i'm trying add wcf service in application windows iot (raspberry pi) using visual studio 2015. because can't add reference 'on usual way' (vs 2015 not showing any), added nuget reference system.servicemodel. using (var host = new system.servicemodel.servicehost (typeof(helloworldservice), _baseaddress)) { } how can reach servicehost? resharper doesn't me neither ok, found out windows iot doesn't support wcf (yet).

How to programmatically get list of users and groups that have access to a file or folder in SharePoint -

i trying find way list of ad users , ad groups have access folder or file has broken inheritance. don't need know how find inheritance broken, have gotten part having issues finding each user or group has access. not want see users within ad group, want see name of group accessing folder. use case behind not want secured folders shared single users. of must controlled ad groups (site owners not have access add users secure folder). need find out if there files within folder not inherit folder , shared individual users instead of ad groups (hope makes sense). here have far , works point, reason returning users have access site elsewhere , users have limited access have clean later. here's code have written far sort of works. takes in item object of file or folder , reference string. scans access , builds list of users separated semicolon , returns true if 1 of spuser objects user , not group: /// <summary> /// provides list of users\groups have access l...

android - Pinch zoom on a xamarin forms scrollview -

im working on application in have xamarin forms scrollview add several subviews. each of subviews has custom renderer defined in droid project, render pretty complex objects (adorned text displayed elaborated poligon example). now required add pinch zoom scrollview (yay me!) there practical way accomplish this? thanks time.

WSO2 Identity Server - Error "Invalid Status" at entitlementServiceClient.getDecision -

when using access userid & passsword based entitlement, , use of class "entitlementserviceclient", method "getdecision", program receives error: "invalid status" is there missing in usage of class: org.wso2.carbon.identity.entitlement.ui.client.entitlementserviceclient; my statements are: //initialize authentication admin stub unittest1 remoteentitlementclient = new unittest1(); //login using authentication admin stub providing valid credentials remoteentitlementclient.login(userid, password); //initialize entitlement service stub obtained authentication cookie remoteentitlementclient.initunittest1(); string decision = entitlementserviceclient.getdecision(myrequest); system.out.println("\nxacml decision received : " + decision); the authorization process seems works fine , receives valid login confirmation , cookie (see log below). oc2615188332 entitlement]$ sh ./testit.sh jul 17, 2015 8:10:37 pm org.apache.axiom.uti...

c# - Sort a DataTable on converted value of a column -

i working on asp.net app in c#. need sort rows in datatable on converted value of column called 'price', unknown reason, string type column in datatable. the code snippet below give me sorted datatable on string value of price column, looking sorting on decimal value of price column. question : expression need use second parameter of select method in code snippet? right now, parameter has value of price asc . datatable dt = getdata(); dt = dt.select( null, "price asc", dataviewrowstate.currentrows).copytodatatable(); update 1 i able make minimal change in above code-snippet , yet use decimal value of price sort on. used convert function convert string value of price column decimal type. function supported in datatable expressions. details of function can found @ location: https://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.110).aspx the code works below. datatable dt = getdata(); //define expression column decimal vers...

python - Nose: Using a boolean to choose tests with a default setting -

my question question: nose: how skip tests default? the difference want have default setting skip slow tests. is, when don't specify attribute should skip slow tests. when specify slow attribute want run slow tests. there way nose (python)?

oauth 2.0 - can not find client Secret on google OAUTH2 -

i trying read worksheet google drive, after lot of searching , reading (and importing jar files) managed this without errors. problem cant client secret need. on web says on json file or @ google's developer console when created id, not. json file this { "private_key_id": ".....", "private_key": "-----begin private key-----......\n-----end private key-----\n", "client_email": "xxxx@developer.gserviceaccount.com", "client_id": "xxxx.apps.googleusercontent.com", "type": "service_account" } thanks it turns out had choose installed application instead of service account . option client secret created.

ios - Working with Multiple Segues | How to use Cell data to perform specific Segues -

i displaying data in collection view, know how pass data on prepareforsegue function trying have app determine segue use depending on cell property data. (each segue goes different view controller display relevant information.) for e.g. if cell.type equal "1" perform segueone if of type "2" perform seguetwo . i trying this; func collectionview(collectionview: uicollectionview, shouldselectitematindexpath indexpath: nsindexpath) -> bool { let cell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) as! collectionviewcell if cell[indexpath].type = "1" { performseguewithidentifier("showpage1", sender: self) } else if self.cell[indexpath].type = "2" { performseguewithidentifier("showpage2", sender: self) } else { println("error when selecting cell segue") } } however error; 'collectionviewcell' not have mem...

ios - Issue with CFBundleIdentifier Collision -

i have issue itunes connect. when transferred application watch support apple account after i've received error itunes connect when tried upload ipa file (that signed new account after transferring) to. i transferring applications , have no problems before. problems watch kit application , watch kit extension only, main application ok. have same problems 3 applications watch support transferred new account. transferring applications without watch support working expected without issue. ps. mobileprovision files transferred applications either transferred or recreated new account (old account doesn’t have transferred bundle ids , mobile provision files after). any ideas? thank you. sorry, english not native language. description of error apple dear developer, we have discovered 1 or more issues recent delivery "my application name". process delivery, following issues must corrected: cfbundleidentifier collision - info.plist cfbundleidenti...

sql - PHP: How to display 2 column values in dropdownlist -

i have code: echo "<select name='brand'"><option value=''>select one</option>"; foreach ($dbo->query($quer3) $noticia3) { if($noticia3['id']==@$brand) { echo "<option selected value='$noticia3[id]'>$noticia3[brand]</option>"."<br>"; } else { echo "<option value='$noticia3[id]'>$noticia3[brand]</option>"; } } i want add column displayed drop down list. example: echo "<option selected value='$noticia3[id]'>$noticia3[brand]+$noticia3[site]</option>"."<br>"; as can see, want add "site" column. do? you following: echo "<select name='brand'"><option value=''>select one</option>"; foreach ($dbo->query($quer3) $noticia3) { if($noticia3['id']==@$brand) { echo ...

android - Error inflating WebView XML -

i found crash report on crashlytics in samsung sm g920f (galaxy s6), version 5.1.1 (on other devices didn't retrieve same error). java.lang.runtimeexception: unable start activity componentinfo{com.mypackage/com.mypackage.myactivity}: android.view.inflateexception: binary xml file line #21: error inflating class android.webkit.webview this layout of webview (the style empty style): <?xml version="1.0" encoding="utf-8"?> <webview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_webview_id" style="@style/myemptystyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" /> this how include in activity layout: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width=...

javascript - how to add combobox with local data to kendo grid column template -

can use way of defining combobox in kendo grid column? can inserted in template of column? var localdata = [ {"productname":"chai"}, {"productname":"chai1"}, {"productname":"chai2"}, {"productname":"chai3"}, {"productname":"chai4"}, ]; $("#products_dropdownlist").kendodropdownlist({ datatextfield: "productname", datavaluefield: "productid", datasource: localdata }); yes can, if this. first create template input , add class (later use jquery selector) <script id="product-template" type="text/x-kendo-template"> <input class="combobox"/> </script> then create dummydata grid, grid datasource, , initialize grid <script> var localdata = [ {productname:"chai1",productid:1}, {productname:"chai2...

python - How to check a variable against 2 different strings? 9 line example -

why doesn't work? rank=input("is realm duchy, kingdom or empire? ") if rank=="duchy"or"duchy": realm=input("what duchy named? ") elif rank=="kingdom"or"kingdom": realm=input("what kingdom named? ") elif rank=="empire"or"empire": realm=input("what empire named? ") else: print("restart , duchy, kingdom or empire. ") no matter answer, asked duchy named. it's evaluating if "dutchy" , returns true you need if rank=="duchy"or rank == "duchy": or better yet, if rank.lower() == "duchy":

ios - Query class in Parse (swift) -

i have strange issue. following block of code placed in viewdidappear section of first view controller, , when runs, println(latarray), println(longarray), println(addressarray), return no value. in console returns [] 3 arrays. however, when go view controller, , go back, populate data parse. why this? why wont latarray, longarray, , addressarray populate when app loaded first time viewwillappear method? var query = pfquery(classname: "newlog") // add clause if there search criteria query.wherekey("type", containsstring: newrecordcreated) println(query) query.findobjectsinbackgroundwithblock({ (objects, error) -> void in if error == nil { // results found if let objects = objects as? [pfobject] { object in objects { //println(object["follower"]) latarray.append(object["lat"] as! double) longarray...

java - Spring MVC - Setting values by default in Controllers -

based on following mapping (at bottom of question) need know how set specific value in "department_id" in employee class. employee -------------------------------------------- id | firstname | lastname | department_id -------------------------------------------- 1 | david | smith | 1 department ----------- id | name ----------- 1 | dep 2 | dep b 3 | dep c saveemployee method (employeecontroller class): @requestmapping(value = "/saveemployee", method = requestmethod.post) public string saveemployee(@modelattribute("employee") employee employee){ /* need set department "id" (foreign key) employee table directly in method. */ int id = 1; // 2 or 3... /* "department_id" in employee class should receive "id" value. */ employee.setdepartment(id); // not work. employeeservice.saveemployee(employee); return "redirect:/employees";...

javascript - asyncawait module (node) yields unusable stack traces -

i having problem using async/await implementation node.js ( https://github.com/yortus/asyncawait ). in documentation says "will include useable stack trace" . not me. think doing wrong..but don't know i'm doing wrong. to demonstrate compare stacktrace of "vanilla" bluebird example corresponding stacktrace of corresponding asyncawait code (asyncawait uses bluebird internally think it's fair). first bluebird code without asyncawait: var funcb = function() { return promise.resolve().then(function() { throw new error("some err"); }) }; var funca = function() { return funcb(); }; gulp.task("aa",function(cb) { funca().then(function() { cb(); }); }); the stacktrace yields information "funca -> funcb -> exception" @ first glace. not better! error: error: err @ processimmediate [as _immediatecallback] (timers.js:358:17) previous event: @ funcb (c:\projects\jsbuildhelper\jsbuildhelper\...

xml - Java EE Web Security -

i have login page ( welcome-page.jsp ) checks if user exists in database. if password has provided correct , if type correct, redirected on page. want add security in sending data. i'm new ... here login form <form method="post" action="authentification"> username: <input type="text" name="username" /> password: <input type="password" name="password" /><br/><br/> log as: <select name="type"> <option value="manager">manager</option> <option value="employee">employee</option> </select> <input type="submit"value="login"/> </form> and here web.xml (as far understood here's place add security sending data forms). possible add security without creating tomcat users , user-roles? i'm using tomcat 7...

html - display:table div with percentage width 1px bug -

Image
the outer div have percentage width, , inner div 's have display: tabel; width: 100% . the inner div 's show 1px less outer div page widths while resizing. adds 1px line right. https://jsfiddle.net/afelixj/utcswlp1/1/ is there fix bug? this seems specific webkit bug : https://bugs.webkit.org/show_bug.cgi?id=140371 the width of display:table-* element not calculated when contained in parent width not defined absolute unit. can see issue in action here: @ right side of red elements you can fix issue in 2 different ways you define width of parent element absolute unit or you apply display: table container element. doesn't solve bug should not noticeable anymore (because affect parent element).

php - Why does a string that contains HTML entity not displaying character after being ran through htmlspecialchars() -

i have string of text pulled sql , ran through php strip_tags , htmlspecialchars because need remove html formatting user might try add. displayed in textarea uneditable div. textarea shows raw html entity code (eg. & <) , that's want. div, preview of textarea content, want show actual character (eg. & <). so, need div convert special characters html entities want current html entities displayed characters. this string of text contain quite few different characters because technical writings restaurant equipment it's not ampersands , quotation marks. basically, there enough making list not easy option. this function run string through both textarea , preview div: function removetags($data) { $data = strip_tags($data); $data = htmlspecialchars($data, ent_html5, 'utf-8'); return $data; } this textarea displays: this unit has ability lower food temperature 160&#176;f 38&#176;f, 110 lbs. an unfortunately preview div shows sa...

Android / Eclipse - Is it possible to use one device to mimic another device? -

i have had 1 or 2 acra crash reports app when has been run user on budget device. i know can create emulator device in android virtual device manager, find these emulators painfully slow work , hoping there better alternative other going out , buying same phone user's. so know if possible configure setup - maybe via eclipse or changing actual phone settings - allow me mimic user's device? the important thing change available heap size. nb - device samsung galaxy s4 , user's device (lower spec) htc desire c. what need app tweak dalvik vm settings. there several apps let advanced user change maximum heap size applocations running on system. can put cap on heap being used every single vm instance simulate htc desire c heap size guess should 32mb. one of apps discussed here : https://ryanolson.wordpress.com/2010/07/13/test-how-changing-the-max-amount-of-memory-per-vm-heap-can-effect-your-rom-cyanogen/

html - RegEx match open tags except XHTML self-contained tags -

i need match of these opening tags: <p> <a href="foo"> but not these: <br /> <hr class="foo" /> i came , wanted make sure i've got right. capturing a-z . <([a-z]+) *[^/]*?> i believe says: find less-than, then find (and capture) a-z 1 or more times, then find 0 or more spaces, then find character 0 or more times, greedy, except / , then find greater-than do have right? , more importantly, think? you can't parse [x]html regex. because html can't parsed regex. regex not tool can used correctly parse html. have answered in html-and-regex questions here many times before, use of regex not allow consume html. regular expressions tool insufficiently sophisticated understand constructs employed html. html not regular language , hence cannot parsed regular expressions. regex queries not equipped break down html meaningful parts. many times not getting me. enhanced irregular regular expressions used...

logging - Why does Python's SysLogHandler require an address? -

this code logs syslog using syslog module: import syslog syslog.syslog(syslog.log_err, 'a') and here's equivalent code using logging module: import logging logging.handlers import sysloghandler logger = logging.getlogger() logger.addhandler(sysloghandler(address='/dev/log')) logger.setlevel(logging.error) logger.error('a') if leave out address parameter in second snippet, doesn't anything. why logging version require me specify address, when syslog module can figure out on own? i'd rather not have specify path, since it's platform-dependent. going have write own version of sysloghandler delegates syslog module? the syslog.syslog api allows send events system logger on local machine only, whereas specifying address in python logging can log not local machine remote syslog server. so, logging approach covers wider set of circumstances syslog.syslog does. note on platforms / in environments, syslog.syslog not threa...

serialization - Do Interfaces provide specific meaning to objects in Java -

i have doubt interfaces in java: when class implements interface, happen if not implement methods? merely implementing interface , provide change of meaning class ? for example have 2 classes, test1 , test2 public class test1 implements serializable { } public class test2 { } except fact test1 implements serializable , classes test1 , test2 identical. in case there difference between functionalities/properties of objects of test1 , test2 ? possible break down objects of test1 class bytes (just because class test1 implements serializable)? if yes, means implementing interface provides additional meaning objects of class? straight documentaion of serializable - serializability of class enabled class implementing java.io.serializable interface. classes not implement interface not have of state serialized or deserialized. serialization interface has no methods or fields , serves identify semantics of being serializable. link q...

javascript - Mongodb get results asynchronously -

here action users users collection app.post('/login', function(req,res,next){ users = self._db.get('users', {}) }) and function in database class this.get = function( col, opt ) { var result = [], opt = opt || {}; query = db.collection(col).find( opt ); query.each( function(err, doc) { console.log( doc ); if( doc != null ) { result.push( doc ); } }); return result; }; and when log users object returns empty array when log each document inside function works question how can result asyncronously? you're missing callback function. since node.js asynchronous design, i/o ops need callback. back example, suggest using monk , this: var db = require('monk')('localhost/mydb'); var users = db.get('users'); app.post('/login', function(req, res) { users.find({}, fun...

osx - How can I retrieve list of Wi-Fi hotspots in Mac application? -

i need programatically retrieve list of nearest wi-fi hotspots(preferably using swift, if it's not possible, objective-c do) , don't how can it. have tried search samples, 1 found outdated , doesn't run on xcode 6.3 . great. i'm trying use swift code below, it's not working, tips? var ind = cwinterface() @ibaction func doer(sender: anyobject) { var network:cwnetwork? var networks = ind.scanfornetworkswithname(nil, error: nil) network in networks { print(network) } you can check out , update apple project here (that mentioned) of link current interfaces apple exposes. for example instead of using kcwphymode11a use kcwphymode11a , instead of using kcwsecuritymodewep use kcwsecuritywep . try changing these two, go definition of kcwsecuritymodewep and, you'll see in header corresponding elements changed, thankfully have descriptive names it's kind of straight forward match. keep in mind enums may have changed -...

Android service for listening for network connections -

as title says, i'm wondering if there way in android listen network connections. using service registered handle sms messages that, example, can consume sms , broadcast or not sms. the idea app sit on background , notified when app makes network connection. based on rules, app can decide if network connection denied or allowed. as example, suppose app tries connect wireless network ssid "neta". app notified , if rule deny app on "neta" calling app not able connect network. any idea if possible? why don't use broadcast recevier listen events?. seems me description don't need service, android component runs long time task, listens events. give here

swift - Should I use weak self inside a computed property's closure? -

i confused using self inside closure. when should declare [weak self] ? obvious case understand is class foo{ var closure: ( void -> void )? var x = 0 func dosomething(){ closure = { [weak self] in if let x = self?.x{ println(x) } } } } however, if want create computed property bar , has closure, , captures self inside. this, extension foo{ var bar: bar{ let bar = bar() bar.completionhandler = { println(self.x) } return bar } } should use [weak self] inside closure?

mysql - Using class for inserting into database (PHP) -

i'm relatively new classes. have table of doctors has id, doc name, address, job , group belong to. have doctor class i've created, , method in class called newdoctor(), inserting new doctor database. i'm not seeing how doing within class advantageous? know classes/objects considered "better", , maybe i'm not implementing or best way, don't know how having method inside class better having function outside of class. please tell me if or if there's better way this! class doctor { function newdoctor($doc_info){ $database = new database(); $database -> query('insert doctors (first_name, last_name, address, city, state, zip, group_id, job) values (:first_name, :last_name, :address, :city, :state, :zip, :group_id, :job)'); $database -> bind(':firstname', $doc_info['firstname']); $database -> bind(':lastname', $doc_info['lastname']); $database -> bind('address...

youtube - Playing content on facebook timeline -

this question exact duplicate of: how show image video in facebook 1 answer previously believed og meta tag should looking i'm not sure. how share video youtube play on users timeline (this doesn't happen on phone). please i'm confused you should start reading docs. question broad. started, have on answer at how facebook select image display on timeline

css - Centering div with image in slider -

i used part of wordpress theme of developer , slider content floating top i want center content vertically , horizontally padding on sides padding:100px; someone can visit site , centering block? url of mywebsite , please share knowledge , hope solve problem. i looked through code, (thank god inspect element on google chrome!) , seems have header inside body of code, try moving page header above body in html. have found work me in cases. also next time try adding code relevant question op, faster , better answers edit: can centre horizontally changing left , right tags in css: .//div class here { left: 10%; right: 10%; width: 80%; } edit 2: try this, im not sure if work worth show: .//div class here { left: 10%; right: 10%; width: 80%; height: 80%; top: 10%; bottom: 10%; }

php - Pass a variable from Page1 to Page2 -

// page 1 - code below works fine, when click href link // variable want not sent page 2. <?php while ($row = mysql_fetch_array($result, mysql_assoc)) { echo '<tr> <td><a href="recipe_show.php?recipe_name=recipe_name"> ' . $row['recipe_name'] . ' </a></td> </tr>'; $recipe_name = $row['recipe_name']; } $_session['recipe_name'] = $recipe_name; echo '</table>'; // close table ?> // page2 - code below receives variable page 1, //last 1 in table , not 1 clicked. include ('core/init.php'); // connect database $recipe_name = $_session['recipe_name']; echo "my recipes is: ".$recipe_name."<br>"; ?> try using request.since users can see/alter data, not safest way of doing job. sessions not involved in technique. <?php while ($row = mysql_fetch_array($result, mysql_assoc)) { ...

google visualization - Annotation chart with style="display:none" resize automaticly -

if put div draw graph "style = display: none" attribute, resizes chart in half. <div id='chart_div_inmediata' style='width: 900px; height: 300px;display:none'></div> result : <div id="chart_div_inmediata" class="google-visualization-atl container" style="width: 900px; height: 300px; display: none;"> <div class="" style="position: relative; width: 400px; height: 200px;"> </div> how fix this? thank!

jquery fullCalendar - get day type from database and color specific date when calander load -

i using latest version of jquery full calendar. want color specific days in calendar using separate colors when calendar loading (not when event loading). keep dates color codes in separate mysql database table. here example of interface should like: https://drive.google.com/open?id=0b4yrdfcv-ciiq0w2djvfmxb0odg i'm stuck. here's have far: $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month'//'month,agendaweek,agendaday' }, fixedweekcount:false, businesshours: false, editable: false, droppable: true, // allows things dropped onto calendar loading: function (bool) { if (bool) { $('#loading').show(); } else { $('#loading').hide(); } } events: { url: '/leave/load_events', data: function () { // function returns object return { ...

How to use ResultSet of java to get precise value of float of mysql -

is possible in java, use resultset , precise value of float of mysql ? in database of mysql, have values of float long(for example, 123456789, more 7 digits), know if use select round(float_value_column,0) can precise value. if use resultset.getfloat of java, can rounded value(123457000, in mysql made select float_value_column ). may ask, if use resultset.getdouble , may precise value? or may resultset.getfloat(round(float_value_column,0)) ? thank much you can try below code resultset rs = ..... bigdecimal myvalue = rs.getbigdecimal("column name"); float myfloatvalue = myvalue.floatvalue(); more bigdecimal here . you can have @ sow post well.

opengl - GlunUnproject moving object with the mouse -

i'm trying move objects mouse using gluunproject method opengl 2.1 , i'm struggling here; here's code wrote : int viewport[4]; double modelview[16], projection[16], x1, y1, z1; double realy; glfloat depth[2]; for(_compt=_ojebctscene.begin();_compt!=_ojebctscene.end();_compt++) { if ((*_compt)->isselected()) { gldouble mousex=event.x; gldouble mousey=event.y; glgetintegerv(gl_viewport, viewport); glgetdoublev(gl_modelview_matrix, modelview); glgetdoublev(gl_projection_matrix, projection); realy = viewport[3] - (glint) mousey - 1; glreadpixels(mousex, realy, 1, 1, gl_depth_component, gl_float, depth); gluunproject(mousex, realy, 0, modelview, projection, viewport, &x1, &y1, &z1); (*_compt)->setx(x1); (*_compt)->sety(y1); (*_compt)->setz(z1); } } i use loop check objects on scene (i've pushed them vector) , when find selected objec...

osx - Get mounted volumes list with Swift? -

does know how list of removable volumes mounted swift? i've tried this, return list of files , subfolders of external drivers: let filemanager:nsfilemanager = nsfilemanager() let files = filemanager.enumeratoratpath("/volumes") while let file = files?.nextobject() { println(file) menu.additem(nsmenuitem(title: file as! string, action: selector(""), keyequivalent: "")) } this prints list of mounted volumes: let filemanager = nsfilemanager() let keys = [nsurlvolumenamekey, nsurlvolumeisremovablekey, nsurlvolumeisejectablekey] let paths = filemanager.mountedvolumeurlsincludingresourcevaluesforkeys(keys, options: nil) if let urls = paths as? [nsurl] { url in urls { println(url) } } you can of course filter paths inside "volumes" directory: let filemanager = nsfilemanager() let keys = [nsurlvolumenamekey, nsurlvolumeisremovablekey, nsurlvolumeisejectablekey] l...

python - How to extend username field length in Django 1.7.8? -

current django username length limit 30 characters. my profile model looks this: from django.contrib.auth.models import user class userprofile(models.model): user = models.onetoonefield(user) organization = models.foreignkey(organization) .... is there not ugly solution what 'right' way extend username field length in django 1.5+? p.s. deployed , there hundreds of users. can't implement own user class based on abstract user. need "hack". changed value directly in django local clone, is more ugly, monkey patching.

javascript - unexpected non-whitespace character after JSON data at line 1 column 991 -

i have wordpress site locally , trying build it's hybrid app using angularjs . in wordpress, created plugin fetch data. metadata in form of array as array ( [real_homes_gallery_slider_type] => array ( [0] => thumb-on-right ) [real_homes_property_images] => array ( [0] => 94 ) [real_homes_property_price] => array ( [0] => 3850 ) [real_homes_property_size] => array ( [0] => 2800 ) [real_homes_property_bedrooms] => array ( [0] => 2 ) [real_homes_property_bathrooms] => array ( [0] => 1 ) [real_homes_property_garage] => array ( [0] => 1 ) [real_homes_property_address] => array ( [0] => athwa gate, surat, gujarat 395008, india ) [real_homes_property_location] => array ( [0] => 21.1852392,72.80947859999992 ) [real_homes_tour_video_url] => array ( [0] => http:...

android - How to handle input via Bluetooth in Google Cardboard? -

i using google cardboard sdk along unity 3d build first unity tutorial (roll ball) google cardboard. need move main player ball (the white 1 in tutorial) collect small yellow cubes.now,google cardboard allows head tracking along single switch (magnetic/conductive foam) out of box.in order move ball,i need attach controller. this plan -> buy joystick. connect arduino. attach bluetooth module arduino. i need know how receive bluetooth data in game. should code inside main player script's void update() method? any appreciated. thank :) don't why need arduino. i made cardboard game (flight simulator type). bought ipega 9028 gamepad aliexpress. binded android / iphone , thats it. (unless phone doesnt have bluetooth... in case should invest in new phone not in new arduino :) ) in unity app, first need bind keys , save them in playerprefs, because have no way of knowing button / axis translates unity button number / axis number. so in input manager in unity...

c++ - How do I search for end of line ('\n') in a UTF-8 text? -

i have c++ library provides i/o device interface (including implementation files). provides utf-8 string class. now, need read line iodevice . reason i'm mentioning library can't, example, open file std::ifstream , read using std::wbuffer_convert<std::codecvt_utf8<wchar_t>> . don't mind using stdlib (in fact, prefer it), need read line iodevice , return string . now, specific question: if read file byte byte, safe assume byte value '\n' in fact new line symbol, , not trailing part of different multi-byte symbol? is safe assume byte value '\n' in fact new line symbol, , not trailing part of different multi-byte symbol? yes, in utf-8, ascii bytes not occur in non-ascii code points.

laravel - How can I investigate an exception in console? -

i have created console command requires 2 dependencies: public function __construct(loopinterface $loop, clientimpl $asteriskclient) { parent::__construct(); $this->loop = $loop; $this->asteriskclient = $asteriskclient; } i have written service provider both of these. know 1 client working (since isn't new , i've used before), here how i've added react event loop: namespace app\providers; use illuminate\support\serviceprovider; use react\eventloop\factory; class reactloopserviceprovider extends serviceprovider { protected $defer = true; /** * bootstrap application services. * * @return void */ public function boot() { // } /** * register application services. * * @return void */ public function register() { $loop = factory::create(); $this->app->bind('react\eventloop\loopinterface', $loop); } public function provid...

ios - Cancel Auto-Renewable Subscription in In-app purchase -

i use auto-renewable subscription in application, when test it. want cancel auto-renewable subscription in sandbox environment can't find link more question: if sandbox environment don't allow cancel auto-renewable subscription. so, beta testing testflight can it? as far know u can cancel auto renewable subscription user, not dev or tester. link provided way cancel auto renewable subscription.

java - Compress the images on uploading using Google drive REST API -

i trying upload images google drive using google drive rest api java clients. basically images of 4 - 5 mb size, how can compress image size while uploading? something similar google photos application compresses images standard size while uploading images.

python - wx.EVT_MAXIMIZE prevented exiting full screen -

i have frame 1 radio box toggle full screen. frame go full screen when user clicks maximize button. however, if use maximize button, radio box fail restore window. if use radio box go full screen, able restore window. import wx class fswindow(wx.frame): def __init__(self, *args, **kwargs): wx.frame.__init__(self, *args, **kwargs) self.setsize((800, 600)) self.radiofullscreen = wx.radiobox(self, -1, "display", choices=["windowed","full screen"]) self.radiofullscreen.bind(wx.evt_radiobox, self.fs) self.bind(wx.evt_maximize, self.onmaximize) self.sizer = none self.show() def fs(self, event): if self.radiofullscreen.getselection(): self.showfullscreen(true) else: self.showfullscreen(false) def onmaximize(self, event): self.showfullscreen(true) # <-- add self.restore() or self.maximize(false) here self.radiofullscreen.setselection(1) app = wx.app() frame =fswindow(none, -1, "mainwindow") app.mainloop() ...

python - Wrong format in Drive API when exporting spreadsheet as CSV -

i glad see drive api supports exporting spreadsheets csv files, , seems work fine. however, not work docs. i'm using exact same code 2 different docs , 1 of them returned in proper csv format. other 1 returned in xlsx format, though format specified csv. here's code used: export_url = "https://docs.google.com/spreadsheets/exportid=%s&exportformat=csv" % key _response, content = self.drive_api._http.request(export_url) also verified exportlink doc, , lists csv format , exact same url above. still, it's returning in xlsx format. has noticed this? bug in api, or doing wrong? thanks, anders yes there bug in google spreadsheet api yesterday. google instantly took account , fixed till evening. developers experiencing 500 , 403's. hope issue resolved @ end too.

angularjs - Django Token based authentication using PyJWT , issue with verification of token -

i implementing token based authentication in python django , therefore following token based authentication steps, described here: in token-based authentication, cookies , sessions not used. token used authenticating user each request server. let's redesign first scenario token-based authentication. it use following flow of control: the user provides username , password in login form , clickslog in. after request made, validate user on backend querying in database. if request valid, create token using user information fetched database, , return information in response header can store token browser in local storage. provide token information in every request header accessing restricted endpoints in application. if token fetched request header information valid, let user access specified end point, , respond json or xml. i done first 2 steps listed above. need proceed step 3 , step 4. therefore, writing django decorator task us. ...