Posts

Showing posts from August, 2015

mysql - Count all records that does not exist to other table - SQL Query -

i have two(2) tables , i'm trying count records table1 , table1_delta pagename table1_delta not yet listed table1. incase pagename table1_delta listed table1, status must 1 included in count result. sample table structure: table1 +-----------+--------+ | pagename | status | +-----------+--------+ | pagename1 | 2 | | pagename2 | 1 | +-----------+--------+ table1_delta +-----------+ | pagename | +-----------+ | pagename1 | | pagename2 | | pagename3 | | pagename4 | +-----------+ the table sample should return "3" . pagename3 , pagename4 not listed in table1(that returns 2) , pagename2 table1 has status = 1(that returns 1). in total there 3 pagenames table1_delta not listed in table1 , record table1 status = 1. i'm wondering on how query of this? i'm using mysql v5.6.17. thanks! here alternative solution using joins: select count(*) table1_delta t1 left join table1 t2 on t1.pagename = t2.pagename t2.status null or t2.status = ...

web - Vb.Net Take snapshot of streaming webcam video (over internet) -

i have video streaming of security webcam. i'd need take screenshots @ high possible resolution @ regular intervals. option 1 fullscreen video , take regular screenshots , save them i'd have computer busy , couldnt work on anymore. option 2 somehow capture webstream, , extract screenshot stream. are there better otpions? how capture screenshots stream? thanks here code can taking screen shot , automatically saving it. option 1. dim screenshot new bitmap(screen.primaryscreen.bounds.width, screen.primaryscreen.bounds.height, pixelformat.format32bppargb) dim g = graphics.fromimage(screenshot) g.copyfromscreen(0, 0, 0, 0, screenshot.size) g.dispose() screenshot.save("c:\test.bmp") you put in timer or , add date or incremented number end of file name. for option 2 might have resort third party program able want. far know, way capture of screen have visible. maybe i'll poke around @ it. you've got me curious now. ...

php - Unable to insert/update data from phpmyadmin -

i unable insert , update record through phpmyadmin, able php not privilege issue, when ever try execute insert, update, delete query phpmyadmin says error in processing request error code: 500 error text: internal server error i have cross checked privileges database user privileges not issue.

Timezone aware DateTime fields in django forms -

in short, i'm trying show user datetime field initialized timezone aware datetime object, allow them edit , post back. without doing special warning non-timezone aware datetime being returned form's datetime field. /django/db/models/fields/__init__.py:1474: runtimewarning: datetimefield mymodel.datetimefield received naive datetime (2015-09-09 15:55:00) while time zone support active. i started reading the django time zones docs . installed pytz ( pip install pytz ) , made sure use_tz = true set. i'm using django-easy-timezones , sets "current" timezone based on requester's ip call timezone.activate() . understand it, setting time_zone otherwise used default. i'm also using django-bootstrap3-datetimepicker nice widget in form. the timezone doesn't appear sent initial form data. instead, "current" timezone used create , send naive local datetime. this gather clean_[field] method meant assume comes in post in "curr...

How to run a program (C++) on Visual Studio Code -

i see no option compile , run program. i'm confused. visual studio code not act compiler, merely text editor. view this thread more information.

ssl - How to enable tls vers. 1.2 in haproxy -

i have haproxy doing ssl termination. have disabled sslv3. the ssl testers says have tls 1.0 enabled. how can enable tls version 1.2 in haproxy ? thanks check version of openssl. tls 1.2 in version 1.0.x. older (for example 0.9.8 in debian squeeze) supports tls 1.0.

sql - Sorting of 2 different sets of values of single row of a table -

i have below table, a b c -------- ---------- ----------- akhil kerala 0008 – 0030 athul kerala 15 basil delhi 0031 – 0059 rahul chennai 32 kishore new york 0060 – 0090 anoop mumbai 45 i have sort entries according column c, sorted order of column should like, 15 32 45 0008 – 0030 0031 – 0059 0060 – 0090 kindly advice. in advance. oracle sql: select t.*, to_number(decode(instr(c,' '),5,null,c)) atr1, decode(instr(c,' '),5,c,null) atr2 test_tab t order atr1, atr2 if table has many rows , query executed should add index: create index sort_idx on test_tab ( to_number(decode(instr(c,' '),5,null,c)), decode(instr(c,' '),5,c,null) ); if use e.g. mssql database replace decode case statement , instr charindex.

cuda - cusparse sparse plus dense matrix addition -

is possible add sparse matrix , dense matrix using cusparse? in cublas, i'd treat matrices vectors , use axpy. cusparse have axpy sparse/dense vectors, cannot used matrices because sparse vectors , matrices have different memory structure. cusparse has dense-to-sparse , sparse-to-dense conversion routines . could: convert sparse matrix dense (e.g. cusparse<t>csr2dense ), add 2 cublas<t>geam , producing dense matrix result convert dense matrix sparse (e.g. cusparse<t>dense2csr ), use cusparse<t>csrgeam produce sparse result note using cusparse<t>geam little bit more involved single function call, usage methodology given in the documentation . also, when using cusparse<t>dense2csr , want use cusparse<t>nnz storage allocations needed.

Android: on screen rotation what should Fragment's onCreate() and onCreateView() do -

in activity have check savedinstancestate, making sure not creating multiple fragments but question should have similar checks in fragment's oncreate() , oncreateview() because when rotate screen fragment's oncreate() , oncreateview() called everytime. question is, ok these 2 methods re-do there job after everyscreen rotation or should have savedinstancestate check well. right oncreate() makes service call , oncreateview inflates view (recyclerview) when activity or fragment recreated, oncreate() method first fired, followed onrestoreinstancestate() method, enables retrieve state savedpreviously in onsaveinstancestate() method through bundle object in argument: @ override public void onrestoreinstancestate(bundle savedinstancestate) { super.onrestoreinstancestate(savedinstancestate); //---retrieve information persisted earlier--- string id = savedinstancestate.getstring(“id”); }

eclipse - java.lang.ClassNotFoundException: org.apache.commons.logging.Log -

while running springmvc program through eclipse showing below error 'starting tomcat v8.0 @ localhost' has encountered problem. server tomcat v8.0 server @ localhost failed start. using eclipse luna configured tomcat 8.0 below relevant stacktrace of error caused by: org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[/mvcvalidation sapp7sfc]] @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:154) ... 6 more caused by: java.lang.noclassdeffounderror: lorg/apache/commons/logging/log; @ java.lang.class.getdeclaredfields0(native method) @ java.lang.class.privategetdeclaredfields(class.java:2499) @ java.lang.class.getdeclaredfields(class.java:1811) @ org.apache.catalina.util.introspection.getdeclaredfields(introspection.java:106) @ org.apache.catalina.startup.webannotationset.loadfieldsannotation(webannotationset.java:256) @ org.apache...

java - gson.toJson(Set<CustomObject>) is not working -

i have customclass object having uri,int,& other customclass data.i want save set in shared peference using gson library. final customclass obj1 = new customclass.builder().msourceuri(downloaduri) .mdestinationuri(destinationuri) .metadata(metadata1).build(); set<customclass> set = new hashset<customclass>(); set.add(obj1); set.add(obj2);..etc gson gson = new gson(); type type = new typetoken<set<customclass>>() {}.gettype(); string json = gson.tojson(set,type); editor = sharedpreferences.edit(); editor.putstring("sharekey", json); editor.commit(); but gson.tojson() not returning & application crashing. gc called contineously. not using generic types in application. when tried sample application student class data, working fine. failing customclass object please in resolving this. have copied logs below. customobject class: public class customo...

Workflow for Servicenow Incidents -

Image
i checking feasibility workflows on incidents , found post . it seems possible have workflows on incidents. i need know there proper way it..i kind of new bee servicenow. share experience , how can achieve this. instance, simple approval workflow on incident.. thanks in advance chitra a few basic changes can going, since incident table has approval fields , such associated it. alter incident form go incident configure (fuji) or personalize (eureka) following form layout > add approval field related lists > add approvers list create workflow approval next want workflow run when incident created. go workflow editor create new workflow following name : incident - approval table : incident [incident] activity pinning : set activity if condition matches : run workflow condition : leave blank leaving condition blank cause run on creation of incident . fill out workflow add following activities approval action name : set re...

oop - How can I access a property of an object in php by its index location -

in code want access property of object in php using index value, can access using name not using index value: i can : foreach($object $row) { echo $row['type']; } i want this: foreach($object $row) { echo $row[0]; } try this: $arr = array_values((array) $object); foreach ($arr $row) { echo $row[0]; } updated: i think, in case, have convert array each row, this: foreach ($object $row) { $row = array_values((array) $row); echo $row[0]; }

php - Disable time picker in Datetime picker -

i want disable time picker in datetime picker.i using parameters picktime: false , format: "dd mm yyyy" .but no use..i'm using http://eonasdan.github.io/bootstrap-datetimepicker/ <script type="text/javascript"> $(function () { $('#datetimepicker1').datetimepicker(); format: "dd mm yyyy" }); </script> plzz give solution better use date , have multiple options it have @ this bootstrap datepicker

listview - Updating View with respect to ViewCell in Xamarin.Forms -

i have view list , label. i placed time picker inside viewcell of corresponding list. i want know how can selected time of time picker corresponding label present in view. ! how can it? how can update label inside view respect time picker present in viewcell ? we can of implementing inotifypropertychange change label in view update corresponding picker in viewcell. refer : https://developer.xamarin.com/api/type/system.componentmodel.inotifypropertychanged/ https://developer.xamarin.com/guides/cross-platform/xamarin-forms/user-interface/xaml-basics/data_bindings_to_mvvm/ similar forum post : https://forums.xamarin.com/discussion/comment/154124

long long division in c -

am trying pass along "long long" number, problem when try divise number 10 , answer incorrect .. #include <stdio.h> int main(void) { int n = 0 ; long long s = 4111111111111111; n = s % 10 ; printf("n after modulos %i\n",n ); s = s / 10 ; printf("this s after division %llo \n",s ); return 0; } output : n after modulos 1 s after division 13536350357330707 printf("this s after division %llo \n",s ); ^ (this prints (correct)value in octal representation) use specifier %lld (to value in decimal ) .

python - Error in matplotlib csv2rec function -

i using csv2rec read csv file. many fields in csv file named "ms1-api2_c". when field read csv2rec, field name being converted "ms1api2_c". can not access column elements using converted field name or original field name. please suggest solutions. csv2rec designed automatically lowercase headers, can around feature using following approach: import matplotlib.mlab import csv filename = 'input.csv' open(filename, 'r') f_input: headers = next(csv.reader(f_input)) data = matplotlib.mlab.csv2rec(filename, names=headers) to quote matplotlib documentation : the headers lower cased, spaces converted underscores, , illegal attribute name characters removed.

c# - property names as params with compile check -

i'm writing utility class, take class name , array of property names params this: public static void domagic(type type, params string[] include) and call looks this: helper.domagic(typeof(myclass), "clientid", "pointid", "serialnumber") but don't it, couse there no compile-check, , if make mistake in string params, runtime error, not compile error. i want this: helper.domagic<myclass>(x => x.clientid, x => x.pointid, x => x.serialnumber) or, may be, shorter. there way this? if want syntax helper.domagic<myclass>(x => x.clientid, x => x.pointid, x => x.serialnumber) you need declare method public static ienumerable<fieldinfo> domagic<t>(params expression<func<t, object>>[] include) { foreach(expression<func<t, object>> tree in include) { fieldinfo fi = null; // tree parser, gets field info yield return fi; } } so...

c# - Redirect To Link OnActionExecuting (ActionExecutingContext) -

salaamun alekum want override controller.onactionexecuting method (actionexecutingcontext) and inside method want redirectto webpage link how make possible example: public class licensefilterattribute : actionfilterattribute { public override void onactionexecuting(actionexecutingcontext filtercontext) { ///some code here redirect("http://webpage.com"); ///redirect page ///rest of code thank please tell me if require further details you're close instead of redirect try filtercontext.result = new redirectresult("http://www.webpage.com"); that's use anyways. it's redirecting login page on same project like filtercontext.result = new redirectresult(url.action("index", "login")); edit: removed return statements, it's void , need set redirect result not return it

compiler construction - Does the object file contain x86 code? How can we generate RISC-V code from an object file? -

we have object files generated after compiling code (not written in c/c++). possible generate equivalent risc-v code object file? if so, how? binary translation thing, non trivial. compared other compiler infrastructure, it's relatively niche thing. furthermore, seem want static translation (i.e. generating complete binary target platform , doing nothing more @ run time). static translators either have acceptable slowdown , no support self-modifying code (and possibly other advanced features), or support these things implementing features, slow emulator. in case, implementing 1 quite involved, architecture complicated x86. unless find working general binary translator x86 risc-v, may better off porting program form can compiled risc-v (say, more mainstream language broader compiler support). since appear have access source code, ought doable — , might improve future maintainability. first, double , triple check whether can find compiler used language does target r...

c# - Exit application by clicking button on mainform when already pop up form is running -

form2 user confirmation window,i want close application stop button on mainform,but form2 active , there no dependency between form2 , mainform.how close application ? you must opening form2 using showdialog() method. instead of use show() method , on mainform button's click event call application.exit() method

Move rows to columns in SQL Server -

i have tried using pivot , other methods fix problem, seem stuck. customerid question answer ........................................................... 469494 q111 mottok e-post 469494 q125 ja 469494 q112 ja 469494 q113 ingeniør eller bachelor tekn 469494 q16 6 meget bra i need each customer row inlude answers, , columns value of question key. this: customerid q111 q125 q112 q113 (etc) ......................................................................................... 469494 mottok e-post ja ja ingeniør eller bachelor tekn there multiple customers answering. , answers freetext. my main problem here questions - , ofcourse - answers dynamic. answering questionnaire, , report should able run , extract info specific questionnaire, different question keys ,...

javascript - Hide bootstrap navbar on mobile and show a button instead to show the collapsed navbar dropdown -

i use bootstrap navbar, , collapses fine on small screens, shows navbar-toggle , dropdown menu if click on navbar-toggle. standard behavior. i want, however, hide entire navbar ribbon on small screens , show button on top middle part of screen. when click on button, should open dropdown navbar. html: <div class="navbar-show"> <button type="button" class="navbar-toggle" onclick="document.getelementbyid('toggle-button').click();"> <img height="50px" width="50px" src="img/logo3.gif"> </button> </div> <nav class="navbar navbar-default" data-ng-controller="globalauthctrl"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" id="toggle-button" data-toggle="collapse" data-target="#mynavbar"...

angularjs - Getting error "Cant set headers after they are sent" when trying to upload image and user data to mongoDB -

i using node, express, mongo , angular make simple app. have form user can insert data , upload image. image upload use ng-file-upload . using multiparty form data. here api upload of image server folder , save , entry in mongdb of user data along filename. router.route('/upload/image') .post(function(req, res){ var form = new multiparty.form(); form.parse(req, function(err, fields, files) { console.log(files); console.log(fields); var file = files.file[0]; var contenttype = file.headers['content-type']; var tmppath = file.path; var extindex = tmppath.lastindexof('.'); var extension = (extindex < 0) ? '' : tmppath.substr(extindex); // uuid generating unique filenames. var filename = uuid.v4() + extension; var destpath = './public/img/' + filename; // server side file type checker. if (contenttype !== 'image/png' &...

javascript - how to destroy a highland stream -

i have following example const input = _(); const output = _() .each(x => console.log('out', x)); input .pipe(output); input.write(1) output.destroy(); input.write(2); as far can read in documentation ( http://highlandjs.org/#destroy ) destroying stream should clean broken pipe. in stead following error: out 1 out 2 node_modules/highland/lib/index.js:1114 throw new error('can not call next after nil'); ^ error: can not call next after nil does have insight why happends, , correct way destroy stream is? from reading documentation, looks this answer error. way in stream lets rest of program know has ended passing "nil" next piece of data on stream. looking @ sample code @ link, it's determine stream has ended , act accordingly. that's why you're getting error - pipe trying continue on next data, throwing error there no such thing next after "nil". as correct way destroy stream, think way ...

groovy - Parameterized job using Uno-choice plugin -

i'm using uno choice plugin select parameter values based on previous selections. (this plugin helped me reduce parameter count. can reuse same parameter multiple platform based on platform selection) i used groovy script select parameter values. but takes time load parameters. is there way speed process? i had faced similar issues , using groovy scripts cal shell scripts.i did following things reduce time:- when click on build parameters task(scripts run @ once together) performed @ once. use else conditions properly. use fallback script. for eg:- you have parameters such 1) country 2) state 3) city each parameter depends on previous values. 1) try display contents on jenkins front-end.(cat command). 2) call script if matches valid values in previous parameter. 3) minimum on fly scripts. 4) optimize delays/sleep according load time. 5) remove extensions whether in chrome/firefox. 5) try using same page in incognito mode. 6) if options invalid ...

javascript - "Don't set props of the React component" warning -

i'm getting react.js error i'd love know how fix it. there way call react.cloneelement on this ? warning: don't set .props.children of react component . instead, specify correct value when creating element or use react.cloneelement make new element updated props. element created seven. here's full working example. here's code: var thead = react.createclass({ displayname: 'thead', proptypes: function () { return { children: react.proptypes.node } }, componentwillmount: function () { this.childtr = containselement('tr', this.props.children) this.props.children = reconcilechildren('th', (this.childtr) ? this.childtr.props.children : this.props.children, this.props.data ) }, render: function () { return ( <thead> {this.childtr ? <tr {...this.childtr.props}> {this.props.children} </tr> : <tr> {this.props.children...

ffmpeg and 7160 HD Capture card error, already set rtbufsize 2000M, still real time buffer too full -

the 7160 capture card original video shown fine in honestech hd dvr software included. however, when card captured using ffmpeg , publish out. error occurred after while running ffmpeg: real-time buffer [7160 hd capture] video input full or near full ... i have set -rtbufsize 2000m maximum allowed , can not increased further. please tell me how resolve bug or give me example can used without producing bug. thank much. not neeed code used because code simplest code used produced error after running while. published video lag , lost.

javascript - How to send cross origin SOAP request using java script / jquery -

my python script access soap web service. here consuming https web-service using unverified ssl context, won't show errors in certificate errors. now want achieve same javascript.i trying jquery soap library . my python snippet: import suds import ssl import os import cookielib if hasattr(ssl, '_create_unverified_context'): ssl._create_default_https_context = ssl._create_unverified_context client = suds.client.client("https://192.168.1.2:3455/mysoap") login = client.service.login("root","password") what equivalent snippet /code sample in javascript..?

javascript - how to write file with node webkit js? -

when build app, 'fs' module doesn't work. so, must write file, when start app nothing happens. if start app with: $ /path/to/app nw it works correctly. what's wrong? some code, use fs: function check_prob_2(){ console.log('problem 2'); fs.appendfile('log.txt', 'checking problem 2: \n\n'); ... } i use function, doesn't work. doesn't work after build application. build this guide try this: include following (standard) module: var path = require('path'); specify path follows: fs.appendfile(path.resolve(__dirname, './log.txt'), 'checking problem 2: \n\n'); more info on __dirname global can found here . edit since __dirname not defined in node-webkit, you'll have use following workaround: make file util.js or want call it, containing line: exports.dirname = __dirname; the __dirname variable can exposed in main file: var dirname = require('./util.js...

cordova - How to capture url and open it on an android app? -

i newbee programing. trying bundle webrtc html5 site via crosswalk-project cross compatibility. site works on shareable links. meaning, ever clicks on link can join webrtc session. i trying figure out how open our site links email, whatsapp etc our designated app. mean url mydomain.org/xyz123 should open our app. please point me in right direction. intent-filters friend. <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:host="mydomain.org" android:scheme="https" /> </intent-filter>

java - How to ignore class properties in Swagger -

my question simple, there way how ignore property in classes defined library or framework (for example, org.springframework.core.io.resource )? can anotate fields @jsonignore in own classes si there way how same in case can't change theclass itself? i want because returning responseentity<resource> and swagger-ui shows me nested fields of resource like "url": { "authority": "string", "content": {}, "defaultport": 0, "file": "string", "host": "string", .... } i using springfox spring mvc (no spring boot), both of them newest versions. don't annotate fields right now, leave work swagger. its not clear if want ignore type or want ignore properties on it? if want latter i.e. modify representations of classes cannot control using mixins in jackson should solve problem. not want do. guess want serialize how supposed to, want rendered differently in ...

unit testing - TFS 2012: F900547: The directory containing the assemblies for the Visual Studio Test Runner is not valid -

we have tfs 2012 server , visual studio 2015 on client side. problem when building project containing tests following error on tfs: f900547: directory containing assemblies visual studio test runner not valid . on this post got information have choose mstest test runner in build definitions . but when try no options choose test runner . it greyed out described in this post . solution mentioned here had install version of visual studio 2013 on build server working. i have installation of visual studio 2015 professional installed on server still showing error , still have no more options choose test runner visual studio test runner why not have mstest option test runner , how can fix this? and/or how can fix problem of having error without installing visual studio 2013 on build server?

.net - Create users alias in Google API (using c#) -

this error getting when creating alias in google admin directory email address. google.apis.requests.requesterror entity exists. [409] errors [ message[entity exists.] location[ - ] reason[duplicate] domain[global] ] this code : i want create alias email id : test@test.com added id above : aliasemailid@test.com ===> test@test.com var aliasesreq = service.users.aliases.insert(new google.apis.admin.directory.directory_v1.data.alias { aliasvalue = "aliasemailid@test.com", }, "test@test.com"); how ? kindly help i don't have admin account cant test this. checking documentation on users.aliases looks think going this. string userkey = "test@test.com"; var body = new google.apis.admin.directory.directory_v1.data.alias { primaryemail = userkey, aliasvalue = "aliasemailid@test.com" }; service.users.aliases.insert(body, userkey).execute();

ios - Objective-C - Trying to play sound -

Image
i trying play sound in app following code: nsstring *soundfilepath = [[nsbundle mainbundle] pathforresource:@"errorbeep.wav" oftype:@"m4a"]; nsurl *soundfileurl = [nsurl fileurlwithpath:soundfilepath]; avaudioplayer *player = [[avaudioplayer alloc] initwithcontentsofurl:soundfileurl error:nil]; player.numberofloops = -1; //infinite [player play]; but sound not play :( after debugging, can see soundfilepath nil here screenshot of resources file: you should import file project 1 extension. thats what's going on. re-import file 1 extension (i.e, errorbeep.m4a)

asynchronous - WPF Combobox Category Grouping From Async Call -

i can able group data categories combobox while rendering {initialization} setting below code below _cboitem = new list<string>(); _cboitem=service.getdata(); collectionview cvs = collectionview)collectionviewsource.getdefaultview(_cboitem); cvs.groupdescriptions.add(new propertygroupdescription("category")); but if bind combbox async call, grouping not happening. code below bindingoperations.enablecollectionsynchronization(_cbodoctype, _lock); task.factory.startnew(() => getdoctypeasync()); collectionview cv=(collectionview)collectionviewsource.getdefaultview(_cbodoctype); cv.groupdescriptions.add(new propertygroupdescription("category")); onpropertychanged("doctype");

Python for loop, print same items once -

i parse json data url , loop print items want. import urllib.request import json response = urllib.request.urlopen('http://jsonurl.com') content = response.read() jdata = json.loads(content.decode('utf8')) jdata2 = jdata['available_channels'] values in jdata2.values(): live = values['live'] category = values['category_name'] if "1" in live: print(category) thing if several items have same category prints them multiple times. for example drama crime drama drama drama comedy action comedy i print items have same category once: drama,crime,comedy,action how can that? you can use set keep track of elements have printed. example - jdata2 = jdata['available_channels'] seen_set = set() values in jdata2.values(): live = values['live'] category = values['category_name'] if "1" in live , category not in seen_set: print(category) seen_s...

java - what data format will be considered fastest to be written on Kafka? -

we have various options in kafka write data on it,e.g: string format, byte array. data foramt considered fastest while writing on kafka. moreover kafka provide utility compress whole data once , write on it. also need consider while consuming same message de-compressing it, reading data cost increase. kafka 0.8.2 serialises data byte array commit log. org.apache.kafka.common.serialization.serializer class has following interface: byte[] serialize(string var1, t var2); it requires byte array returned data written kafka topic. org.apache.kafka.common.serialization.stringserializer class has extract byte array string: public byte[] serialize(string topic, string data) { try { return data == null?null:data.getbytes(this.encoding); so in performance terms if have binary data write byte array using default serializer creating strings in java can potentially expensive , kafka convert string byte array anyway. regarding compression kafka offers ...

android - Gradle DSL method not found: 'credentials()' -

i trying add dependency private bitbucket account using bitbucket api following accepted answer this post . my project root level build.gradle file: // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() maven { url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}' } credentials { username 'my_username' password 'my_password' } } } i following error: error:(21, 0) gradle dsl method not found: 'credentials()' possible causes: - project 'usplibraryclerk' may using version of gradle not contain me...

How to sort a dictionary by an array value contained in the dictionary Swift -

i have dictionary contains arrays elements , want sort 1 of array values. solutions found sorting dictionaries single elements , not arrays. also, didn't understand $0.0 meant? below code example of i'm trying accomplish. var dict = ["mike": [62, 160], "jim": [72, 210], "tony": [68, 187]] //i want sort height (array values [0]) highest value lowest. //the output this: "jim": [72, 210] "tony": [68,187] "mike": [62,160] i'm relatively new coding have no idea how approach this. see, have dictionary sorted: let dict = ["mike": [62, 160], "jim": [72, 210], "tony": [68, 187]] you want sort function isorderedbefore: (self.generator.element, self.generator.element) -> bool if first 1 element should have been higher second one, should put a > b function , on. let sorteddict = dict.sort { (first: (string, array<int>), second: (string, array<int>)) -...

javascript - Converting PHP Associative array to JSON object - spaces in value results in malformed JSON -

i build array in php , convert json handle onclick event , send file via ajax. the problem of values in php array have spaces in them. seems breaking json object meaning ajax call failing. here's snippet of code try , elaborate: //php array looks this: array ( [card_id] => 1 [img_id] => 11 [card_name] => layout1retro_original [card_qty] => 1 [img_thumb] => albums/160915_e165/thumbs/011_cover-lp-cd_originaldpp_polaroid.jpg [img_hires] => [img_full] => albums/160915_e165/images/011_cover-lp-cd_originaldpp_polaroid.jpg [media] => retro [finish] => perl290 [size] => original [backing] => [can_crop] => [needs_to_be_cropped] => 1 [been_cropped] => [aspect_ratio] => 0 ...

openlayers 3 - Write text in OpenLayers3 -

i need write text in openlayers 3... not label, text object, can select , drag around map. text must have multiple lines. tried use point ol.style.text, isn't multiline. tried popups, need text displayed. there way use text feature ( ol.format.textfeature )? there object can use purpose? thanks!! you can use ol.overlay that. overlay element can be. has position positioning can set @ time. see example: http://openlayers.org/en/v3.9.0/examples/overlay.html?q=overlay you use map browser events (pointerdown, pointerup) , if target overlay element move around , update position.

java - Mongo can't find document while using regex with backslash and & character -

i'm using java mongo find document in database. i'm using following code: criteria.where(fieldname).regex("astronomy \& astrophysics", "i") this string "astronomy \& astrophysics" changed in query to: astronomy \\& astrophysics there documents in database have fieldname fields equal to: astronomy \& astrophysics but document isn't returned what java code should use make code work? for work have escape backslash \ your new code should this criteria.where(fieldname).regex("astronomy \\& astrophysics", "i") see demo here https://regex101.com/r/uj0vd4/11

Parse a string in c# after reading first and last alphabet -

i want cut string in c# after reading first , last alphabet. string name = "20150910000549659abcd000007348summary.pdf"; string result = "abcd000007348"; // string name = "1234 abcd000007348 summary.pdf"; after reading 1234 "a" comes , @ last "s" comes want " abcd000007348 " simply use regex: string cutstring(string input) { match result = regex.match(input, @"[a-za-z]+[0-9]+"); return result.value; }

sql server 2008 - sql trim and replace -

can trim , replace @ same time column's name can break down in 2 parts? expected result in namel , namer name namel namer ab_1x ab 1x axg_3x axg 3x 4g_12x 4g 12x tried using query: select *, right(name, len(name)-4) namer, left(name, len(name)-4) namel mytable the problem trims this: namel ab_ axg 4g_ same namer, because i'm taking fixed size. how can eliminate "_" , achieve expected outcome? thank in advance try combination of substring , charindex functions: declare @t table(name nvarchar(10)) insert @t values ('ab_1x'), ('axg_3x'), ('4g_12x') select name, substring(name, 1, charindex('_', name) - 1) namel, substring(name, charindex('_', name) + 1, len(name)) namer @t i assume there underscore symbol in name column.

c# - Unable to populate GridViewDataTextColumn using EF DB model -

this first time working code first approach entity framework models. i'm trying populate data grid user info grid column isn't displaying info. <dx:aspxgridview id="customer_grid" runat="server" autogeneratecolumns="false" width="170px" > <columns> <dx:gridviewdatatextcolumn name="customername" visibleindex="0"> </dx:gridviewdatatextcolumn> </columns> </dx:aspxgridview> here's code behind protected void page_load(object sender, eventargs e) { if (!ispostback) { ecdevelopmententities db = new ecdevelopmententities(); customer_grid.datasource = db.customers.tolist(); customer_grid.databind(); } }

python - How to make setup.py copy data files and set environment variable to the installed data path -

i making python module (a wrapper c library) have data files needs installed package work (coefficients magnetic field model). additionally, after installation, enviroment variable needs set folder data files ended (or else c library won't work). i think have managed install data files using manifest file , include_package_data=true (the files correctly end in directory package installed, though if there better ways i'm ears). stuck on environment variable part. how can (in setup.py) directory package installed? how can reliably set permanent environment variable in setup.py across platforms? would possible work-around set environment variable @ runtime whenever package imported? find directory can use __file__ in __init.py__ , work way there, , enviromnent variables don't have stick. however, i'm not sure c extension have access environment variable defined through python wrapper. it?

.htaccess - Pointing a domain to IP and port through htaccess -

i want subdomain point ip address , port. sub.domain.com needs point 123.123.123.123:111222 i can point ip address webhosts built in dns manager, not allow me redirect port well. .htaccess specific url different port above should have seeking in term of .htaccess integration since tag .htaccess. dns manage not able redirect subdomain particular port dns manager used point subdomain particular ip address have did. port forwarding can done in iptable rules on vps/dedicated server or using .htaccess in web hosting folder assume on shared hosting rather vps/dedicated server.

numbers - Need help to round up decimals Javascript -

im trying round 2 number , adding them after. var = 12.24; var b = 12.27; i want them round 12.5 when add these 2 numbers result 12.5 + 12.5 = 25 it's same shown in answer , using different multiplier/divisor. in question, wanted nearest 10th; in question, want nearest half . instead of var num = 12.24; num = math.ceil(num * 10) / 10; alert(num); // 12.24 ...we use var num = 12.24; num = math.ceil(num * 2) / 2; alert(num); // 12.5

"Remove unnecessary usings" not working in Visual Studio 2015 -

Image
i have solution few projects. remove unnecessary usings working in projects except one. why remove unnecessary usings command not work in projects? edit - can see in before image there no remove unnecessary usings command , if try right-click in file, organize usings > remove unnecessary usings nothing. after setting project build warning level 4 remove unnecessary usings command appears , works. before: after: in build section of project properties there setting called errors , warnings should 4 .

android - GCM send message faulty fonts -

i'm creating javaserver faces project send messages android application directed in https://github.com/google/gcm . it works fine when perform modal messaging in: public static void main (string [] args) { sendmessage() } but when call method send messages web interface, message appears in android faulty vietnamese font. i think problem lies in requests send server notification. seems are encoded correct parameters. please make sure requests utf-8 encoded spaces replaced + symbol. the url encoding has % symbol or character , two-character hex value corresponding utf-8 character. may differ language language. change content type specify charset=utf-8 , encode request likewise. follow instruction on gcm docs. the http header must contain following headers: authorization: key=your_api_key content-type: application/json json; application/x-www-form-urlencoded;charset=utf-8 plain text.

opencv - Image Segmentation -

Image
so trying write code lets me segment fuses see in picture below. have come 2 approaches: 1) based on color. threshold using opencv's inrange function. approach works fuses except brown fuse. brown fuse similar in colour fusebox , therefore it's hard segment out. 2) considered thresholding image heavily can detect white points/terminals on fuses using opencv simpleblobdetector. filter out blobs distances each other. know size of fuses, can filter out invalid fuses. approach works fuses white 1 appears in thresholded images. i hoping pointer on how segment such image. background subtraction work? my experience segmentation single approach not work difficult segmentation. if 1 algorithm works brown , other white, union of 2 should yield complete result. know nice have 1 elegant algorithm, many of best results have had resort hybrid of multiple techniques. i'd consider separating channels rgb , hue, saturation, , value , looking @ each channel separatel...

ios - Swift/https: NSURLSession/NSURLConnection HTTP load failed -

unfortunately morning xcode updated version 7 , ios app developing http wants https. so, following many tutorials, configured mamp server in order use https/ssl creating dummy certificate. in ios app urls following: static var webserverloginurl = "https://localhost:443/excogitoweb/mobile/loginm.php" static var webservergetusertasks = "https://localhost:443/excogitoweb/mobile/handletasks.php" static var webservergetusers = "https://localhost:443/excogitoweb/mobile/handleusers.php" static var webservergetprojects = "https://localhost:443/excogitoweb/mobile/handleprojects.php" and work fine if try access them in browser. used access database , php files nsurlsession.sharedsession().datataskwithrequest() raises error in title. example, here's line error raised: if let responsejson: [[string: string]] = (try? nsjsonserialization.jsonobjectwithdata(data!, options: nsjsonreadingoptions())) as? [[string: string]] { ... } and complete erro...

elasticsearch - Sort not working as expected -

i having issue sorting query results. essentially, query should return events (metatype field) based on relevance , sorted date, newest first. when put sort in query, returns same exact results, regardless of query is. this query. can see i'm doing wrong here? thank in advance. "query": { "bool": { "should": [ { "match": { "sortabletitle": { "query": query, "operator": "and" }}}, { "match": { "content": { "query": query, "operator": "or" }}}, { "mat...

WARMR algorithm in ALEPH (SWI-Prolog) -

i trying use warmr find frequent relational patterns in data; using aleph in swi-prolog. however, struggling figure out how , why previous attempts did not work. i want make toy example work before move on full data. took toy "train" data aleph pack page: http://www.swi-prolog.org/pack/list?p=aleph the aleph manual states ar search: ar implements simplified form of type of association rule search conducted warmr system (see l. dehaspe, 1998, phd thesis, katholieke universitaet leuven). here, aleph finds rules cover @ least pre-specified fraction of positive examples. fraction specified parameter pos_fraction. accordingly have inserted :- set(search,ar). :- set(pos_fraction,0.01). into background file (and deleted :- set(i,2). )) , erased .n file of negative examples. have commented out determinations , modeh declaration logic being searching frequent patterns, not rules (i.e. in supervised context head "output" variable , clauses in body -- ...

Windows PowerShell out of disk space script -

this modified part of larger script removes old vhd images when there not enough disk space on f drive fit image c drive. function diskspace() { $cdisk = get-wmiobject win32_logicaldisk -filter "deviceid='c:'" | select-object size,freespace $fdisk = get-wmiobject win32_logicaldisk -filter "deviceid='f:'" | select-object size,freespace $cdiskcapacity = $cdisk.size/1073741824 $cdiskfree = $cdisk.freespace/1073741824 $cdiskused = $cdiskcapacity-$cdiskfree $fdisk = $fdisk.freespace/1073741824 return $fdisk, $cdiskused } if ($fdisk -gt $cdiskfree) { write-host "lot's of space on f: drive" } diskspace despite shows there more 1.1 tb on f drive - not show message. ps c:\users\marek> c:\backup2.ps1 1153,06732559204 221,418087005615 what's wrong ? first, suggest using different variable name here: $fdisk = $fdisk.freespace/1073741824 instead of reusing $fdisk. second, in code: if ($fdisk -gt $cdiskfree) { wr...

unity3d - Translation UnityScript to C# : Array & GetComponent -

i'm working translate unity project in unityscript c#. have translated part of project, i'm confronted problems: the first problem linked getcomponent . have file ennemycontroller.cs lot of functions get/set enemies. before of function, need initialize charactercontroller . private charactercontroller charactercontroller; charactercontroller = getcomponent<charactercontroller>(); you can see context here : http://pastebin.com/u09ah4za . if add code above in function it's working not in class... returned me following error: unityengine.component.getcomponent (string) method used type enemycontroller.charactercontroller field used type the second problem linked array in c#. more precisely array of array, unityscript this: var connected : array = array (); static var waypoints : array = array (); var objects : object [] = findobjectsoftype ( autowaypoint ); waypoints = array ( objects ); i have no idea how translate kind of thing, , can see whole file ...

scope - How to understand dynamic scoping using Python code? -

i'm programmer coming python background typically uses lexical scoping , want understand dynamic scope. i've researched on-line, still unclear me. example, i've read this page made things lot easier me, code snippets: #in dynamic scoping: const int b = 5; int foo() { int = b + 5; return a; } int bar() { int b = 2; return foo(); } int main() { foo(); // returns 10 bar(); // returns 7 return 0; } #in lexical scoping: const int b = 5; int foo() { int = b + 5; return a; } int bar() { int b = 2; return foo(); } int main() { foo(); // returns 10 bar(); // returns 10 return 0; } as understand , can see, in dynamic scoping, bar function returns 7 not 10, means foo called b variable...