Posts

Showing posts from April, 2010

objective c - iOS - Adding Obj-C Files in Watch Extension causing Error -

Image
i have project (objective-c) in have added watchkit app in swift. want use objective-c classes in swift. using xcode 7.3 i created bridging header, added swift compiler inside build setting of app target , watch extension. the problem facing access objective-c class must add class target membership of watch extension. complier gives error inside watch extension of classes never ever added watch extension. main viewcontroller giving error cant find uiviewcontroller class being inherited. the error right because compiling watch extension never added watch app or extension. what problem? how can solve issue occurring out of no have added watch app in other apps using same methodology. edit: here error getting on classes not added extension. i solved issue causing files appear in other targets (watchkit). had created custom pch file , added manually main project. later on when created new target (watchkit) automatically copied pch files settings. classes added p

ios - Can I pull all of my game center apps and achievements like the Game Center App displays or just current app only -

can view of game center achievements within app creating. can pull in leaderboard apps. works fine. need see of scores , achievements every app have in game center. game center app does. appreciated. thanks i haven't tried myself, in itunesconnect | | features | game center there option create "groups" share achievements , leaderboards across multiple apps. might able achieve want putting apps in single group.

PHP autodetect translatables / detect piece of code by regex -

Image
i'm having multilanguage site stores translatables within default.php filled array contains keys. i prefer make automatic. have (singleton) class able detect files based type. (controller, action, view, model, etc...) i detect piece of code of format this: $this->translate('[a-za-z]'); $view->translate('[a-za-z]'); getview()->translate('[a-za-z]'); throw new exception('[a-za-z]'); addmessage(array('message' => '[a-za-z]'); however must filtered when starts with/contains: $this->translate('((0-9)+_)[a-za-z]'); $this->translate('[a-za-z]' . $* . '[a-za-z]'); // variable in middle must filtered, begin or end still allowed ofcourse [a-za-z] regex example. like sais have class detect files. class make use of reflection (or in case zend reflection, i'm using zend) not see way reflect function using regex. the action placed within cronjob , manual called action not big issue w

sql - GroupAggregate for Subquery in Redshift/PostgreSQL -

i've noticed strange behavior in query optimizer redshift, , i'm wondering if can explain or point out workaround. for large group by queries, it's pretty essential optimizer plan groupaggregate rather hashaggregate, doesn't try fit temporary results in memory. works fine me in general. when try use group by subquery, switches hashaggregate. for example, consider following query. select install_app_version, user_id, max(platform) plat dailies group install_app_version, user_id; the table dailies has sortkeys (install_app_version, user_id) , distkey (user_id). hence groupaggregate possible, , query plan looks this, should. xn groupaggregate (cost=0.00..184375.32 rows=1038735 width=51) -> xn seq scan on daily_players (cost=0.00..103873.42 rows=10387342 width=51) in contrast, if use above in subquery of other query, hashaggregate. example, simple as select count(1) ( select install_app_version, user_id, max(platform) plat daily_players

VB.Net WebRequest and CloudFlare -

obviously cloudflare messes response of webrequest i've caught result , opened webbrowser instead loads through site , (i presume) gives me cookie. later might want call , rather repeat browser process i'm trying webrequest using cookie browser. i'm winging here on browser (once site has loaded normally) have: webrequest.headers.add("cookie", webbrowser.document.cookie) smarkweb.usecookies = true but next webrequest still fails @ cloudflare while cookied browser can navigate around site fine. any hints on i'm missing?

Modify solr host and port for Spring Boot actuator heath check -

i have solr server running on different host , port traditional. there way configure them through application.properties file, health returns correct status? the solr health indicator uses auto-configured solrserver instance check solr's health. can configure ip address/hostname , port, etc using spring.data.solr.host property. example: spring.data.solr.host=http://192.168.1.2:3456/solr

java - org.eclipse.equinox.weaving.aspectj missing in Eclipse Neon release? -

i updated eclipse target definition mars neon: http://download.eclipse.org/releases/mars http://download.eclipse.org/releases/neon now launch missing org.eclipse.equinox.weaving.aspectj bundle. in mars equinox target components provided bundle, neon not. feature have choose back? maybe update site? edit: mars equinox weaving sdk feature contained bundle, feature not available in neon update site. eclipse bug 470000 seems discussion of this. seems aspectj parts of code have been moved eclipse ajdt project , no longer included in neon version of eclipse weaving sdk. the bug mentions ajdt update sites.

Jira Plugin user specific settings -

i've started writing first jira plugin , need implement user specific settings, ones returned this: select * jiraschema.propertyentry entity_name = 'applicationuser' for able save global settings plugin using pluginsettingsfactory, need have different settings each user. know how implement such thing? thank you. i've found solution accessing applicationuser properties. here method, maybe helps someone: userpropertymanager userpropertymanager = componentaccessor.getuserpropertymanager(); string propvalue = null; //get user specific property propvalue = userpropertymanager.getpropertyset(componentaccessor.getjiraauthenticationcontext().getuser()).getasactualtype("workflow-mode").tostring(); //set new user specific prop componentaccessor.getuserpropertymanager().getpropertyset(componentaccessor.getjiraauthenticationcontext().getuser()).setstring("my_new_prop_name", "my_new_prop_value");

box api - OpenSSL unable to verify data: error:0906D06C:PEM routines:PEM_read_bio:no start line in Box API -

im getting above error when sending following body box oauth /token operation: grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&client_id=.............&client_secret=..........&assertion=eyjhbgcioijsuzi1niisinr5cci6ikpxvcisimtpzci6im81ngftcgr6in0=.eyjpc3mioiiyohrhzmz0ejhlenhncni3atbocmznmgltetc2mjrumyisinn1yii6iju0mja5msisimjvef9zdwjfdhlwzsi6imvudgvychjpc2uilcjhdwqioijodhrwczovl2fwas5ib3guy29tl29hdxromi90b2tlbiisimp0asi6ije0ndyymza3mtgxmjm0ntyilcjlehaioje0ndyymza3njgsimlhdci6mtq0njizmdcxoh0=.anwpzohhfyumpmw1wh6km8xzqsuans3uidepn40hvpvdmzi9ws0ftpmxwvudgppxxmee0cr+frbmx+r9v9dvzfjsgv2+mu1bqwsjhwpkoy06iigavgijppft9cuidmy/h6pgtdpodfeau77krt0ojhpqx9he4xy0mas26d7yc/5f3fyxzxhdg/xztpx88xtpg2hbej5imezjxkff6zh4un0zy9tj3tseittcqrxhaun2qattnx8h5jmkwyte5u78+f1lzqz1lpjnqsj/bsrcrf2jkf7n0lfjwq3u1bxnbwiezrw8wqvatvzlpioddsl6vug/xs1m549wgvwyxcgljq== now jwt, of assertion parameter, verifies correctly @ jwt.io, , public key defined box verifies in box ui @ jwt.io. this indicates m

list - Encountering IndexError when file parsing with Python -

i have file containing previous tcpdump, file has lines in format: 17:20:03.867998 ip 23.222.75.204.443 > 192.168.0.15.51773: flags [.], ack 518, win 916, options [nop,nop,ts val 303057114 ecr 43022775], length 0 17:20:03.870231 ip 209.148.192.43.80 > 192.168.0.15.60174: flags [.], seq 1:1449, ack 511, win 486, options [nop,nop,ts val 1840008838 ecr 43022779], length 1448 my function extracts specific strings in each line (the source , destination addresses) , prints them. strange thing works (everything should print does) in end error. here's code: def parse_file() : try : file_object = open("tcp_dump","r") x in file_object.readlines() : source_ip=x.split("ip ")[1].split(" >")[0] dest_ip=x.split("> ")[1].split(": flags")[0] print(source_ip) print(dest_ip) file_object.close() except ioerror : print("the specified file not foun

python - Looping through a folder to merge several excel sheets into one column -

i have several workbooks, each 3 sheets. want loop through each workbook , merge data sheet_1 new workbook_1 file, sheet_2 workbook_2 file & sheet_3 workbook_3. as far can tell script below need, except rather appending data, overwrites data previous iteration. for sake of parsimony i've shortened, cleaned & simplified script, i'm happy share full script if needed. import pandas pd import glob search_dir= ('/users/path/*.xlsx') sheet_names = ['sheet_1','sheet_2','sheet_2'] def a_joiner(sheet): loop_x in glob.glob(search_dir): try: if sheet == 'sheet_1': id_file= pd.excelfile(loop_x) df_1 = id_file.parse(sheet, header= none) writer= pd.excelwriter('/users/path/%s.xlsx' %(sheet), engine= 'xlsxwriter') df_1.to_excel(writer) writer.save()

Javascript/Jquery How to compare ID's and if true, not call a function -

i have javascript imported snow.js file displays "snow falling" across screen when it's winter. if choose summer theme on same page still display snow falling. <script src="js/snow.js" type="text/javascript"><script> is way create javascript code if click on summer theme remove/comment imported file , add/re-move commenting on imported file when click on winter theme? edit: i using snowstorm.js plugin realized can call function "snowstorm.togglesnow()" via script. need adjust it, if click on css button "summer" whilst on theme summer nothing. i created jquery/js code doesn't work. believe it's brackets not sure. should solve problem. update: i got working, if user clicks button "toggle" snowstorm effect on , off. $("#summer").click(function(){ snowstorm.togglesnow() }); $("#winter").click(function(){ snowstorm.togglesnow() }); is there way of i

C++ - How do I insert multiple values into a vector, each with a different index? -

currently have vector holding references rooms connected specific room: rooms.at(1).connectedrooms = { &rooms.at(2), &rooms.at(3), &rooms.at(4), &rooms.at(5)}; however use enum index, rather integer, instead of rooms.at(1).connectedrooms.at(0) use rooms.at(1).connectedrooms.at(north) makes more sense , allows used more , legibly in switch statements. the enum looks like enum directions { north, east, south, west}; is there way on 1 line, example (this code doesn't work, it's do): rooms.at(1).connectedrooms[north, east, south, west] = {&rooms.at(2), &rooms.at(3), &rooms.at(4), &rooms.at(5)}; rather longer rooms.at(1).connectedrooms[north] = &rooms.at(2); rooms.at(1).connectedrooms[east] = &rooms.at(3); rooms.at(1).connectedrooms[south] = &rooms.at(4); rooms.at(1).connectedrooms[west] = &rooms.at(5); thanks you can assign integer values enum constants: enum directions { north = 0, east = 1, south =

openerp - Best way to show fields not in the model in a One2many widget ODOO -

i want show column on form field want access not store in model. i've following models: class class1(models.model): _name = 'module.class1' field1 = fields.integer(string='field1') field2 = fields.integer(string='field2') class class2(models.model): _name = 'module.class1' field1 = fields.integer(string='field1') field2 = fields.integer(string='field2') class3_ids = fields.one2many('module.class3', 'class2_id', string="class2") class class3(models.model): _name='module.class3' class2_id = fields.many2one('module.class2') class1_id = fields.many2one('module.class1') field1 = fields.float(string='field1') i'm form want display in class1 form class2 records show class1 fields somethin this: <record id="module_class1_form" model="ir.ui.view"> <field name="name">module_class

html5 - Validating form using javascript -

i trying validate form using external js file, wanting make "your name", "your email" , "is new page" mandatory field can not left blank, have been playing around different javascript functions cant seem work, feel simple mistake have made cant seem figure out. appreciate if take , see if can spot mistake. form: <form method="post" action="#"> <h3 class="formheader">form header</h3> <div class="formpod"> <fieldset role="presentation"> <div class="formrow clearfix"> <span><label for="customername">your name</label></span> <input name="customername" id="customername" type="text" size="60" maxlength="200" /> </div>

SQL Server 2014 replace with regex -

Image
what best way replace string in column like: let's have table column type varchar , possible value contains: 'sample text min(my value) continue sample text ) , (' note : value can vary. now replace with: min(max(my value)) so final value in case be: 'sample text min(max(my value)) continue sample text ) , (' i perform update on whole table. is possible using pure t-sql? so 2 sample rows before => , after transformation: 1. value is: min(10). => value is: min(max(10)) 2. sample min(cat) => sample min(max(cat)) basically replace occurrences of min(value) min(max(value)) 'value' can string first of need user defined function search replacing pattern string: create function dbo.patternreplace ( @inputstring varchar(4000), @pattern varchar(100), @replacetext varchar(4000) ) returns varchar(4000) begin declare @result varchar(4000) set @result = '' -- first character in match declare @

c# - One to many with additional properties in Entity Framework -

i new ef , have got basic question. can please advise how implement below scenario using code first approach ? public class book { public int id {get; set;} public string title {get; set;} public string author {get; set;} public datetime dateborrowed {get; set;} public datetime datereturned {get; set;} public virtual user borrower {get;set;} } public class user { public int id {get;set;} public string username {get;set;} public string email {get; set;} public virtual icollection<book> books {get; set;} } i maintain both book , user classes/underlying tables maintain unique collection of records every time. in other words, how separate dateborrowed , datereturned properties in separate class book borrowing , returning transactions maintained in separate sql table. current setup allow each book have 1 single record of when borrowed , when returned. every time borrowed or

linux - Bash script to convert imgs in subfolders to video (using ffmpeg and Ubuntu) -

i'm trying convert files in folders given allfolders.txt > head foldernames.txt 0001 0002 0003 0004 0005 ... to video using ffmpeg ffmpeg version 2.2.3 copyright (c) 2000-2014 ffmpeg developers built on apr 20 2015 13:38:52 gcc 4.8 (ubuntu 4.8.2-19ubuntu1) configuration: --prefix=/home/myusername/usr/local --enable-nonfree --enable-gpl --enable-pic --enable-shared --enable-libx264 --disable-vaapi according answers here on stackoverflow wrote following bash script: #!/bin/bash while read p; cd "$p" ffmpeg -f concat -i "allimgnames.txt" -framerate 30 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4 cd - done < foldernames.txt where allimgnames.txt text file containing image names. the strange thing works few videos rest of filelist fails saying allimgnames.txt: no such file or directory , not true. checked paths several times. can execute ffmpeg ... command above manually without problems. don't know

c# - An exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Data.dll but was not handled in user code -

i developing asp.net mvc application mysql. running smoothly until got error after building web project: an exception of type 'system.configuration.configurationerrorsexception' occurred in system.data.dll not handled in user code here exception details: system.configuration.configurationerrorsexception unhandled user code hresult=-2146232062 message=Échec de la recherche ou du chargement du fournisseur de données .net framework inscrit. source=system.data baremessage=Échec de la recherche ou du chargement du fournisseur de données .net framework inscrit. line=0 stacktrace: à system.data.common.dbproviderfactories.getfactory(datarow providerrow) à system.data.common.dbproviderfactories.getfactory(string providerinvariantname) à system.data.entityclient.entityconnection.getfactory(string providerstring) à system.data.entityclient.entityconnection.changeconnectionstring(string newconnectionstring) à system.data.entityclient

Reagent React Clojurescript Warning: Every element in a seq should have a unique :key -

i have copied 2 year old gist here . working figwheel , uses more recent version of reagent/react. looking generic way of isolating warning message comes javascript console: warning: every element in seq should have unique :key . idea put :key generated unique value components. messages ought disappear , i'll in position see components needed unique :key . problem although unique :key being put of them, warning message still seen. so - able tell me component have missed or otherwise i've done wrong? can see source (permalink) have added :key (gen-key) 2 components: [:polyline {:key (gen-key) ... , [:svg {:key (gen-key) ... @ lines 43 , 68 respectively. edit answer (permalink) , in terms of code anyway. placement of ^{:key (gen-key)} @ lines 44 , 60. note function gen-key made debugging. natural keys replace. this how might implement gen-key : (defn gen-key [] (gensym "key-")) and here's way done in links above: (def uniqkey (atom 0))

Use object type query param in swagger documentation -

i have route encode object parameter in url query string. when writing swagger documentation errors disallow me use schema / object types in query type parameter: paths: /mypath/: get: parameters - in: path name: someparam description: param works required: true type: string format: timeuuid #good param, works - $ref: "#/parameters/mysortingparam" #this yields error parameters: mysortingparam name: paging in: query description: holds various paging attributes required: false schema: type: object properties: pagesize: type: number cursor: type: object properties: after: type: string format: string the request query param having object value encoded in actual request. even though swagger shows error @ top of screen object rendered correctly in swagger ui editor, error

ios - Console shows AutoLayout Engine Warning while loading UIWebView and Crashes the app sometimes -

summary: while trying load url/html string on uiwebview console shows warning "this application modifying autolayout engine background thread after engine accessed main thread. can lead engine corruption , weird crashes." , crashes app @ point. steps reproduce: load url/html string on uiwebview . console show autolayout engine warning. app crashed times(uncaught exception: run on main thread!). expected results: app should not show warning while loading uiwebview , should not crash app due warning. actual results: application modifying autolayout engine background thread after engine accessed main thread. can lead engine corruption , weird crashes. stack:( 0 corefoundation 0x0000000188e35998 <redacted> + 148 1 libobjc.a.dylib 0x00000001884304bc objc_exception_throw + 56 2 corefoundation 0x0000000188e358c8 <redacted> + 0 3 foundation

jquery - wrapInner() of body until a specified element -

using below html: <body> <h1>foo</h1> <div>a</div> <div>b</div> <h4>bar</h4> <div>c</div> <div id="wrap-until"></div> </body> i can wrap whole of body section using $('body').wrapinner('<div class="content"></div>'); but how can wrap body content until wrap-until div element, looks like: <body> <div class="content"> <h1>foo</h1> <div>a</div> <div>b</div> <h4>bar</h4> <div>c</div> </div> <div id="wrap-until"></div> </body> note: content inside body different #wrap-until element available. you can grab required elements , use not() exclude wrap-until element wrapall() , this: $('body > *').not('#wrap-until').wrapall('<div class="

ios - swift2 how can an object of SKScene class takes a size as a parameter? -

Image
i following tutorial this code class gamescene: skscene { override func didmovetoview(view: skview) { } override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { } override func update(currenttime: nstimeinterval) { } } as see there no init method. though when in view controller: //create , configure scene scene = gamescene(size : skview.bounds.size) where scene is: var scene: gamescene! it works. how can gamescene approves have init size though didn't code that? any additial information sksprite appreciated. new framework your gamescene subclass of skscene , inherit init size initializer skscene . if command -click on skscene in code, bring header information class: public class skscene : skeffectnode { /** called once when scene created, one-time setup here. scene infinitely large, has viewport frame through present content of scene. passed in size defines size of

python - Django adds square Brackets in querying sql server -

i trying connect azure sql service django on mac osx. when following from photo_mapper.models import restaurant rest_query = restaurant.objects.all().query print rest_query select [ate_it.restaurant].[id], [ate_it.restaurant].[name], [ate_it.restaurant].[area], [ate_it.restaurant].[city], [ate_it.restaurant].[submitter], [ate_it.restaurant].[pending], [ate_it.restaurant].[zid] [ate_it.restaurant] due when restaurant.objects.all() traceback (most recent call last): file "<console>", line 1, in <module> file "/users/anubhav/workspace/ate-it/venv/lib/python2.7/site-packages/django/db/models/query.py", line 234, in __repr__ data = list(self[:repr_output_size + 1]) file "/users/anubhav/workspace/ate-it/venv/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __iter__ self._fetch_all() file "/users/anubhav/workspace/ate-it/venv/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in

python - Using shapely with PostgreSQL -

are there "best practices" of using shapely postgresql? playing around register_adapter , friends have following code. there better ways? from psycopg2.extensions import ( adapt, register_adapter, asis, new_type, register_type ) shapely.geometry import point, polygon import numpy np import psycopg2 conn = psycopg2.connect(host='localhost', user='postgres') cur = conn.cursor() cur.execute('create table pts (pt point)') conn.commit() def quote(v): return adapt(v).getquoted().decode() def adapt_point(pt): x, y = quote(pt.x), quote(pt.y) return asis("'(%s, %s)'" % (x, y)) register_adapter(point, adapt_point) points = [ (point(x, y), ) x, y in [(0, 0), (1, 0), (1, 1), (2, 3), (0, 1)] ] cur.executemany('insert pts (pt) values (%s)', points) conn.commit() def adapt_polygon(poly): pts = np.stack(poly.exterior.xy).t inner = ', '.join('(%s, %s)' % (quote(x), quote(y

html - Navbar align part right part left errors -

i'm trying create navbar items on left , items on right (item 1 on left, items 2 , 3 on right). jsfiddle has current code. what have tried fix issue: float: right text-align:right none of them seem work. i'm sure there super simple solution, can't think of it. html: <div class="navbar"> <!--create button home --> <p class="innav">num1</p> <p class="hl">|</p> <p class="rightin">num2</p> <p class="hl">|</p> <p class="rightin">num 3</p> <p class="hl">|</p> </div> css: div.navbar{ width:100%; height: 30px; background-color: #03572c; } p{ display: inline; } p.innav{ color:white; font-size: 24px; width: 30px; height: 30px; margin-left: 10px; margin-top: 10px; } p.rightin{ color:white; font-size: 24px; width: 30px; height: 30px; margin-lef

html - Horizontal scroll using nowrap and inline-block -

i'm developing horizontal scrolling gallery using white-space: nowrap , display: inline-block . gallery composed of series of image panes , text pane @ end inside container. can @ example here: https://jsfiddle.net/zcf0va58/3/ .container { display: inline-block; white-space: nowrap; border: 1px solid red; } .post-image { display: inline-block; vertical-align: top; } .post-text { display: inline-block; vertical-align: top; max-width: 100px; width: 100%; white-space: normal; } <div class="container"> <div class="post-image"> <img src="http://uc48.net/europeana/images/fpo_square.png" width="100" height="100" /> </div> <div class="post-image"> <img src="http://uc48.net/europeana/images/fpo_square.png" width="100" height="100" /> </div> <div class="post-image">

javascript - Display map markers inside area -

i have large number of locations stored in database want display on google map when inside specified area. have of functionality want working, route searchable between 2 places , map markers in database showing on map. the part unsure of how display markers inside boxpolys created routeboxer. pulling in locations static json file testing purposes. var map = null; var boxpolys = null; var directions = null; var routeboxer = null; var distance = null; // km function initialize() { var mapoptions = { center: new google.maps.latlng(54.604008, -5.930415), maptypeid: google.maps.maptypeid.roadmap, zoom: 8 }; var input = document.getelementbyid('from'); var autocomplete = new google.maps.places.autocomplete(input); var input2 = document.getelementbyid('to'); var autocomplete2 = new google.maps.places.autocomplete(input2); map = new google.maps.map(document.getelementbyid("map"), mapoptio

Reset while loop conditions in python to "play the quiz again" -

i'm still new @ this. essentially, need code reset while loop. when user reaches end of quiz, asks if user play again. if user inputs y quiz should restart. my code: print("moose quiz") question = 0 # tells questions user has completed questions = ["what average life span of moose?: ", "how moose eat on daily basis?: ", "the fastest moose ran...?: "] useranswers = ["","",""] # stores users answers answers = ["a. 10 - 14 years\nb. 15 - 25 years\nc. blue\nd. 26 - 35 years\n", "a. 24 lbs day\nb. 39 lbs day\nc. 67 lbs day\nd. 73 lbs day", "a. 20 mph\nb. 25 mph\nc. 35 mph\nd. 40 mph"] correct = 0 while question < 3: print(questions[question]) print(answers[question]) answers[question] = input("to answer, pick letter or leave blank skip it: ").lower() if question == 0: if answers[question]

ios - How to change border of UIButton if touched outside of UIButton? -

currently trying create stereotypical "selected" action of object. is, when click on object, border changes different color, , when click outside object, border changes normal color. can figure out how change border of object when touch inside of object(in case, uibutton) however, cannot figure out how change border of uibutton original state when touch outside of uibutton. here code far: - (void)longpress:(uilongpressgesturerecognizer*)gesture { if ( gesture.state == uigesturerecognizerstatebegan ) { gesture.view.layer.bordercolor = [uicolor lightgraycolor].cgcolor; uialertcontroller * alert= [uialertcontroller alertcontrollerwithtitle:@"would delete rep?" message:nil preferredstyle:uialertcontrollerstylealert]; uialertaction* deletebutton = [uialertaction actionwithtitle:@"delete"

javascript - Is there a JS Module loader that loads into global namespace? -

i achieve - js file 1: class polygon { ... } js file 2: import 'polygon.js' class square extends polygon { ... } is there module loading framework allow me (without having encapsulate imports 'polygon.js' inside variable)

android - How login process should look like? -

i have problem how login porcess should like. i've written client , server , process of login looks like: put no phone , password -> click "login/sign up" client creates user object put phone number , password. client sends request server i.e integer = 1 -> server waiting user object. client sends newly created user (2)) server. client waiting answer (integer) server checking if user exist: if yes, next step check password, if pass ok server sends client answer 1, , next sends user object database user details. if yes, pass not ok, answer 0, , nothing sended, if no, answer -1, , nothing sended. client answer: int = 1 -->(user exist, pass ok) --> object, data object int = 0 -->(user exist, pass not ok) --> toast "try again" int = -1 --> (user not exist) -->go profil if answer -1 open profil activity , details user, put details in user object , sends server request code int = 2 --> write user user list is way of

sublimetext2 - Regex to get all data after certain word and between quotation marks -

Image
this question has answer here: regex: grabbing values between quotation marks 15 answers i have xml file lots of data, contains list of ids looks this <test test-id="014727"> <not-test not-test-id="11111"> <not-test not-test-id="22222"> <not-test not-test-id="3333"> <test test-id="019727"> <test test-id="013727"> so far have searched test-id gives me list of numbers, doesn't filter out additional info. using regex in sublime text, how can list of numbers after test-id ? so example above have 3 lines of: 014727 019727 013727 edit original question edited exclude <not-test not-test-id="11111"> nodes. modify step 2 below add space ( ) before test-id in search query. rest of steps stay same. the following keystrokes use su

"<Model> with this <field> already exist" on PUT call - Django REST Framework -

i'm doing http put call update data of object nested relationship , , i'm met following error: http 400 bad request "attributechoice slug exists." the reason why confusing because i'm doing http put call , expect treat update , not create . my models this: class attribute(models.model): name = models.charfield(max_length=100) text_input = models.booleanfield(default=false) slug = models.slugfield(unique=true) class attributechoice(models.model): attribute = models.foreignkey(attribute) value = models.charfield(max_length=100) slug = models.slugfield(unique=true) my serializers this: class attributechoiceserializer(serializers.modelserializer): class meta: model = attributechoice fields = '__all__' extra_kwargs = {'id': {'read_only': false}} class attributeserializer(serializers.modelserializer): attributechoice_set = attribute

javascript - How to invoke rotate method in cropperjs -

im using cropperjs, want create button invoke rotate method in cropperjs, i.e have button 90 degrees clockwise , 90 degrees anticlockwise. tried code below didnt work. <script> window.addeventlistener('domcontentloaded', function () { var image = document.getelementbyid('image'); var imgrotate = document.getelementbyid('rotateimg'); var cropper = new cropper(image, { aspectratio: 20 / 15, built: function () { } }); document.getelementbyid('rotateimg').onclick = function () { cropper.rotate(90); }; }); </script> two steps : 1) ensure function called, can trace following. document.getelementbyid('rotateimg').onclick = function () { console.log("i'm in, go step 2"); cropper.rotate(90); }; 2) need tell cropper allow functionnalities want use

android - How to automatically save and load user input kivy -

i making app there profile screen in can enter generic profile information (name, height, weight, ect..) using textinput boxes. know there way put button next each textinput box save information , button load information. wondering if there way automatically load information when user opens app rather manually loading information hitting button. have suggested ussing subclass of configparser parse standard ini files , use load app-specific settings, have no idea how this. kivy file: <phone>: result: _result h: _h w: _w anchorlayout: anchor_x: 'center' anchor_y: 'top' screenmanager: size_hint: 1, .9 id: _screen_manager screen: name: 'home' canvas.before: rectangle: pos: self.pos size: self.size source: "/home/aaron/desktop/main.png" label: markup: true text: