Posts

Showing posts from September, 2011

windows - Comparing contents received at Socket with a String in UDP -

i have developed udp client server application. want check if client sends string "exit", server receives string, compares "exit" string , program exits. in case, server not able compare received string "exit" string. below coding: client: char exitbuffer[]="exit"; if (sendto(socketidentifier,exitbuffer,strlen(exitbuffer) , 0 , (struct sockaddr *) &connectedsocket, sizeof(connectedsocket)) == socket_error) { exit(exit_failure); } server: if ((recv_len = recvfrom(socketidentifier, receivebuffer, sizeof(receivebuffer), 0, (struct sockaddr *) &clientsocket, &clientsocketlength)) == socket_error) { messagebox(null, exit(exit_failure); } // comparing contents of receive buffer if (receivebuffer == "exit") { exit(0); } i tried memcmp , did :) comparison done on server side follows: if(memcmp(receivebuffer,"exit",5) == 0) { //receivebuffer eqaul "exit". }

pandas - set attribute when attribute changes in python -

i have class has attribute pandas dataframe. define attribute in same class changes when dataframe altered. thought setter might correct approach haven't been able work. here toy example: import pandas pd class foo(object): def __init__(self, df=none): self._df = df self.altered = false # bool, set true if self._df changes @property def df(self): return self._df @df.setter def df(self, df): self.altered = true # since _df might change here set self.altered true self._df = df df_test = pd.dataframe([[1,2,3]], columns=['a','b','c']) cl = foo(df_test) cl.df.loc[0, 'a'] = 3 # change default value in dataframe print(cl.df) print(cl.altered) which prints altered dataframe cl.altered still set false. any suggestions? i don't know pandas. setter isn't called because line was: cl.df.loc[0, 'a'] = 3 it have been called if line was: cl.df = 3 one thing stor...

php - Concrete5 package helper - How to fix Fatal error: Call to undefined method NavigationHelper::getURLSegment() error? -

sorry, we've looked @ million answers either don't understand them or don't apply. navigation helper: we have concrete5 package , have created helper file at: /packages/package-name/helpers/navigation.php it contains following: <?php defined('c5_execute') or die('access denied') ?> <?php class navigationhelper { // url segments public function geturlsegments() { return explode("/", parse_url($_server['request_uri'], php_url_path)); } // specific url segment public function geturlsegment($n) { $segs = $this->geturlsegments(); return count($segs) > 0 && count($segs) >= ($n-1)?$segs[$n]:''; } } loading helper then have element file load package helper this: $navhelper = loader::helper('navigation','package-name'); calling method but when try call method this: if ($navhelper->geturlsegment(1) == 'whats-on...

How to expand a Tensorflow Variable -

is there way make tensorflow variable larger? like, let's wanted add neuron layer of neural network in middle of training. how go doing that? answer in this question told me how change shape of variable, expand fit row of weights, don't know how initialize new weights. i figure way of going might involve combining variables, in initializing weights first in second variable , adding in new row or column of first variable, can't find lets me either. there various ways accomplish this. 1) second answer in post ( https://stackoverflow.com/a/33662680/5548115 ) explains how can change shape of variable calling 'assign' validate_shape=false. example, like # assume var [m, n] # add new 'data' of shape [1, n] new values new_neuron = tf.constant(...) # if concatenating add row, concat on first dimension. # if new_neuron [m, 1], concat on second dimension. new_variable_data = tf.concat(0, [var, new_neuron]) # [m+1, n] resize_var = tf.assig...

javascript - AngularJS ng-repeat column aware table -

i have following model: item : {data: string, schedule: datetime, category: string} i need display report of data in following way: <table> <tr> <th>time range</th> <th>category 1</th> <th>category 2</th> <th>no category</th> </tr> <tr> <td>6:00 - 2:30</td> <td>3</td> <td>5</td> <td>7</td> </tr> </table> so need compile , filter list of items time ranges , display totals based on categories. how can accomplish angular , tell column in (and therefore choose right value display) categories dynamic. edit: table display summary of items. you'll have take items , compile form time range , # in category 1 , # in category 2 , # in no category . thing set me time ranges. i plan store data in hash map keys category names, need know column in categories dynamic....

How do I display returned JSON from RESTful API call with JavaScript -

after parsing json object, how display returned data restful api call vanilla javascript? do create html elements data , add them page or have hidden html elements , innerhtml returned data display elements via css? i decided best approach needed create html template @ bottom of html. way reduce number of dom elements have manually code: <script id="daily-template" type="text/template"> <div class="xl-12"> <h2 class="location"><?php echo $daily['name']; ?>, <?php echo $daily['sys']['country']; ?></h2> <img class="flag" /> </div> <div class="xl-2 s-12 m-6 no-padding-top h140 text-center"> <h3 class="description"></h3> <img class="icon" /> </div> <div class="xl-2 s-12 m-6 no-padding-top h140 text-center"> <h5>c...

sql - Delete duplicate rows using Analytical functions -

can delete duplicate rows using analytical functions? mean using row_number() or rank or dense_rank() in sql query in oracle? you can use row_number() on partition of columns should unique you, e.g: row_number() on (partition column1, column2 order column1) . every result has rownumber > 1 duplicate. you can example return rowid's , delete them.

sqlalchemy - type modifier is not allowed for type "geometry" when updating DB with postgis via geoalchemy2 & alembic -

my alembic update script adding new postgis geometry point looks this: from alembic import op import sqlalchemy sa import geoalchemy2 ga def upgrade(): op.add_column('stuff', sa.column('my_location', ga.geometry('point', management=true))) def downgrade(): pass when run script via alembic upgrade head the following error occurs sqlalchemy.exc.programmingerror: (psycopg2.programmingerror) type modifier not allowed type "geometry" line 1: alter table events add column location geometry(point,-1) i using postgres 9.1, postgis 1.5, sqlalchemy 1.0.9, geoalchemy2 0.2.6. you using postgis 1.5, not support type modifier geometry type. how fix issue: postgis 1.5 quite old, upgrade postgis 2.x if same reason cannot upgrade postgis installation, correct way add geometry column using function addgeometrycolumn() . sql statement looks so: select addgeometrycolumn ('public','events','geom',0,'poi...

ios - Animations of SpriteKit overlay on SceneKit stops when SceneKit animations stop -

i guess must have asked before, can't find right in meanwhile here goes. animations of spritekit overlay on scenekit stops when scenekit animations stop. unexpected. it's whole scnview , children goes sleep 3d contents don't move. how can make spritekit scene animate independently of scenekit scene does? update: have confirmed if add simple 3d box rotates indefinitely , keep in view somewhere, 3d scene not "sleep" , neither overlay. there setting somewhere stop scenekit part sleeping? background: use scnview.overlayskscene . have indefinitely repeating animation of 1 of subnodes of overlay. action and/or animation goes on in scenekit scene, overlay 2d stuff animates, stops 3d animations stop. ios 9.2.1. a scenekit view runs update/render loop when knows there's animation going on. (because if there's no change in what's rendered, rendering wastes cpu/gpu time , eats battery power.) scenekit rather conservative in guessing when shou...

security - Is the iOS keychain encrypted without device passcode? -

up till believed ios keychain best way store usernames , passwords. however, came across this site states that: "without passcode, data on device — including sensitive data stored in keychain — can read momentary access device" i have gone through relevant sections in apples documentation on ios security , nothing explicitly states such? is claim true or have misunderstood here? the keychain implemented sqlite database stored on file system. there 1 database; the securityd daemon determines keychain items each process or app can access. keychain access apis result in calls daemon, queries app’s “keychain-access-groups,” “application-identifier,” , “applicationgroup” entitlements. rather limiting access single process, access groups allow keychain items shared between apps. it means hacker can't access ur keychain data there no passcode . it's under control of apple's the securityd daemon . cant access data of keychain wit...

MDL + jQuery validate integration: Work-around needed for mdl-radio__button validation -

what seem normal use-case of jquery.validate mdl has gone awry. see this gist . this works fine: <h1>without mdl</h1> <form id="foo"> <input type="radio" name="bar" value="1" /> 1 <input type="radio" name="bar" value="2" /> 2 <input type="submit" /> </form> <script> $(function() { $('#foo').validate({ rules: { "bar": { required: true }, }, errorplacement: function(error, element) { console.log(element); } }); }); </script> this nothing : <h1>with mdl</h1> <form id="zha"> <label for="baz__1" class="mdl-radio mdl-js-radio"> <input type="radio" name="baz" value="1" id="baz...

java - In android Studio, Can't get Object from Server by ObjectInputStream. -

i'm connecting android app , server in computer using objectinputstream , output stream. used asynctask thread. firstly, server page wrote in eclipse. used serverthread multithread. class server { public server() { serversocket server; try { server = new serversocket(8789); system.out.println("waiting"); while(true){ socket client=server.accept(); system.out.println("connected"); objectinputstream ois=new objectinputstream(client.getinputstream()); objectoutputstream oos=new objectoutputstream(client.getoutputstream()); serverthread thread=new serverthread(ois, oos); new thread(thread).start(); } } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } public static void main(string[] args) { new server(); } } and serverthread.java class serverthread implem...

javascript - Why doesn't console.log work in the JSC environment but it works in Safari's debug console -

when use jsc (javascriptcore) engine provided in system library, acts differently when using safari's debug console $ /system/library/frameworks/javascriptcore.framework/versions/a/resources/jsc >>> console.log("hello"); exception: typeerror: undefined not object (evaluating 'console.log') when console.log("hello"); works fine in safari. tl;dr var console = function () { this.log = function(msg){ debug(msg) }; }; var console = new console(); console.log("hello"); safari creates console object available in debug console, not in jsc environment. see safari's console documentation here adding own console object wraps jsc debug method solved problem: $ /system/library/frameworks/javascriptcore.framework/versions/a/resources/jsc >>> var console = function () { ... this.log = function(msg){ debug(msg) }; ... }; undefined >>> var console = new console(); undefined >>> console.l...

What is the difference between continuous integration, continuous delivery and DevOps? -

i hear these terms , wonder difference? how related continuous builds , continuous deployments? continuous integration / continuous builds getting developers commit code source code repository little , (and latest version repository, further changes based on other developers recent changes). reduces time wasted on merge resolution, it's easier merge in case. the process best automated using build server, can run unit tests. feedback provided developers in case of build / test failure, issues can fixed quickly. continuous deployment involves automated deployment of build artefacts build process onto test , production environments. mitigate risk involved this, people use feature toggles separate release (in controlled way) deployment. continuous delivery less technology , more organisations approach software delivery (although make heavy use of automation). devops larger area emphasises breaking down barriers between developers , operations teams, , getting...

ios - Why do I have to initialize my UIImageView again? -

i have image need change height iphone 6 , taller. have autolayout settings have right smaller sizes. connected uiimageview outlet , when try access imageview's image property in viewdidload i'm accessing null pointer. if go through whole process of creating programmatically have 2 images on top of each other. wondering if there fix this?

Dereferencing int but casting to a float prints nothing in C -

c noob here trying follow along online lectures. in professors example shows can read data stored in int float doing follow *(float*)&i . tried doing following code nothing happens. testing here http://ideone.com/exmxsw #include <stdio.h> int main(void) { // code goes here int i=37; printf("%i", *(float*)&i); return 0; } this causes undefined behaviour : executing *(float *)&i violates strict aliasing rule the wrong format specifier used: %i int , supplied float when code causes undefined behaviour, may happen. lecture advising rubbish lecture unless showing example of not do. incorrect "we can read data stored in int float" method. nb. ideone.com not great testing because suppresses whole lot of compiler error messages, may think code correct when in fact not.

javascript - Nodejs array not working as expected -

this question has answer here: why variable unaltered after modify inside of function? - asynchronous code reference 6 answers i'm trying read in text file , store them in array of lease class. if console.log() inside final loop print loop in current state each iterration. if move console.log outside loop prints empty array. working expected const readline = require('readline'), fs = require('fs'); function lease(renter, unit) { this.unit = unit; this.renter = renter; } var list = []; var rl = readline.createinterface({ input: fs.createreadstream('input.txt'), output: process.stdout, terminal: false }); rl.on('line', function(line) { var values = line.split(' - '); list.push(new lease(values[0], values[1])); console.log(list); }); printing empty array const readline = require('readline'...

ios - Changing root view of view controller ends up with a black view -

what i'm trying achieve view controller can display items in both list form , collection form button can switch on between 2 display options. so i've implemented uiviewcontroller can hold both uitableview , uicollectionview . when view controller loads @ first time, uitableview appears fine. when press switching button (it changes self.view uicollectionview ), ends black view. and when try uitableview pressing switching button (again, changes self.view previous uitableview ), nothing happens. stays black. is there should after changing root view of view controller? it not recommended behavior change view of uiviewcontroller past point in time @ loadview called. you'll want view controller have one, persistent view lifetime. i'd recommend 1 of following. layering table view / collection view on top of view controller's view. way you're not monkeying main underlying view itself. having 2 instances of view controller, 1 table , oth...

ios - UITabBar dissapear when dismiss UIImagePickerController -

Image
in screenshot below, structure of storyboard uitabbarcontroller -> uinavigationcontroller -> uiviewcontroller . in uiviewcontroller , call .camera using uiimagepickercontroller in viewdidload . however, when users hit cancel inside camera, dismiss viewcontroller, , tab bar dissapears! this codes dismiss: func imagepickercontrollerdidcancel(picker: uiimagepickercontroller) { dismissviewcontrolleranimated(true, completion: nil) } edit: added calling of uiimagepickercontroller override func viewdidload() { super.viewdidload() let picker = uiimagepickercontroller() picker.delegate = self picker.sourcetype = .camera presentviewcontroller(picker, animated: true, completion: nil) } try present imagepicker controller 'overcurrentcontext' imagepicker.modalpresentationstyle = uimodalpresentationstyle.overcurrentcontext or set in storyboard in uiviewcontroller, hope can you.

Can not check blank selection field while submitting form using PHP and Javascript -

i have 1 issue while submitting form can not check blank selection field.i explaining code below. addcomplain.php: <form name="billdata" id="billdata" enctype="multipart/form-data" method="post" onsubmit="javascript:return checkform();"> <div class="input-group bmargindiv1 col-md-12"> <span class="input-group-addon ndrftextwidth text-right" style="width:180px"> name :</span> <input type="text" name="u_name" id="name" class="form-control" placeholder="add name" onkeypress="clearfield('name');"> </div> <div class="input-group bmargindiv1 col-md-12"> <span class="input-group-addon ndrftextwidth text-right" style="width:180px">email :</span> <input type="email" name="u_em...

c# - Why does only one column are being updated in my table database? -

i updating myaccount 1 column[password] being updated. below code. please thanks. private string connstr = system.web.configuration.webconfigurationmanager.connectionstrings ["connectionstring"].connectionstring; private sqlconnection conn; private sqlcommand cmd; conn = new sqlconnection(connstr); cmd = new sqlcommand("update adminusers set name=@name, username=@username, address=@address, phone=@phone, email=@email, password=@password adminuserid=@adminuserid", conn); cmd.parameters.addwithvalue("@adminuserid", lbladminmyacctid.text); cmd.parameters.addwithvalue("@name", txtadminmyacctname.text); cmd.parameters.addwithvalue("@username", txtadminmyacctusername.text); cmd.parameters.addwithvalue("@address", txtadminmyacctaddress.text); cmd.parameters.addwithvalue("@phone", txtadminmyacctphone.text); cmd.parameters.addwithvalu...

c# - RouteData.Values["xxx"] generates error inside asp.net user Control -

i trying update asp.net webform based website use routing feature failing fix 1 error inside usercontrol.ascx. i can access query string value in main page using routedata.values["language"].tostring() same fails when need use query string value inside user control. i tried using httpcontext.current.request.requestcontext.routedata.values["language"].tostring(); but no luck. below code sample trying catch querystring int langid = 1; int articleid = 0; int pageid = 0; int issueid = 0; int categoryid = 0; string language = string.empty; if (string.isnullorempty(request["pageid"])) { language = httpcontext.current.request.requestcontext.routedata.values["language"].tostring(); langid = helper.getlanguageid(language); articleid = int.parse(httpcontext.current.request.requestcontext.routedata.values["aid"].tostring()); pageid = int.parse(httpcontext.current.request.requestcontext.routed...

sql - pass 2 parameters and update a table based on the value from 2 tables that are related -

microsoft sql 2008 this 3 tables below related joined b=b , d=d want query 3 tables , update value in table 2 column3=d using declare set column1=a in table1 , declare set column2=f in table3 .once condition met update table 2 column3 value table3 column3 table 1 column1 column2 column3 b c table 2 column1 column2 column3 c b d table 3 column1 column2 column3 e f d update table2 t2 inner join table1 t1 on t1.column2=t2.column2 inner join table3 t3 on t3.column3=t2.column3 set t2.column3=t3.column3 t1.column1='a' , t2.column2='f' like this?

ios - register for actionable notifications in watch app? -

i implementing actionable notifications in watch app..i have defined notification payload not receiving actionable buttons in notifications..according apple documentation action buttons save time user offering standard responses notification. apple watch makes use of interactive notifications registered ios app display action buttons. in ios 8 , later, apps required register types of notification-generated alerts display using uiusernotificationsettings object. when registering information, app can register set of custom notification categories, include actions can performed category. apple watch uses category information add corresponding action buttons long-look interface. i have simple question mandatory register actionable notifications if have defined actions in payload file? you need set usernotification setting , user notification action in code to. go through link

android - how to navigate back to login page after successful register -

@override public void onclick(view v) { if(v == buttonregister){ registeruser(); } } private void registeruser() { ?*some code here*/ } private void register(string name, string email, string password, string phone ) { string urlsuffix = "?name="+name+"&email="+email+"&password="+password+"&phone="+phone; class registeruser extends asynctask<string, void, string> { progressdialog loading; @override protected void onpreexecute() { super.onpreexecute(); loading = progressdialog.show(signupactivity.this, "please wait",null, true, true); } @override protected void onpostexecute(string s) { super.onpostexecute(s); loading.dismiss(); toast.maketext(getapplicationcontext(), s, toast.length_short).show(); } @override protected string ...

A reliable way to logically minify css? -

to minify this: h1 { color: #fff; } you get: h1{color: #fff;} but if had: h1{color: #fff;} h1{color: #fff;} h1{color: #fff;} h1{color: #fff;} minifying wouldn't solve problem. nor this: h1{color: #fff;} div h1{color: #fff;} i tries csscss points out duplicates. other that, wasn't able find reliable way strip out logical redundancies in css. there perhaps tool similar csscss or perhaps php library can kind of logical redundancies? you can use css-purge achieve looking for. npm install css-purge -g // no needed if have installed css-purge -i style.css -o style_purged.css also if have automated build process using grunt , can use grunt-css-purge

SQL Server insert loop of strings -

thank in advance here. i want insert incremental numbers strings load bulk test numbers db, here i'm using: declare @serialcounter bigint set @serialcounter = 0 while @serialcounter < 10 insert [tracktrace].[dbo].[tab_element] ([serial], [batch], [batch_id], [qcsample], [stationid]) values(convert(varchar(60), @serialcounter), 'test', 8989, 0, 1) set @serialcounter = (@serialcounter + 1) but when not increment counter , insert duplicate numbers , not stop. think problem variable incremented outside of while loop, not sure how rectify this. declare @serialcounter bigint set @serialcounter = 0 while @serialcounter < 10 begin print @serialcounter --insert [tracktrace].[dbo].[tab_element] --([serial] --,[batch] --,[batch_id] --,[qcsample] --,[stationid]) --values(convert(varchar(60),@serialcounter),'test',8989,0,1) set @serialcounter = (@serialcounter +1 ) end you not givin...

mariadb - What is plugins and how it is work in mysql? -

i explore partition in mysql official site ( https://dev.mysql.com/doc/refman/5.1/en/partitioning.html ). in first page, found plugins . mysql> show plugins; +----------------------------+----------+--------------------+---------+---------+ | name | status | type | library | license | +----------------------------+----------+--------------------+---------+---------+ | binlog | active | storage engine | null | gpl | | mysql_native_password | active | authentication | null | gpl | | mysql_old_password | active | authentication | null | gpl | | sha256_password | active | authentication | null | gpl | | myisam | active | storage engine | null | gpl | | mrg_myisam | active | storage engine | null | gpl | | memory | active | storage engine | null | gpl | | ...

html - View local PDF File in ChildBrowser? -

i have downloaded pdf file phonegap localfilesystem , trying view in childbrowser. have done this; function viewoffline() { var files = pathtoroot + "/holidays.pdf"; window.plugins.childbrowser.showwebpage(files); } when run app childbrowser opens can't read file. there .showfile thing can use? i'm new childbrowser appreciated thanks lot i did quick check , found out cannot open pdf files suing child browser. need use pdfviewer plugin . plugin used display local pdf. when display pdf external url, should use inappbrowser or childbrowser

android - How to use findstr to get MAC address? -

i send adb shell dumpsys wifi current available wifi ap bssid(mac address).the result follows: latest scan results: bssid frequency rssi age ssid flags 7c:7d:3d:c3:4c:e0 2422 -40 6.716 huawei-yjdad5 [wpa2-psk-ccmp][ess] d4:ee:07:26:24:18 2432 -50 6.716 hiwifi_refine [wpa-psk-ccmp][wpa2-psk-ccmp][ess] 24:09:95:55:54:20 2442 -52 6.716 huawei-5420 [wpa2-psk-ccmp][wps][ess] 70:72:3c:97:52:b8 2437 -53 6.716 huawei-h6fcxt [wpa-psk-ccmp+tkip][wpa2-psk-ccmp+tkip][wps][ess] 0c:d6:bd:3d:f6:14 2417 -52 6.716 huawei-dus8fg [wpa-psk-ccmp+tkip][wpa2-psk-ccmp+tkip][wps][ess] f0:b4:29:20:21:1b 2442 -54 6.716 xiaomi_211a11 [wpa-psk-ccmp+tkip][wpa2-psk-ccmp+tkip][wps][ess] 80:38:bc:05:ed:a1 2412 -58 ...

vb.net - Load all my.settings to textboxes in Visual Basic -

i trying load saved my.settings textboxes unable retrieve saved values. here code dim ctrl control each ctrl in me.controls if (ctrl.gettype() gettype(textbox)) dim txt textbox = ctype(ctrl, textbox) integer = 1 20 txt.text = my.settings("fp" & i) next end if next what proper way it?thanks generally when reference value stored in settings along lines of ; my.settings.<name of setting> my.settings has item property takes settings propertyname (as string ) parameter allowing either set or relevant value. so start try following; dim ctrl control each ctrl in me.controls if (ctrl.gettype() gettype(textbox)) dim txt textbox = ctype(ctrl, textbox) integer = 1 20 txt.text = my.settings.item("fp" & i.tostring) next end if next

sql server - Trailing spaces allowed in foreign keys -

issue: sql server allows trailing spaces added foreign key! this behaviour of course leads various unwanted behaviour in application. how can stopped? example: 2 tables in 1:n relationship: create table products ( pid nvarchar(20) primary key ;) create table sales ( pid nvarchar(20) references products(pid), units int ); now insert primary key 'a' : insert products (pid) values ('a'); now insert foreign keys: -- 'a' accepted, expected: insert sales (pid, units) values ('a', 23); -- 'b' declined, expected: insert sales (pid, units) values ('b', 12); -- 'a ' (with trailing space) -- accepted, of course not expected !! insert sales (pid, units) values ('a ', 12); a second issue hard detect since : select pid sales group pid returns 1 value: in example here trick detect issue: select pid sales group binary(pid) this returns 2 rows: , (with trailing space) ch...

ruby on rails - How could I test customized object under lib folder -

let's have custom object put @ /lib folder i want test it's functionality under rspec, how ? how create test function ? should go ? thanks first of all, lib path added in autoload path. if not, add config.autoload_paths << rails.root.join('lib') you have spec directory /spec . create lib directory /spec/lib , create {lib_test_name}_spec.rb and write code same other spec.

spring - Mock OAuth server for testing -

i'd know if possible simulate oauth(1,2) authentication flow. i'd test without need connect provider itself. should possible communication exchange. i'm not looking this still communicate remote server. i'd offline, when testing. maybe can run own oauth server. should using google oauth services server should behave same do. google provide code oauth server, or possible create fake server. note test should more integration test. command server return predefined responses. switching live oauth providers changing remote url. maybe http server ok, need care proper format of communicated messages. take @ client side rest tests section of spring reference docs. support can fake server , record desired behaviour mockrestserviceserver . here examples created.

ios - How to define a global struct? -

i want struct should in controller or in class ... anyone have idea ? code : typedef struct student{ __unsafe_unretained nsstring *name; __unsafe_unretained nsstring *lastname; __unsafe_unretained nsstring *firstname; }student; to make struct visible everywhere in project, import header file defined structure your_project_name_prefix.pch

angularjs - ionic paypal error Can't find PayPalConfiguration -

refer ionic-paypal integration , added script services.js factory , run in real device. and add js index.html <script src="lib/ionic/js/ionic.bundle.js"></script> <script src="lib/ionic/js/angular/angular-resource.min.js"></script> <script src="cordova.js"></script> <script src="lib/external/js/lodash.js"></script> <script src="js/paypal-mobile-js-helper.js"></script> <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/controllers.js"></script> once trigger function: paypalservice.initpaymentui().then(function () { paypalservice.makepayment($scope.total(), "total").then(...) }); i receive following error error: can't find variable: paypalconfiguration configuration@http://{ip}:8100/js/services.js:147:49 http://{ip}:8100/js/services.js:155:83 p...

java - TableView column data set to 2 decimal places -

i have 1 class file nepokretnost.java in constructor this: public nepokretnost(string tipnepokretnosti, string zona, string pravo, double povrsina, int amortizacija, double osnovica, double kredit, double porez) { this.tipnepokretnosti = tipnepokretnosti; this.zona = zona; this.pravo = pravo; this.povrsina = povrsina; this.amortizacija = amortizacija; this.osnovica = osnovica; this.kredit = kredit; this.porez = porez; } further, have tableview column each of class fields. problem double field "povrsina". want set textfield. i sent contents of textfield named txtpovrsina double variable: double dpovrsina; dpovrsina = double.parsedouble(txtpovrsina.gettext()); then put fields in tableview: observablelist<nepokretnost> data = tbltabela.getitems(); data.add(new nepokretnost(cbonepokretnost.getvalue().tostring(),cbozona.getvalue().tostring(), txtpravo,dpovrsina,40,450000.25,2500.00,2500.00)); all wor...

c# - Determine Local Uri (Assembly.GetEntryAssembly() returns null) -

i have project-folder called testa, folder in called testb , in 1 folder name testc. in testc image (image.png) , want know how uri. i need call function , give uri function i tried many things like: class.function(new uri("pack://application:,,,/testb/testc/image.png")); but exception: assembly.getentryassembly() returns null. i pretty sure, part isn´t correct: "pack://application:,,,/testb/testc/image.png" thanks suggestions :)

ios - UIAlertController of style ActionSheet shows below status bar -

Image
i want show alert controller of style action sheet display list of states in country , works fine. but weird reason shows action sheet below status bar partially not acceptable looks bad, how ever can remove status bar when displaying action sheet should work. so wondering there other way make action sheet stop particular offset top. tried presenting action sheet navigation controller nothing changed. any comments appreciated. thanks, robin. try this: var height:nslayoutconstraint = nslayoutconstraint(item: alertcontroller.view, attribute: nslayoutattribute.height, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 300) alertcontroller.view.addconstraint(height); set height 300 . look, changes?

c - When I malloc more space for a string within an array of strings, the array of strings duplicates some strings -

i have array of strings, , trying malloc more space 1 of strings can change value of string. int catenate_strings (char** arr, int index1, int index2) { char *new_string; new_string = malloc(1000*sizeof(char)); if (new_string == null) { printf("\nerror allocating memory\n"); } strcpy(new_string, arr[index1]); strcat(new_string, arr[index2]); arr[index1] = new_string; } however when run code, work instances, in others duplicate string @ index1 , put @ index1 + 1 well. your code has problems: memory leak in arr[index1] = new_string because not freeing old buffer. buffer overflow if result string longer 1000 bytes. not returning value catenate_strings despite function having return value int. if entries in arr allocated using malloc can use realloc . int catenate_strings (char** arr, int index1, int index2) { // resize buffer hold old string + new string (+ terminating null byte!) char * const new_s...

jquery - set checkbox disabled or readonly when its checked -

is possible set readonly or disabled attribute when user checked checkbox ? <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <div class="checkbox"> <label> <input type="checkbox" name="checkbox" id="checkbox"> remember me </label> </div> </div> update : i tried this: $(document).ready(function() { $("input:checkbox[name='checkbox']").change(function() { this.prop('readonly', true); }); }); demo try way. have said in comment once disabled checkbox there no way can enable again maybe need change approach in doing this. use selector id , use prop disabled disabled checkbox not readonly $(document).ready(function() { $("#checkbox").change(function() { if ($(this).is(':checked')) {//check if checkbox checke...

shell - How do I truncate all data in my MySQL database? -

i'm using mysql 5.5 on mac 10.7.5. shell (i'm using bash), i'd able run command o truncate data in tables. also, i'd enter single command won't prompt me password. i've tried this, found on post, no dice. shell command can use truncate database table data? mysql -umyuser -p -e 'set foreign_key_checks = 0; show tables' my_db | while read table; mysql -e -umyuser -p "truncate table $table" my_db; done enter password: mysql ver 14.14 distrib 5.5.25, osx10.6 (i386) using readline 5.1 copyright (c) 2000, 2011, oracle and/or affiliates. rights reserved. oracle registered trademark of oracle corporation and/or affiliates. other names may trademarks of respective owners. usage: mysql [options] [database] -?, --help display , exit. -i, --help synonym -? --auto-rehash enable automatic rehashing. 1 doesn't need use 'rehash' table , field completion, startup , reconnec...

batch file - How do I call concat : %variable% when the variable has internal spaces? -

i trying concat variables in class path using following command, isn't working when folder name contains spaces: call concat : %variable% where %variable% ={folder name containing space} i tried putting quotes: call concat : "%variable%" but adds 2 double-quotes in classpath follows: ""folder name containing space"" :concat set classpath=%classpath%;"%1" do not use additional double quotes strings spaces. parameter %~ removes pairs of double quotes around string: @echo off &setlocal set "variable="my var"" echo variable: %variable% call :concat %variable% goto :eof :concat echo concat %%1: %1 set "newvar=%~1" echo concat newvar: %newvar% goto :eof endlocal output is: variable: "my var" concat %1: "my var" concat newvar: var if put additional double quotes around string, following happen: @echo off &setlocal set "variable=...

jquery - add row to table on entering a value in last table cell -

i want add new row table when enter data last table cell. i have seen fiddle on how link. want alter additional row added onchange in last td. so, using jquery 1.7, code is: <table class="authors-list"> <tr><td>author's first name</td><td>author's last name</td></tr> <tr><td><input type="text" name="first_name" /></td><td><input type="text" name="last_name" /></td></tr> </table> <a href="#" title="" class="add-author">add author</a> <script type="text/javascript"> var counter = 1; jquery('a.add-author').click(function(event){ event.preventdefault(); counter++; var newrow = jquery('<tr><td><input type="text" name="first_name' + counter + '"/></td><td><input type="tex...

c# - Request Error IIS Method call -

Image
i hosting wcf service in iis, , encountered error shown below: request error the server encountered error processing request. please see service page constructing valid requests service. exception message 'login failed user 'iis apppool\test'.'. see server logs more details i call method link: http://192.168.1.111/truckservice.svc/getallcompa browser can access truckservice.svc file, methods throws error. the methods shown service help link: http://192.168.1.111/truckservice.svc/help don't know if make difference? there isn't lot of info work with, did google error cannot seem find similar issue. any ideas? this part of error message tells quite bit, actually: "the exception message 'login failed user 'iis apppool\test'.'" you didn't give whole lot of information in question, i'm willing bet service using sql database ( login failed user common sql error). assuming connection s...

Python Tkinter Quiz score system -

i making quiz in python (using tkinter). stuck on score system have made variable called 'score' when try add + 1 score gets error. have tried define before procedure still doesn't work. import tkinter tk window = tk.tk() window.title("6 questions") window.geometry("500x150") def inst(): t = tk.label(window, text="all need answer each question either '1, 2, 3' or actual word.") t.pack() def start(): score = 0 q1 = tk.tk() q1.title("question 1") q = tk.label(q1, text="what type of input holds whole numbers?") q.pack() = tk.label(q1, text="1.) int") a.pack() b = tk.label(q1, text="2.) string") b.pack() c = tk.label(q1, text="3.) float") c.pack() ans = tk.entry(q1, width=40) ans.pack() def qu1(): deranswer = ans.get() if deranswer == "1" or deranswer == "int": crr = tk.label...

serialization - Converting to correctly formatted JSON -

i've been tasked calling api, needs take json payload request.. example format of json follows: { "method":"methodname", "in":[ { "account":"acme", "context":"abc123" }, "content", { "msearchtext":"chocolate", "mitemdataids":[ "entry:id", "entry:entryref", "entry:categoryid" ] } ] } i using json.net (newstonsoft) construct json .net objects. issue facing correctly constructing "in" section.. appears array of objects, second item has title ( "content",{.....} ).. the closest can is: { "method": "methodname", "in":[ { "account": "pando", "context": "sdfsd22342" }, { "msearchtext...

Logging during calling state in Android -

everyboday. trying log information such phonenumber, calling time , on during calling state in android. tried build codes following below: package com.test.dialuplog; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.telephony.phonestatelistener; import android.telephony.telephonymanager; import android.util.log; import android.widget.toast; public class incomingbroadcastreceiver extends broadcastreceiver { string mphonenumber; public static incomingbroadcastreceiver pthis; @override public void onreceive(context context, intent intent) { telephonymanager telephonymanager = (telephonymanager) context.getsystemservice(context.telephony_service); telephonymanager.listen(new customphonestatelistener(context), phonestatelistener.listen_call_state); } public class customphonestatelistener extends phonestatelistener { //private static final...

is it possible to make real time progress/percentage bar in jquery -

below code simple jquery progress bar. there way update progress value (that 67 rite now)dynamically on ajaxstart , reach value 100 on ajaxstop()? <head><script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script>$(function() { $( "#progressbar" ).progressbar({ **value: 67** }); }); </script> </head> <body> <div id="progressbar"></div> </body> if targetting html5 browsers only, try whats decribed here: jquery ajax progress in html5 the traditional way go show spinning gif, instead of loader. ajax request wont long in of cases & hence effort in trying same lost. however not uncommon progress bar shown. problem ...

jquery - Understanding curtain.js -

i've been trying understand how use jquery plugin curtain.js ( https://github.com/victa/curtain.js ). i've tried follow instructions, must doing wrong because can't work. maybe problem else, jquery wrote is: $(function () { $('.curtains').curtain({ scrollspeed: 400 }); }); i've made fiddle can see code have now. fiddle here: http://jsfiddle.net/nvggw/1/ any welcome. thank you! i think doing ok, doesnt work latest version of jquery, works ok jquery 1.7.2, i've changed fiddle , included copy of plugin in js window: http://jsfiddle.net/jamesking/nvggw/3/ <ol class="curtains"> <li id="one" class="sectionone"> <h1>section one</h1> </li><!-- end #sectionone --> <li id="two" class="sectiontwo"> <h1>section two</h1> </li><!-- end #sectiontwo --> <li id="three" class="sectionthree...

symfony - Query Exception when select on entity where ForeignKey is NULL in a ManyToMany Doctrine queryBuilder() -

in symfony project, have 2 entites product.php , configuration.php . it's manytomany relation. this relation in product.php : /** * @var \doctrine\common\collections\collection * * @orm\manytomany(targetentity="configuration", inversedby="products") * @orm\jointable(name="product_configuration", * joincolumns={@orm\joincolumn(name="product_id", referencedcolumnname="product_id", nullable=true)}, * inversejoincolumns={@orm\joincolumn(name="configuration_id", referencedcolumnname="configuration_id")} * ) **/ protected $configurations; and configuration.php : /** * describes products using $this configuration * * @var \doctrine\common\collections\collection * * @orm\manytomany(targetentity="product", mappedby="configurations") **/ protected $products; in page, need recover products wich do not have configurations , e-g fk configurations null . so crea...