Posts

Showing posts from February, 2014

ios - Sign-In Required Popup in-App purchase issue? -

Image
i integrate in-app purchase in app, working fine purchase , restoring items. 1 issue there, when purchase item using test1@gmail.com , purchase item restore working fine. now, uninstalled apps device, clear credential itunes & app store. , again installed. when click on restore button, there 2 popup display : 1 test1@gmail.com , , second 1 exiting or create user . when ever comes background foreground, sign-in popup display every time. note : have call finishtransaction method. not work me. no 1 method called when sign-in popup display. please me. thanks. this happens sometime in sandbox environment not always. once app live , in app purchases approved apple, work fine automatically. however, in-app purchase code flow should correct. ios automatically ask login options if have not logged in yet, otherwise show popup entering password , username/email auto filled.

javascript - How to watch whole array of objects? -

this question has answer here: angularjs watch array of objects data change 3 answers i have array of ten objects. each 1 of them contains 6 properties , display on view. user able change properties typing new data on inputs. how can watch whole array , identify property on object has been changed , don't repeat code 10 times in order watch each object separately? you can use $watchcollection $scope.$watchcollection('data', function (newval, oldval) { /*...*/ });

javascript - How to Handle Infinite hits to your public url -

i developing web application using webapi , angularjs . application public classified web site lot of urls public. question : if writes simple infinite loop , starts hitting server like: <script type="text/javascript"> $(function () { while (true) { $.get("https://mypublicurl", function (data) { }); }; }); </script> it make expensive server serve unnecessary requests no reason. best practices avoid such situation? there services can use mitigate dos attacks, 1 of known , easy start cloudflare: https://www.cloudflare.com/ddos/ the basic tier free , affords protection, can try out , see if suits you. there things can mitigate simple attacks such 1 in example, more complicated attacks (ddos etc) need handled outside.

html - Moving image in Javascript -

i have image , want when click on it, image moves according mouse , when release mouse image stays in position. can guide me on how in javascript? looking this? $(document).mousemove(function(e) { $('.logo').offset({ left: e.pagex, top: e.pagey + 20 }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <img class="logo" src="//ssl.gstatic.com/images/logos/google_logo_41.png" alt="google">

windows - Console build with post-build events in Visual Studio -

i'm using cmake. cmake "install" instruction: install(targets mainproject runtime destination "${project_source_dir}/install/bin" archive destination "${project_source_dir}/install/lib" library destination "${project_source_dir}/install/bin" ) in windows cmake creates project "install", relates project "build_all", relates real projects listed in cmakelists.txt files. project "install" have post-build event, performs "install" actions. but when run devenv install.vcxproj /rebuild "release|x64" , post-build event not performed. does there exists way perform post-build events of visual studio console? (i need console, because build have run scripts) turning comment answer you can use cmake's --build command line option (which abstract make / msbuild / ninja ... calls) like: cmake --build . --target install --config release

opennlp - open nlp training named entity -

i training model named entity recognition not identifying names of person? my training data looks like: <start:person> pierre vinken <end> , 61 years old , join board nonexecutive director nov. 29 . nonexecutive director has many similar responsibilities executive director.however, there no voting rights position.` mr . <start:person> vinken <end> chairman of elsevier n.v., dutch publishing group. former chairman of society <start:person> rudolph agnew <end> assisting <start:person> vinken <end> in activities. mr . <start:person> vinken <end> right person in industry. competitior <start:person> steve <end> vice chairman of himbeldon n.v., ericson publishing group. <start:person> vinken <end> assisted <start:person> angelina tucci <end> has been recognized many times work. <start:person> juilie <end> vp of weterwood a.b., zs publishing group supported him. mr . <

mysql - Bulk native SQL inserts from Hibernate -

i need perform batch operation inserts 10000 rows in empty mysql table. these rows come file values each column, this: (col1,col2,col3) values ('sample','es_es','other value') (col1,col2,col3) values ('john','en_us','other value') (col1,col2,col3) values ('james','es_es','other value') ... so know table have put values in, , need fast possible. first have tested doing one-by-one (calling sqlinsertraw in loop), , takes 20 seconds: @transactional(propagation = propagation.requires_new) @override public void sqlinsertraw(string tabla, string valores) { getentitymanager().createnativequery("insert " + tabla + " " + valores).executeupdate(); getentitymanager().flush(); } and secondly tested not commiting each insert, execute each query , after call .flush. takes 7 seconds: @transactional(propagation = propagation.requires_new) @override public void sqlinsertraw(string tabla, l

c# - How to change selected item of listbox when clicking on the Button / textbox in ItemTemplate -

in wpf project have listbox itemssource bound set of items. use datatemplate in itemtemplate of listbox represent ui of these items. what want happen when user clicks any part of datatemplate bound item listbox.selecteditem set item datatemplate is. selected style applied. can see sample code below, clicking on label fine. however, controls such button , textbox not behave wanted , there no doubt others too. suspect it's got focus? can how might achieve please? many in advance help. xaml: <window x:class="listviewselectionoverride.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:listviewselectionoverride" mc:ignorable="d"

performance - rails runner background aws sqs processor memory leakage issue -

in rails application, have created background job file process aws sqs messages lib/events/some_processor.rb sqs = aws::sqs.new q = sqs.queues.create queue_name loop q.receive_message |msg| json_attrs = json.parse(msg.body) event = event.find(json_attrs["id"].to_i) event.process_logic(json_attrs["params"]) |status| rails.logger.info(status) msg.visibility_timeout = 30.minutes end end .. $> rails runner lib/events/some_processor.rb events queue processor running infinite loop in aws instances in production environment memory of slow increasing , instance terminated when reaches high. i tried in machine running couple of hours memory increased when messages in queue , memory reduce if no messages process. how identify memory leaks , db connections when in process in development environment.

c - Setting/clearing LSB of an audio sample -

i'm wondering if me out setting/clearing lsb of audio sample the code below goes through array of 24 elements , each element added file new line follows. file *fp; fp = fopen(embedfile, "w"); (int = 0; < 24; i++){ fprintf(fp, "%d\n", bits[i]); } fclose(fp); when open file has been written way want them to. what i'm trying is, read line , compare value, if it's 0 clear lsb of audio sample, else set 1, code below: file *embedfile = fopen(embedfile, "r"); int line = 0; char input[12]; char *zero = "0"; char *one = "1"; while (fgets(input, 12, embedfile)) { //duplicates key sample prior lsb modification outputframes[frame] = inputframes[frame]; //sets lsb of audio sample match current line being read text file. if (strcmp(input, zero) == 0) { //clear lsb outputframes[frame] &= ~1; printf("%u bit inserted\n", outputframe

python - Win10 and scipy : unsupported wheel -

i've been struggling past 2 days scipy. i'm installing @ work on fresh new windows 10 build (yeah know...). python 64 installed, running smoothly can"t find way install scipy. i've downloaded wheels here , i've tried scipy-0.19.0-cp36-cp36m-win32.whl , scipy-0.19.0-cp36-cp36m-win_amd64.whl comes same error (tried pip3 , pip): $ pip3 install scipy-0.19.0-cp36-cp36m-win_amd64.whl scipy-0.19.0-cp36-cp36m-win_amd64.whl not supported wheel on platform. any idea? i've tried pip updates, python updates , nothing seems work. thank help! ensure compatibility between python version , wheel file. wheel file, denoted cpxx. example, cp35 python3.5

php - Between date in Mysql not working properly -

i want filter items based on 2 different dates using mysql. in database store data 2017-03-28 10:55:10 . need date part, not time used date() function: select sum(cashamount) sumcashsalesamount, date(transactiondate) datepart master_transaction transactiondate between '2017-02-22%' , '2017-03-28%' order transactiondate desc above query have 2 dates 2017-02-22% , 2017-03-28% return no result. but when change 2017-03-28% date 2017-03-29% (tomorrow date) results. don't use between "dates". put in quotes, because values datetime values. the best way write condition is: where transactiondate >= '2017-02-22' , transactiondate < '2017-03-29' note inequality second condition. between inclusive, include midnight on 2017-03-28. why best? it allows query optimizer take advantage of indexes , partitions. it logic want. it works both date , datetime types.

python - RethinkDB - how to filter arrays in nested objects when updating? -

with rethinkdb, how update arrays in nested objects values filtered out? consider following program, know how write update query filters out value 2 arrays contained in votes sub objects in documents 'dinners' table: import rethinkdb r pprint import pprint r.connect(db='mydb') conn: pprint(r.table('dinners').get('xxx').run(conn)) r.table('dinners').insert({ 'id': 'xxx', 'votes': { '1': [1, 2, ], }, }, conflict='replace').run(conn) # how can update 'xxx' document value 2 # filtered out arrays contained in 'votes' sub object? you can use usual filter method object coersion: def update_dinner(dinner): return { 'votes': dinner['votes'] .keys() .map(lambda key: [ key, dinner['votes'][key].filter(lambda vote_val: vote_val.ne(2)), ]) .coer

ios - import XXNibBridge into my project, but semantic issue occurs saying [unknown type name 'link'] after running this project -

Image
xxnibbridge imported pch file of project run project, semantic issue occurs, saying [unknown type name 'link'] is there can do? don't use link (i don't know trying there) , instead use #import (or #include ). if you'd know more pch files (or if should use them -- don't have to, more not), there related questions here on stackoverflow can more information. like: what prefix.pch file in xcode? why isn't projectname-prefix.pch created automatically in xcode 6? why .pch file not available in swift?

Immutable custom PHP array containing objects of a certain type -

firstly want create sort of array allows addition of type of object; myobject . secondly want array immutable, value object array. want add myobjects on creation, access them using foreach or using offsets $myarray[0] don't want items added, removed or sorted - or items changed. so have looked arrayobject , arrayiterator , arrayaccess . can tell, these allow object act array. i'm pretty sure that's not want since php array functionality not class can extend, im not sure path take. my current implementation dumbed down class. cannot used in foreach or using array offsets $myarray[0] without calling getarray function first. foreach ($myarray->getarray() $myobjecy) { it's best can think of there must better way of doing this? mycustomarray { protected $array = []; public __construct(array $array) { foreach($array $obj) { if (! $obj instanceof \myobject) { throw new \exception(); }

php - Mysqli statement execute error : Prepared statement needs to be re-prepared -

while execution of php script, error description as, mysqli statement execute error : prepared statement needs re-prepared..... the function performs mysql execution ( insert / update statement) zend function _saverow. observed data been inserted in database , function still returning execution error. any appreciated. here know background of issue abhijit explaining, getting stack trace of error follows : mar 28 02:16:15 qweb004 reachlocal zend platform[27766]: 2017-03-28t02:16:15-07:00 err: web-tier error 10.10.0.6: not save database row mysqli statement execute error : prepared statement needs re-prepared #0 /sl/product/plat/releases/plat/wbussys-xyz-1516_1/web/zf_platform/library/application/model/op/creative.php(3973): application_model_abstract->_saverow(object(zend_db_table_row)) here _saverow saving row perfectly, somehow generating mysql error "could not save database row mysqli statement execute error : prepared statement needs re-prepared&qu

spring - JSR-250 lifecycle annotations: Annotation Type PreDestroy -

is method @predestroy of prototype bean called when bean garbage collected ? no, not called when bean garbage collected bean garbage collected has dereferenced first, mean have destroyed , @predestroy called. so method won't called directly has have been called before being garbage collected

matlab - Human Detection -

i want detect people in picture , want implement without matlab's vision.peopledetector have classifier , can detect people detects many people.i know have use selectstrongestbbox function , matlab r2014a , doesn't have function. found code , implemented problem there function in called : visionbboxoverlapsuppression there no source code function , doesn't work. have source code of visionbboxoverlapsuppression function ? in advance

Python: import selected rows of dataframe. My data is in xlsx format -

hi beginner @ machine learning in python environment , want import first 30-40 rows of dataframe has 30.000 rows development.thank you can use pandas.read_csv 'nrows' parameter, this: pd.read_csv(myfilepath, nrows=30) nrows : int, default none number of rows of file read. useful reading pieces of large files full documentation can found here if want after read file: dataframe.head(n=30)

mysql - How to check if a table exists using python? -

i want check whether table exists or not before inserting data. have tried: def checktables(tablename): stmt = "show tables %s"%tablename cursor.execute(stmt) result = cursor.fetchone() return result but gives me error saying: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'ctg_payload3' @ line 1 maybe not best way. as opinion, show tables; , search result. and, cannot execute show tables tablename; , no syntax that. edit 1 if must in sql, use show table status 'table_name'; ' needed sql.

reporting services - SSRS map Modified stocks management view -

i wonder if there way can create own shp file show pallet racking , can put default values on , rack 1-100 lengths , 1.1 high. , can connect database to. map city have id. id values if rack. i can't find program this, program can maps.

MongoDB insert \u0000 after each character in string field? -

i started mongodb , facing issue when saving xml in string field. add '\u0000' each character in xml file. "\u0000?\u0000x\u0000m\u0000l\u0000 \u0000v\u0000e\u0000r\u0000s\u0000i\u0000o\u0000n i need save xml without json 0r bson conversion in string field. till time, found query xml in correct format. db.test.find({"data":"xyz"}).foreach(function(doc){ var xml = doc.data.replace(/\u0000/g,""); print(xml); })

How to check one json array value is present or not in another array using PHP -

i need 1 help. need verify weather 1 json array value present inside array or not using php. explaining code below. $img=array( array("iamge"=>"1234_asd.jpg"), array("iamge"=>"1235_ase.jpg"), array("iamge"=>"1236_asf.jpg") ); $imgarr=array( array("iamgename"=>"1234_asd.jpg"), array("iamgename"=>"1235_ase.jpg"), array("iamgename"=>"1236_asf.jpg"), array("iamgename"=>"1237_asg.jpg") ); here have 2 array. need check of value $imgarr array present inside $img array or not.in case value not present return false image name , if present return omlu true . please me. function bjsearch($img, $seachimg){ $result = true; if(!in_array($seachimg, $img)){ $result = false; } return $result; } $found = true; $image_name = ''; foreach($imgarr $k=>$im){ $sea

wordpress - How make single page for WP_List_Table edit? -

how can create admin page, edit single item custom table wp_list_table ? data: custom db table, on admin have add menu item method build table through wp_list_table . there want create 'manage' button, manage single item table. how can this? is there action hook or have add second class or menu item i have try add menu item, how can add without adding menu? add_submenu_page parent slug = null clear wp solution? for situation solution: if ( array_key_exists( 'single', $_request ) ) { //function process single item } else { //create instance of our package class... $withdraw = new class_table(); //fetch, prepare, sort, , filter our data... $withdraw->prepare_items(); }

REGEX replace leading spaces and tabs to html code in encoded xml per line, in Java -

i replace leading spaces , tabs, in encoded xml/html, per line html-codes. replace groups of 4 spaces or every tabulator through tabulator (#09;) replace rest of spaces through space ( ) replaces may/must on start of each line, until first non-space or tab character example begin of line: (^|(\\r|\\n)+) => (\\r|\\n)+ multiple linebrakes can wrapped replacmentment chars: [ ], [\t] 21 whitespaces = 5 x #09; + 1 x &nbsp; 10 whitespace + 1 tab + 6 whitespaces = 2x #09; + 2x &nbsp; + 1x #09; + 1x #09; + 2x &nbsp; :: 10 spaces = 2 x #09 + 2x &nbsp :: 1 tab = 1x #09 :: 6 spaces = 1 x #09 + 2x &nbsp input string, , replaces other regular expressions text = text.replace(regex1, replacement1) text = text.replace(regex2, replacement2) text = text.replace(regex3, replacement3) text = text.replace(regex4, replacement4) at position must implement new regular expression visual xml <test> <node1> <value> test</val

android - className and packageName of apps in emulator -

i trying classname , packagename of apps in emulator.iam not getting output .please let me know right way. list<applicationinfo>applicationinfos=getpackagemanager().getinstalledapplications(0); for(applicationinfo applicationinfo:applicationinfos) { string cn=applicationinfo.classname==null?"not able class name":applicationinfo.classname; string pk=applicationinfo.packagename==null?"not able package name":applicationinfo.classname; log.e("tag", " " + cn+"---"+pk); } list<applicationinfo> applicationinfos=getpackagemanager().getinstalledapplications(0); for(applicationinfo applicationinfo:applicationinfos) { string cn=applicationinfo.classname; string pk=applicationinfo.packagename; log.i("tag", " " + cn+"---"+pk); }

unity3d - Build size is much larger than what's logged in editor.log -

Image
to knowledge "complete size" value in editor log should total size of build. can see screenshot below, editor.log saying "completed size" 27.7mb, while build size in file system 145mb. missing here, or doing wrong? in advance! editor.log screenshot: screenshot of size in file system: see links, build options can make different size outputs. such arm, fat , etc.. etc.. "resources", "streaming assets" directory not included in editor.log file. check project directories, if have, output size bigger description of editor.log file.

performance - MS SQL Server Actual CPU Cost per physical operation -

i have query executing on microsoft sql server. here query , execution plan: https://www.brentozar.com/pastetheplan/?id=bjurhrwng the query extremely slow: table 'worktable'. scan count 30, logical reads 184041, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. table 'siteversions'. scan count 1, logical reads 363, physical reads 0, read-ahead reads 351, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. table '#bb50937f'. scan count 1, logical reads 5979, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. table 'allwebs'. scan count 11, logical reads 3041, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. table 'allsites'. scan count 1, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. (1

opl - cplex: define custom mathematical function -

Image
i want define custom function f in implementation of optimisation model in cplex, mathematical functions not available. want use customised function f make relation between 2 of model variables decisions. here in how defined f(x) (it cdf of normal distribution): thank detail! you won't able directly. cplex allow linear , small subset of non-linear relations such quadratic or second-order cone functions. may able approximate function piecewise linear function.

unity3d - How to use fisheye camera in unity in Google Tango? -

i use google tango's fisheye camera take picture of environment analyse on it. however, how can achieve in unity environment? should continue tango ar camera? thank you. this not support directly unity sdk, can use fisheye image c or java.

wpf - Make ObservableCollection item invisible -

this model : observablecollection<student> studentslist; class student { static observablecollection<student> students; string sname; string fname; } and have simple combobox : <combobox x:name="cbstudents" itemssource="{binding studentslist}"> i case want hide combobox item/items, possible without using function remove students observablecollection ? edit: after try mm8 solution seems combo box style cause error style: <!-- region combobox style --> <solidcolorbrush x:key="comboboxnormalborderbrush" color="transparent" /> <solidcolorbrush x:key="comboboxnormalbackgroundbrush" color="#ff103766" /> <solidcolorbrush x:key="comboboxdisabledforegroundbrush" color="#888" /> <solidcolorbrush x:key="comboboxdisabledbackgroundbrush" color="#ff7aa0cd" /> <solidcol

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback ca

javascript - select and remove multiple images with preview before upload -

i'm looking plugin allows adding multiple images, previewing, removing , submitting fields without ajax. i have found plugins fineuploader , dropzone submit ajax. these plugins haven't figured out how submit without ajax. you can use dropzonejs they have list of configurable options can find here. dropzone js usage. if still need more customization have add own code it. hope helps writing thousand lines of code. without ajax requests: this may you. click here!

javascript - Creating a WebSocket Client for Mocha tests within a Sails.js app? -

i'm trying use socket.io-client in mocha tests of sails js app calls below. .get/.post not invoked , test case times out. var io = require('socket.io-client'); io.sails.url = sails.getbaseurl(); // doesn't work io.socket.get('/hello', function serverresponded (body, jwr) { console.log('sails responded with: ', body); console.log('with headers: ', jwr.headers); console.log('and status code: ', jwr.statuscode); io.socket.disconnect(); }); it looks you're confusing socket.io-client , low-level socket.io client library, sails.io.js , sails.js utility communicating sails app on sockets. take @ sails.io.js readme instructions on how use sails socket client node: var socketioclient = require('socket.io-client'); var sailsioclient = require('sails.io.js'); // instantiate socket client (`io`) // (for now, must explicitly pass in socket.io client when using library node.js) var io = sailsioclient(s

vue.js - Vee validate - Custom Error Message? -

when vee validate picks invalid field outputs error using fields name, eg. the address_line_1 field required. is possible use fields label or other attribute in error message field names not user friendly. you can use data-vv-as show in error message. read more here . <input type="text" name="address_line_1" data-vv-as="address line 1" />

insertMapObject Function Android Returning 23 code Cartotype -

firstly, cartotype provides api providing map in android,ios , other platforms per knowledge . from docs found function meets need native int com.cartotype.framework.insertmapobject ( int amaphandle, int amapobjecttype, string alayername, geometry ageometry, string astringattributes, int aintattribute, long aid, boolean areplace ) but parameters refer couldn't successful in getting , got // second or continuing measurement, add arrays // , draw line idistancemeasurementx = extendarray( idistancemeasurementx, thispoint[0]); idistancemeasurementy = extendarray( idistancemeasurementy, thispoint[1]); // _thread.iframework.deletemapobjects(0, // id_measurement_tool, id_measurement_tool, null); // _thread.iframework.addlineorpolygonobject( // "measurementtool", idistancemeasurementx, // idistancemeasurementy, // framework.degree_coords, null, 0, // id_measurement_tool, false); //drawing line geometry geometry geometry = new geo

excel - What have I messed up in the VBA loop for each worksheet? -

i have send multiple letters out @ 1 time , replace 1 or 2 words within cell. problem need words bolded , tedious use macro individually on 150 worksheets. new coding , have tried search online edit code loop through of worksheets, try seems change current sheet on. below current code thought cause loop, instead of looping through worksheets seems loop through single worksheet on, asking if bold word on sheet. origanal code: sub findandbold() dim ws worksheet dim sfind string dim rcell range dim rng range dim lcount long dim ilen integer dim ifind integer dim istart integer on error resume next set rng = activesheet.usedrange. _ specialcells(xlcelltypeconstants, xltextvalues) on error goto errhandler if rng nothing msgbox "there no cells text" goto exithandler end if sfind = inputbox( _ prompt:="what want bold?", _ title:="text bold") if sfind = "" msgbox "no text listed" goto exithandler end if ilen = l

height - How to change the size of layer with all elements in PHOTOSHOP? -

i need sizes of layer width - 7sm, height - 10sm. elements scaled correctly size of layer same time. possible? image to change size of project. go image tab , select image size. scale multiple layers @ once. click 1 , hold shift, click another.

c# - How to change the color of a selected item of a ComboboxItem which includes a TextBlock? -

i have following xaml of combobox: <combobox> <comboboxitem> <textblock fontweight="bold" background="palegreen">1</textblock> </comboboxitem> <comboboxitem> <textblock fontweight="bold" background="salmon">2</textblock> </comboboxitem> <comboboxitem> <textblock fontweight="bold" background="paleturquoise">3</textblock> </comboboxitem> <comboboxitem> <textblock fontweight="bold" background="gold">4</textblock> </comboboxitem> <comboboxitem> <textblock fontweight="bold" background="black" foreground="white">5</textblock> </comboboxitem> <comboboxitem> <textblock fontweight="bold" background="gray">6</textblock> </c