Posts

Showing posts from May, 2015

GraphicsMagick mogrify to stdout -

according http://www.graphicsmagick.org/graphicsmagick.html#files specify input_file - standard input, output_file - standard output. my attempt: gm mogrify - < image.png but nothing printed stdout. (though did happen notice number of files in /tmp increased 1 each time.)

ios - Auto Layout Challenge: Please tell me what is wrong in this case -

Image
i've been trying understand auto layout, keep failing , need help. in test project below wanted align 4 squares in both portrait , landscape modes on devices. need know constraints doing wrong. i used views in case. in first step added equal width/size pins since squares same size. size of squares w:250 h:121. view container inferred option in second step added width , height pins (cushions) between squares. in third step added necessary outside constraints individual squares superview (leading,trailing,top top layout, bottom bottom layout). and constraints end doing; fine in portrait weird/don't show in landscape. what doing wrong? a size class issue, constraint issue, missing steps, or else? in 3.5 , 4 inch doesnt show because fixed constraint bottom of superview, constraint's constant value alone higher screen itself, forcing views's height become 0 (or small on bigger 5.5 screen in screenshot), fixing this, try use less consta...

windows - Batch copy and overwrite files if they exist in the destination -

i found following batch script here on se: batch script - if exist copy %localappdata% error if exist "%localappdata%\foldername\filename" (copy /y "filename" "location") how modify script operate on directory full of files? tried didn't work: if exist "temp\*.*" (copy /y "artwork\*.*" "temp") xcopy command includes update switch copy files present in target folder. xcopy /y /u "artwork\*" "temp"

Generate C# code with Roslyn and .NET Core -

is there way generate c# code using roslyn .net core. i've tried using syntaxfactory package microsoft.codeanalysis.csharp. problem i'm stuck getting proper formatted code text it. all samples i've seen far use like var ws = new customworkspace(); ws.options.withchangedoption (csharpformattingoptions.indentbraces, true); var code = formatter.format (item, ws); the problem here is, use package microsoft.codeanalysis.csharp.workspaces isn't compatible .net core @ moment. there alternative routes or workarounds using roslyn code generator .net core? the package microsoft.codeanalysis.csharp.workspaces 1.3.2 supports netstandard1.3 , should compatible .net core. depends on microsoft.composition 1.0.27, supports portable-net45+win8+wp8+wpa81 . framework moniker compatible .net core, if import in project.json. that means make work, relevant sections of project.json should this: "dependencies": { "microsoft.codeanalysis.csharp.worksp...

Lodash: What's the opposite of `_uniq()`? -

the _.uniq() in lodash removes duplicates array: var tst = [ { "topicid":1,"subtopicid":1,"topicname":"a","subtopicname1":"w" }, { "topicid":2,"subtopicid":2,"topicname":"b","subtopicname2":"x" }, { "topicid":3,"subtopicid":3,"topicname":"c","subtopicname3":"y" }, { "topicid":1,"subtopicid":4,"topicname":"c","subtopicname4":"z" }] var t = _.uniq(tst, 'topicname') this returns: [ {"topicid":1,"subtopicid":1,"topicname":"a","subtopicname1":"w" }, { topicid: 2, subtopicid: 2, topicname: 'b', subtopicname2: 'x' }, { topicid: 3, subtopicid: 3, topicname: 'c', subtopicname3: 'y' } ] what's opposite of this? should return single obj...

Swift, How to get the image path from UIPickerView in iOS? -

in android there way take selected image path , display in our app. there way same thing in ios too? select image picker view, take image path , display in app? uiimagepickercontrolleroriginalimage returns image's data, no reference local storage. func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) { if let localurl = (info[uiimagepickercontrollermediaurl] ?? info[uiimagepickercontrollerreferenceurl]) as? nsurl { print (localurl) //if want image name let imagename = localurl.path!.lastpathcomponent } } for more see link

ios - How to hide and unhide a imageview in a tableview cell? -

Image
i using tableview 2 rows. each row having label, button , image view .initially the row height 50 no image. when click button in cell image picker open , select image camera roll. how can update tableview height 100 image view in cell? you can achieve using autolayout. if design cell in xib : cell height 100 : with these constraints on image view : it height 50 : the weird line image view got automatically shrunk autolayout. looks bad in interface builder, ok on device/simulator. 1 thing have remember remove image (not image view!) when cell @ 50 height , set when @ 100. also i'd recommend learn autolayout powerful tool.

javascript - How to run this angular $interval function just three times (3 loops) -

i run following function controller, using interval , producing 3 different avatars in view template. at moment, produces 1 avatar.png , love produce 3 different. so how can set html displays 3 different images? here code: controller: $scope.capture = function(){ var canvas = document.getelementbyid('canvas'); var video = document.getelementbyid('video'); canvas.getcontext('2d').drawimage(video, 0, 0, video.videowidth, video.videoheight); } $interval (function(){ $scope.capture(); }, 1500); and template canvas image drawn: <canvas id="canvas"></canvas> so basically, want after 1.5 seconds image drawn , total images drawn should 3. each image it's own canvas id different. why don't use $timeout for(var i=0;i<3;i++) { $timeout (function(){ $scope.capture(); }, 1500*i); } this execute function 3 times. may need write logic draw image in different canvas different ids. ...

outlook - How can I have 2 language auto signature? -

i have 2 languages installed in outlook, english (left right) , arabic (right left) , created 2 different signatures. can assign each signature manually each language want know possible signature assign automatically when change language or direction. , how ? no, outlook not out of box.

hive - standard process after ingesting data in hadoop -

i importing data oracle hadoop , want keep data hive. what steps followed after ingesting data hadoop? how perform data cleaning or error check in ingested data? 1. steps followed after ingesting data hadoop? you don't need ( importing data hadoop transferring hive ) as per docs , you need add --hive-import in import command. change hive table the table name used in hive is, default, same of source table. can control output table name --hive-table option. overwrite hive table if hive table exists, can specify --hive-overwrite option indicate existing table in hive must replaced @sachin mentioned handling of null values in data. can check docs more details 2. how perform data cleaning or error check in ingested data? i assume "data cleaning" mean cleaning data in hadoop. after data imported hdfs or step omitted, sqoop generate hive script containing create table operation defining columns using hive’s types, , load da...

python - Gunicorn giving syntax error for my configuration file -

my config file [loggers] keys=root, gunicorn.error, gunicorn.access [handlers] keys=console, error_file, access_file [formatters] keys=generic, access [logger_root] level=info handlers=console [logger_gunicorn.error] level=info handlers=error_file propagate=1 qualname=gunicorn.error [logger_gunicorn.access] level=info handlers=access_file propagate=0 qualname=gunicorn.access [handler_console] class=streamhandler formatter=generic args=(sys.stdout, ) [handler_error_file] class=logging.filehandler formatter=generic args=('/tmp/gunicorn.error.log',) [handler_access_file] class=logging.filehandler formatter=access args=('/tmp/gunicorn.access.log',) [formatter_generic] format=%(asctime)s [%(process)d] [%(levelname)s] %(message)s datefmt=%y-%m-%d %h:%m:%s class=logging.formatter [formatter_access] format=%(message)s class=logging.formatter my command execute gunicorn --env django_settings_module=myproject.settings myproject.wsgi --log-level debug --log-fil...

html - How to display two cards horizontally with equal height using bootstrap -

im using bootstrap. need place 2 cards of equal row-height. each card placed inside col-xs-6. card contains text , buttons. when use col-height col-xs-6 card both card join together. please me on this. <div class="row"> <div class="row-height"> <div class="col-height col-middle col-xs-6 card"> <div class="row"> <div class="col-xs-12 text-center"> <h3 class="heading-s1">login</h3> </div> <div class="col-xs-12 text-center"> <a href="javascript:void(0);" class="btn big-btn no-border red-background unstyle-anchor" style="padding: 13px 50px;">login!</a> </div> </div> </div> <div class="col-height col-middle col-xs-6 card"> <div class="row"...

python - How to combine all the queued jobs(gerrit changes) and run as a single job in jenkins -

my jenkins configured gerrit plug-in , build code per each gerrit change when merged. while build taking place there more gerrits merged , jobs in queue build. question how combine queued jobs , run single job once current job completed. either way how latest merged change list , run in single job next time. you can make master job , make job run other jobs setting post-build actions , set deploy other projects giving names of jobs want deploy.

javascript - post http request to 3rd party and response with redirect -

i have asp.net mvc project form need send httprequestobject . i'm trying few days make simple xmlhttp request 3rd party credit card clearing company url , response redirect on xml format - don't care if redirection made iframe or popup checked on internet solutions checked solutions here still nothing work. checked if i'm blocked in way proxy or firewall, , it's not issue. i tried ajax - function creatempitransaction() { var terminal_id = "0962832"; var merchant_id = "938"; var user = "user"; var password = "password"; var url="https://cguat2.creditguard.co.il/xpo/relay"; var xmlstr = "xml data" var data = xmlstr; $.ajax({ type: "post", datatype: 'xml', data: data, url: url, username: user, password: password, crossdomain: true, xhrfields: { withcredentials: true } }) .done(function( data ) { console.log("done"); alert(x...

java - Better way to map Kotlin data objects to data objects -

i want convert/map "data" class objects similar "data" class objects. example, classes web form classes database records. data class personform( val firstname: string, val lastname: string, val age: int, // maybe many fields exist here address, card number, etc. val tel: string ) // maps ... data class personrecord( val name: string, // "${firstname} ${lastname}" val age: int, // copy of age // maybe many fields exist here address, card number, etc. val tel: string // copy of tel ) i use modelmapper such works in java, can't used because data classes final (modelmapper creates cglib proxies read mapping definitions). can use modelmapper when make these classes/fields open, must implement features of "data" class manually. (cf. modelmapper examples: https://github.com/jhalterman/modelmapper/blob/master/examples/src/main/java/org/modelmapper/gettingstarted/gettingstartedexample.java ) how map such ...

What is the equivalent of Java .get in python -

i need find value of element in array in python. in java use array.get(i) . there equivalent in python? edit: sorry confusion. using arraylist in java, using array.get(i) , , forgot array[i] in python same in java: array[i] . btw, get(i) arraylist not array in java.

android activity - Error on androidmanifest file when using appcompat -

i been using aide start project apps. , have problem in android manifest file says "aapt: in generated file: error unboung prefix". happened after replaced appcompatactivity activity, changed theme @android:style/theme.appcompatlight.darkactionbar. i've compile on build.gradle this. compile 'com.android.support:appcompat-v7:24.2.0' here's code androidmanifest file contains error. <?xml version="1.0" encoding="utf-8"?> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.lau...

javascript - Detect change in timer variable using jQuery -

i have timers updating every second. want execute function on change of timer variable. if can me out. have provided code below. for(var i=0; i<listingtime.length; i++){ if (listingtime[i].time >= 0) { var second = listingtime[i].time / 1000; var currenthour = parseint(second / 3600); } } here, want detect change of currenthour variable. you can set previous value variable prior loop, , whenever updating currenthour, match previousvalue variable. if same, not changes, if not same, changed , can execute callback. one more other way use object prototypes changes value of currenthour. following code shows that: above code can modified following add changelistner var hourlistner = { currenthour: null, update: function(newvalue, callback){ if(this.currenthour !== newvalue){ this.currenthour = newvalue; callback(newvalue); } } } timer = object.create(hourlistner); var changelistner = function(valu...

Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] while running Tango project in android studio -

i downloaded sample project (tango) link , imported android studio , started running project. when run project in android phone, gives error failure [install_failed_missing_shared_library] i dont know issue it. can me? the "missing shared library" tango library exists on tango enabled devices. you should use tango tablet development kit or other tango enabled device run tango sample.

networking - Network connectivity for docker containers on Ubuntu VM -

i have installed docker on ubuntu vm. running ubuntu docker containers. ip address taken these docker container in 172.17.*.* (eth0) . ip not able ping/access docker container outside. hence trying assign ip local network range. followed steps: create new bridge network subnet , gateway ip block $ docker network create --subnet 10.255.*.0/24 --gateway 10.255.*.254 ipstatic run ubuntu container specific ip in block $ docker run --rm -it --net ipstatic --ip 10.255.*.2 phusion/ubuntu curl ip other place (assuming public ip block duh) $ curl 10.255.*.2 curl: (7) failed connect 10.255.*.2 port 80: connection refused with this, host unable access 10.255.*.* network.the docker container takes ip 10.255.*.2 , still unable access outside. newbie docker. aim access docker containers to-from local network. you can specify network_mode: "host" when create container. available @ same ip host. have make sure doesn't try listen port that's...

How to update JavaScript Error class -

i want when 1 of evalerror, rangeerror, referenceerror, syntaxerror, typeerror, urierror thrown through code want these error should thrown after ajex request can know analyse client error logs. when went deep, found sevral interface created these error extending error class e.g. interface typeerror extends error { } interface typeerrorconstructor { new (message?: string): typeerror; (message?: string): typeerror; prototype: typeerror; } declare var typeerror: typeerrorconstructor; interface error { name: string; message: string; } interface errorconstructor { new (message?: string): error; (message?: string): error; prototype: error; } declare var error: errorconstructor; so there way redefine/update these interface defination before throwing these error should make ajex request server. note: i dont want use windows.onerror since other library(rollbar) has own onerror implimentation. is possible redefine these interface. e.g. c...

javascript - Replacing new state in react redux reducer without making a copy -

if have replacing entirety of slice of state, still have use object.assign or spread operator make copy of original state , replace new state, or can return new state in reducer? const fetching = (state = { isfetching: false }, action) => { switch (action.type) { case 'requesting': return object.assign({}, state, { isfetching: true } ) case 'receive_pokemon_type_info': return object.assign({}, state, { isfetching: false } ) default: return state } } vs. const fetching = (state = { isfetching: false }, action) => { switch (action.type) { case 'requesting': return { isfetching: true } case 'receive_pokemon_type_info': return { isfetching: false } default: return state } } there couple of things going on here. basically, if state only consists of boolean variable, creating new object enumeration ok. however, if state consists of other things, doing object.assign sh...

vsts - Query items user was mentioned in -

is there way query work items user mentioned? able receive 'hard-coded' results querying for "history"-"contains word"-"\@username" , but want generic version, works users. (opposed writing 1 query every user) you can’t achieve through work item query directly, build app retrieve data through rest api ( https://www.visualstudio.com/en-us/docs/integrate/api/wit/wiql ), change query text according different conditions (e.g. users)

Is it possible to execute Jenkins jobs from Powershell or Bash or Groovy scripts? -

i have separated quite small jenkins jobs. now need configure job depending on selected user parameters (selected through checkboxes?) execute of them. i start them powershell or bash or groovy script. possible? if using groovy in postbuild/pipeline step, can start job via jenkins api. for example, parameterless builds: import hudson.model.* jenkins.instance.getitem("my job").schedulebuild(5) and parameterized builds: import hudson.model.* jenkins.instance.getitem("my job").schedulebuild( 5, new cause.upstreamcause( currentbuild ), new parametersaction([ new stringparametervalue( "my parameter name", "my parameter value" ) ])); you can use jenkins rest api rest. example, hitting following url: parameterless: curl -x post jenkins_url/job/job_name/build parameterized: curl -x post jenkins_url/job/job_name/buildwithparameters?myparametername=myparametervalue

qt - How to build shared libraries of qwt - how to prevent qmake from linking to QtCore and QtGui -

i have source code of qwt , while making shared libraries of qwt , want prevent qmake linking qtcore , qtgui looking forward guidance you can't. qwt uses qt, there's no way build shared library without linking qtcore/qtgui. import qt's symbols, has linked qtcore/qtgui import libraries - that's how qmake sets up. otherwise, linker have emit qwt library whole bunch of unresolved symbols, , wouldn't work - it'd crash on first reference qt symbol, given said symbol have address of zero. to build without linking qt has built static library. linked qt when executable linked.

opencv - OrbFeaturesFinder giving different result when implemented on Android platform -

i using orbfeaturesfinder detect keypoints in images. ptr<featuresfinder> finder; finder = makeptr<orbfeaturesfinder>(); vector<imagefeatures> features(num_images); (*finder)(img, features[i]); i used code on linux , implemented same on android, results different sometimes, in given link http://imgur.com/a/wqxzx what can reason behind nature of output. method of accessing images in android image saved in jpeg form, read[edit] - for(int = 0; < imgnames.size(); i++){ bitmap bitmap = getthumbnail(imgnames.get(i)); int imagew = bitmap.getwidth(); int imageh = bitmap.getheight(); byte[] rgb = getbytearray(imagew, imageh, bitmap, "rgb"); bitmap.recycle(); mat mrgb = new mat(imageh, imagew, cvtype.cv_8uc3); mrgb.put(0, 0, rgb); imgproc.cvtcolor(mrgb, mrgb, imgproc.color_bgr2rgb, 3); panoimgs.add(mrgb); } and sent jni - jclass matclass = env->findclass("o...

c++ - Why is unordered_map and map giving the same performance? -

here code, unordered_map , map behaving same , taking same time execute. missing these data structures? update: i've changed code based on below answers , comments. i've removed string operation reduce impact in profiling. measuring find() takes 40% of cpu in code. profile shows unordered_map 3 times faster, however, there other way make code faster? #include <map> #include <unordered_map> #include <stdio.h> struct property { int a; }; int main() { printf("performance summery:\n"); static const unsigned long num_iter = 999999; std::unordered_map<int, property > myumap; (int = 0; < 10000; i++) { int ind = rand() % 1000; property p; p.a = i; myumap.insert(std::pair<int, property> (ind, p)); } clock_t tstart = clock(); (int = 0; < num_iter; i++) { int ind = rand() % 1000; std::unordered_map<int, property >::iterator itr = myumap.find(ind);...

A negative floating number to binary -

so exercise says: "consider binary encoding of real numbers on 16 bits. fill empty points of binary encoding of number -0.625 knowing "1110" stands exposant , minus 1 "-1" _ 1110_ _ _ _ _ _ _ _ _ _ _ " i can't find answer , know not hard exercise (at least doesn't hard one). let's ignore sign now, , decompose value 0.625 (negative) powers of 2: 0.625(dec) = 5 * 0.125 = 5 * 1/8 = 0.101(bin) * 2^0 this should normalized (value shifted left until there 1 before decimal point, , exponent adjusted accordingly), becomes 0.625(dec) = 1.01(bin) * 2^-1 (or 1.25 * 0.5) with hidden bit assuming have hidden bit scenario (meaning that, normalized values, top bit 1, not stored), becomes .01 filled on right 0 bits, get sign = 1 -- 1 bit exponent = 1110 -- 4 bits significand = 0100 0000 000 -- 11 bits so bits are: 1 1110 01000000000 group...

javascript - Manually edit the html of “Thumbnail grid with expanding preview” / Delete the button of 'VISIT WEBSITE' -

i have used gallery "thumbnail grid expanding preview" website: http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/ but need know how delete button (visit website) appears @ each time when expanding thumbnail. i tried several times.

syntax - What is wrong with using enums this way in Java? -

this question has answer here: how call enum individual methods? 2 answers public enum numbers{ 1 { public string getdigit(){ return "1"; } } , 2 { public string getdigit(){ return "2"; } } , 3 { public string getdigit(){ return "3"; } } }; public static void main (string[] args) throws java.lang.exception { numbers xyz = numbers.one; system.out.println(xyz.getdigit()); } above code throws error : main.java:38: error: cannot find symbol system.out.println(xyz.getdigit()); what reason error? , correct usage calling declaring methods inside enum each constants ? you have defined method getdigit() on enum constants one , two , three , not on enum numbers itself. if want xyz.get...

javascript - Avoid caching JS, CSS files page after each deployment -

we using asp.net. in front end, using html pages. server side code not used there. implementing "login.js?s09809808098" can resolve this. can't manually edit on every pages before each deployment. there method edit html pages in server side when page requested. or other method resolve issue? you can try adding expiration headers , dont cache headers fix problem. can create center repo static url assests , when repo return url append software version login.js?v1 way new version every release. define version number property in repo class. public static class urlrepo { public string appversion = "1"; public string geturl (enumurlname urls) { switch(enumurlname) { case enumurlname.loginjs return "login.js?v" + appversion; break; } } } public enum enumurlname { loginjs, logincss }

javascript - jsZip opened png image, POST it into server with ajax -

trying post .png image files zip jszip. same code works when trying same stuff .xml files , .mod files, not working .png files. the code i'm using is: jszip.loadasync(f) // f .zip file in input field .then(function(zip) { zip.foreach(function (relativepath, zipentry) { zipentry.async("string").then(function (data) { //data png image var pngfilepath="/serverimagespath/" + zipentry.name; var blob = dataurltoblob(data); $.ajax({ type: "post", url: pngfilepath, data: blob, datatype: "binary", }).done(function ( ) { console.log('put correctly png- ' + pngfilepath); }).fail(function ( jqxhr, textstatus, errorthrown ) { console.log("err png: " + errorthrown, textstatus); }); }); }); }); function dataurltoblob(dataurl) { var ...

Unable to get Publish Permission With Test User Facebook Android -

Image
i want publish post user's wall. know facebook allows tester , developers post on wall. have added user tester list. when try publish permission, says user has granted permission (as shown in screenshot) , returns. not able permission or post on wall. moreover, callback's method not called well. code i have followed code facebook example rpssample . //publish wall public void publishresult() { registerpublishpermissioncallback(); if (canpublish()) { //see definition below sharelinkcontent content = new sharelinkcontent.builder() .setcontenturl(uri.parse(urltopost)) .build(); shareapi.share(content, new facebookcallback<sharer.result>() { @override public void onsuccess(sharer.result result) { callback.didshareonfacebooksuccessfully(); } @override public void oncancel() { ...

objective c - iOS - Storyboard - cannot view embed in scrollView -

Image
i'm trying set scrollview. 1 way set scrollview on view option disable. check screenshot. another approach select subviews , embebed them on scrollview loose constraints. any simple solution situation? you cannot embed main view scroll view , instead can take new view , embed scroll view .

excel vba - VBA calling a variable by name inside a loop -

ok here's deal: need comprehensive check in .csv file (comparing 1 in current sheet external one). decided divide list 10 equal sections (deciles). in each decile choose random value belonging section , use row number compare 2 sets of data. where things fall apart inside function. looking way go through each decile (starting rand0) , have vba check whether values of .csv , data sheet in workbook equal. if not - function (called get_param) executed. i dont quite understand how have vba go through function dec = 0 9 - in essence row number rand0 row number rand9 , perform inequality check (in second if function). rand & dec part not work. looking clues on how fix or on new implementation same thing. a few more details: n number of rows in .csv file (equal couple of thousand). np number of rows in file (should equal n - if not, execute function). paramlocation designated automatically - should located in specific location. sub check_changes_param() dim dec integ...

What's the difference between "react-native bundle" and "react-native unbundle"? -

what purpose of "unbundle"? i find 2 different options create react native offline bundle. there not description option. bundle [options] builds javascript bundle offline use unbundle [options] builds javascript "unbundle" offline use i create react-native bundle using "react-native bundle" command like: react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle even if create bundle using command below, can run same previous one: react-native unbundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle size of output file same, contents of ouptut file different. thought 'unbundle' option create multiple separated bundles share common part of bundle. does know 'unbundle' is? android unbundle means create separated files. ios unbundle means create big file contains mapping table , codes. slow ios load multip...

javascript - How to make dot and comma sensation in GridView Textbox? -

i wanna put dot , comma sensation in gridview textbox, example have textbox field in asp.net gridview money field. have input 1234 dollars , 50 cent. if write 1234 => keypress should return 1.234 after comma 1.234. pressing comma "," ) should stop "." intellisense 1.234,50 cent. not work properly. if start write on keyup should start change it. should start change input : (while writing) 1234 dollars 50 centinput (123450) => 1.234,50 1234567 dollars 75 cent(1234567(you can put comma.it should not prevent)75) => 1.234.567,75) my c# code: private void gvrowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { textbox txtveri = (textbox)e.row.findcontrol("txtveri"); txtveri.attributes.add("onkeyup", "insertcomma(this.id)"); } } my js code: function insertcomma(veriid) { console.log("çal...

bluetooth - Android BLE, Writing and Reading from the same device, without loss throughput and time -

i'm currentily developing application uses bluetooth low energy communicate ble device. problem project require high continuous exchange of data working. currently i've developed 4 fragments share same bluetoothgatt istance , same data array. when connect ble device, set connection priority high, start writing loop writes data, 4 bytes, every 50 mls. at same time start reading , update interface. i've noticed if stop writing receive packet of data every 50 mls, if let writing loop working reading time increase 50mls 100 or more. that's not real big problem reduce sistem performances. i looked on internet solutions didn't find nothing, except connection priority helped me lot, i'd know if have never managed such problems , how did it. thanks ble device using has called "connection interval". set in firmware of device. minimal value 7.5ms, set 30ms or more (ios not work intervals lower 20-30ms or miss packets). so when ble device f...

javascript - yeoman angular firebase AUTHENTICATION_DISABLED -

i set project using yeoman generator angularfire according instructions here . when try register or login, following error: {"code":"authentication_disabled"} i have enabled firebase authentication in firebase console, email/password auth. the firebase site says include following code snippet, don't know should put after yeoman has generated app. // initialize firebase // todo: replace project's customized code snippet var config = { apikey: "<api_key>", authdomain: "<project_id>.firebaseapp.com", databaseurl: "https://<database_name>.firebaseio.com", storagebucket: "<bucket>.appspot.com", }; firebase.initializeapp(config);

ios - Image from custom.xcassets in React-Native -

if want use image in react-native js images.xcassets, provide image name uri - eg. <image style = {styles.somestyle} source = {{uri:'addimage.png'}}> but if have custom created .xcassets ? how can imageset accessed rn js ? it's considered legacy code, can imported like: <image source={require('image!custom')} />

layout - Android : Button Error. Visible in Marshmallow Not seen in Kitkat AVD? -

i'm developing android application music player. here in tabbed layout have placed botton. while running project button shown in marshmallow avd . while running same programme on kitkat avd button not seen .. can 1 me find error ..? my xml code,...... <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" android:orientation="vertical"> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/material_blue_grey_800" android:id="@+id/toolbar" android:theme="@style/themeo...

javascript - Why does my JSON data with Ajax not return correctly even though the console logs it? -

i getting number (1,2,3, etc.) based on coordinates this: function getnumber(lat,lng) { var params="lat="+lat+"&long="+lng; $.ajax({ type: "post", url: "https://www.page.com/code.php", data: params, datatype: 'json', success: function(data){ if (data.valid==1){ console.log(data); $("#number").html(data.number); } else { console.log(data); } }, error: function(){ } }); } the problem is, when check console, data there this: [object] 0 object lat: 100.00 long: 50.00 number: 1 etc. why doesn't let me parse it? the way return post is: [{"valid":"1","lat":100.00,"long":50.00,"number":"1"}] so returning array? then...

in app billing - In-App Purchase Android -

i developing application android , implemented in app purchase. when click button works fine. i don't want show in app purchase dialog 1 more time when user uninstalls application , installs again. please me suitable example. thanks in advance. once managed product purchased , not use consume, user owns forever. @ startup check owned products , draw ui accordingly. example .

html - CSS Box shadow custom shape issue -

Image
i have tried box in image. but can't shadow looks on bottom of box. have tried in css-matic box shadow can't shadow. can give solution shadow. in advance :) .ss_tag3 { position: relative; -webkit-transition: 200ms ease-in; -webkit-transform: scale(1); -ms-transition: 200ms ease-in; -ms-transform: scale(1); -moz-transition: 200ms ease-in; -moz-transform: scale(1); transition: 200ms ease-in; transform: scale(0.8); } .ss_tag3 h1{ text-align:center; } .ss_tag3 .ss_head { background: #2b557d; padding: 2% 7% 7%; position: relative; box-shadow: 0 3px 3px #bdc3c9; } .ss_tag3 .ss_head:after { content: ''; border: 28px solid transparent; position: absolute; left: 41.5%; bottom: -42px; border-top: 15px solid #2b557d; } .ss_tag3 .ss_head h1 { text-transform: uppercase; color: #fff; border-bottom: 1px solid #20476f; box-shadow: 0 1px 0 #3a6998; font-weight: 800; font-size: 32px; ...

html - Bootstrap - Do I have to add that class to every element? -

in css i'm used define styles globally elements button { /* style stuff */ } is there way set buttons bootstraps btn btn-sm btn-default without explicitly setting class every element? for example like button { btn btn-sm btn-default } if familiar less, edit bootstrap core , prepend each .btn button , .btn, button , , recompile less. buttons.less file want looking at. alternatively, search , replace " .btn { " , replace " .btn, button { " in compiled css of bootstrap. although have multiple times , quite careful, since there lot of subclasses in bootstrap ( .btn-default , .btn-primary , on).

excel - How do I lock in a cell in a list into a formula, so that the formula won't lose it when I edit the list? -

i have list of employees stats, kind of job people come , go. i'm data , numbers make sense in world me. management not much. present data in separate worksheet in "nicer" way. want delete in list in way if refer cell in "nicer" worksheet, b64 example lets "sally" if delete row above it. sally's data becomes "john" data , other worksheet messed up. how avoid that. the solution use indirect() function if want cell reference a1 of sheet1 in nicer sheet, reference =+sheet1!a1 . avoid #ref! problem on deletion use indirect function below =indirect("sheet1!"&cell("address",a1)) now if delete rows in sheet1, nicer sheet not messed up; reference cells correctly in order how in sheet1 correctly in nicer sheet without #ref!

php - Add description feature to wordpress theme -

i have section in wordpress theme started scratch, in section have title, tagline , description. i displaying them using: for title: get_bloginfo(); for tagline: get_bloginfo('description'); i need way user can write longer description of site , display it. i found on google how add meta descriptions that's not want. wordpress keep info in options table. can same yours. checkout following functions in wordpress documentation: update_option - saving description get_option - getting and/or using value delete_option - deleting value you need have unique key name example desc_long using purpose. here example snippet code: // save value in database update_option('desc_long', $_post['input_field_name_in_form']); // remove value database delete_option('desc_long'); // in theme use following retrieve value get_option('desc_long'); as far can remember can not add functionality existing setting page...

android - Java LibGDX Update and Draw Methods -

people write "draw(spritebatch batch)" , "update(float deltatime)" methods in player classes. why don't write "render(spritebatch batch, float deltatime)"? because of readability? mean, why make 2 methods? can in single method. readability , ease of updating/changing 1 reason. but there logistical reasons. want sure whole game state date before start drawing, whatever on screen up-to-date possible. if put updating , rendering 1 method each object, objects updated , drawn first might out of date compared objects updated later , affect state of earlier objects. if updating , drawing separated, can update entire game , draw entire game. and if game uses physics, separation of updating , drawing allows update world @ fixed timestep (at different rate drawing) ensure game play not affected frame rate.

administration - Sage CRM - It is possible to create secondary teams? -

for example have primary team called "cable management" , want create secondary teams ic1 , ic2 children of cable management, , ic1 , ic2 secondary teams, add users. how can achieve kind of behavior? if need using teams, can add new field team entity. team listed under administration > customisation > secondary entities > team. add field of type "team select" , give column name, caption, etc. advise "parent team" (chan_parentchannelid). next, edit team screens include new field. screens want edit are: - team search box (channelsearchbox) - team admin box (channeladminboxlong) once have added field screens, can start specify parent teams in system. record link 1 team another. can use link in database select parent details. e.g. select t.chan_channelid teamid , t.chan_description teamdescription , p.chan_channelid parentid , p.chan_description parentdescription channel t left outer join channel p on p.chan_...

angular - Angularfire2: Proper approach to check if user is logged in? -

i wan't allow logged in users access site. what's proper way of checking if user logged in on load? the code below first try, don't know if works though. of course wrote db rules, want complete behavior visually user. this.af.auth.subscribe(auth => { if (auth) { //route other view } else { //do whatever } }); you should consider use angular 2 guards, canactivate . can validation before routing happens. way can prevent navigation of unauthorized users. as early, approach works. if want transformation on auth information. probably, should use observables methods map, flatmap, concatmap.

spring mvc - SpringMVC: Passing value over URL Securely -

i saw can not pass values using post method due security reason. question is there other better , secure process that? no 1 can see passwords or values on url. actually post method use submit form , parameters not pass through url. if need submit form should use same. if want pass values can use sessions,cookies,etc. get - requests data specified resource post - submits data processed specified resource

angularjs - How to update array elements in mongodb -

i have data in mongodb below { "_id": objectid("57c40e405e62b1f02c445ccc"), "sharedpersonid": objectid("570dec75cf30bf4c09679deb"), "notificationdetails": [ { "userid": "57443657ee5b5ccc30c4e6f8", "username": "kevin", "isred": true } ] } now want update isred value false how write query this. have tried below var updateisredfield = function(db, callback) { db.collection('notifications').update({_id:notificationid}, { $set: { "notificationdetails.$": {isred: false}}, }, function(err, results) { callback(); }); }; mongoclient.connect(config.database, function(err, db) { assert.equal(null, err); updateisredfield(db, function() { db.close(); }); return res.json({}); }); since positional $ operator acts placeholder first element matches query document, , ...

xml - greater than symbol works but less than not in xslt -

i have datapower http based mpg service. getting response soap message backend has size element values ex: <size><10000</size> <size>10000></size> it showing correctly in datapower probe. when comes soapui lessthan symbol not showing correctly.showing below: <size>&lt;10000</size> <size>10000></size> how '<' less symbol correctly? thanks in advance. the follow symbols in xml : < , > , " , ' , & replaced &lt; , &gt; , &quot; , &apos; , &amp; respectively. in xml text avoid errors it's recommended replace all, < , & must replaced times (as @michael.hor257k comments). alternatively avoid replacement it's possible to use cdata ). probably datapower "prettify" response before shows (here i'm guessing since don't know datapower). soapui doesn't perform transformation in response , showing response is, why see ...

May be having jQuery or JavaScript loading -

Image
i trying style textbox , layout using bootstrap class, getting error message , bootstrap class didn't work properly. you can review code error image below. solution? here uploading code , error image: @model drivein.models.usersmodel <script src="~/scripts/jquery-3.1.0.min.js"></script> <script src="~/scripts/jquery.validate.min.js"></script> <script src="~/scripts/jquery.validate.unobtrusive.min.js"></script> @using (html.beginform()) { @html.antiforgerytoken() @html.validationsummary(true) <div class="form-group"> @html.labelfor(model => model.username, htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.username, new { htmlattributes = new { @class = "form-control" } }) @html.validationmessagefor(model => mod...

php - Split one file and make them into two -

//expression found in file name $find = '.5010.'; //directory name //we store renamed files here $dirname = '5010'; if(!is_dir($dirname)) mkdir($dirname, 0777); //read files directory //skip directories $directory_with_files = './'; $dh = opendir($directory_with_files); $files = array(); while (false !== ($filename = readdir($dh))) { if(in_array($filename, array('.', '..')) || is_dir($filename)) continue; $files[] = $filename; } //iterate collected files foreach($files $file) { //check if file name matching $find if(stripos($file, $find) !== false) { //open file $handle = fopen($file, "r"); if ($handle) { //read file, line line while (($line = fgets($handle)) !== false) { //find ref line $refid = 'ref*2u*'; if(stripos($line, $refid) !== false) { ...