Posts

Showing posts from April, 2015

google cloud messaging - XMPP connection is failing in android for GCM CCS -

i getting error while trying connect gcm ccs. java.lang.nullpointerexception: attempt invoke interface method 'org.jivesoftware.smack.packetlistener org.jivesoftware.smack.debugger.smackdebugger.getreaderlistener()' on null object reference @ org.jivesoftware.smack.xmppconnection.initconnection(xmppconnection.java:930) @ org.jivesoftware.smack.xmppconnection.connectusingconfiguration(xmppconnection.java:904) @ org.jivesoftware.smack.xmppconnection.connect(xmppconnection.java:1415) @ com.example.gcm.gcmccsclient.connect(gcmccsclient.java:270) i have searched lot didn't find solutionand not able figure out causing issue.

c - Can anyone help me with this code? -

i think logic correct it's not printing anything. code eliminate vowel string , display it. #include<stdio.h> #include<conio.h> void main() { char *str="shivank"; int i,len; char *q; clrscr(); len=strlen(str); for(i=0;i<=len;i++) { if((*str=='a')||(*str=='e')||(*str=='i')||(*str=='o')||(*str=='u')) str++; else if(*str=='\0') break; else { *q=*str; str++; q++; } } *q='\0'; puts(q); getch(); } if understand correctly, want transform "shivank" "shvnk" , , store in seperate string print later. you have allocate memory somewhere. working pointers won't work - @ best, change str point different beginning of string: "hivank" , "ivank" , "vank"

python - NLP , classify row values into some number? -

i need guidance if following possible in r/python?.my expectations or approach below wrong hence open alternatives also. my dataframe has column called product_description , contains following values. this red car red car yellow stripe ball dont know hello, mad? white car truck 1234-4568-8999 i process text column generate numeric equivalent text can filter rows similar in texts acceptable tolerances. numeric range 1-5 red car red car yellow stripe white car numeric range 6-10 ball truck numeric range 10-100 dont know hello, mad? numeric range 500+ 1234-4568-8999 what have tried far? bag-of-words unique words, assign index number , sum number per row. fails depending on index number value. guess if use decimal of each character not work. have not tried yet. thanks vinay

Julia: Search string vector for a character and add that character -

i want detect if character exists in vector of strings , if not add end. mystrings = ["asfs", "asfsaf", "sfas.sdg", "dsgsd", "sdgsd."] i=1:length(mystrings) if !contains(mystrings[i],".") mystrings[i] = mystrings[i] * "." end end the above works. writing more ask, if should have instead used kind of broadcasting or if ideal solution. i don't think there's wrong code posted. broadcasting solution might like mystrings .= (x->contains(x, '.') ? x : x*".").(mystrings) or if prefer map style map!(x->contains(x, '.') ? x : x*".", mystrings, mystrings) both (and solution well) avoid allocation modifying array.

python - How to generate n-level hierarchical JSON from pandas DataFrame? -

Image
is there efficient way create hierarchical json (n-levels deep) parent values keys , not variable label? i.e: {"2017-12-31": {"junior": {"electronics": {"a": {"sales": 0.440755 } }, {"b": {"sales": -3.230951 } } }, ...etc... }, ...etc... }, ...etc... 1. testing dataframe: colindex=pd.multiindex.from_product([['new york','paris'], ['electronics','household'], ['a','b','c'], ['junior','senior']], names=['city','department','team','job role']) rowindex=pd.date_range('25-12-2017',periods=12,freq='d') df1=pd.datafram

batch file - How to "replace" Command Prompt in Windows 8.1? -

i have batch script in startup folder begins chcp 65001. crash cmd after first command after chcp won't crash conemu. so how make run in conemu instead of cmd after logon? did read docs ? conemu64.exe -run "path-to-your-batch.cmd"

javascript - babel-polyfill messed with Object in IE11 -

Image
i have 1-year-old react app server render had been in production while, however, detected couple of days before somehow, app stop work ie11. weird because have been tested on ie11 many times , worked before. try roll project (using tagged docker image) , error still appears. the root cause appears in babel-polyfill somehow change way object created in ie11. the created object have jscomp_symbol_symbol.tostringtag1" array iterator" here's found on console: try input console.log({}) if have ie11 output differently. this somehow causing web app fail since every object fail lodash _.isplainobject condition inside redux .

Any URL-Shorteners there, creating with GET request? -

are there simple methods shorten urls simple call, there exist this? (with solid providers). bit.ly/?create=http://example.com and shortened urls directly, simple call that.. (p.s. trying avoid "goo.gl chrome extension" or etc, that's why want simple-call method).

javascript - How to use a complex key with IDBObjectStore.delete -

i need delete data , i'm trying use idbobjectstore.delete(id). problem id need pass in complex key (i.e. ["first_id", "second_id"]). seems sort of silently fails , i'm not sure what's going on. does know how use delete function complex key? in advance!

node.js - Cannot Launch and Debug TypeScript Using Node -

we're setting new osx machine , getting message when trying launch , debug typescript based node app: cannot launch program '/projects/is/0.0.34/server/server/server.ts'; setting 'outdir or outfiles' attribute might help. we've been using same launch config on year , we're not writing output separate directory, there should no need set 'outfiles'. program runs fine command prompt. however, trying launch app in vscode returning error above. did upgraded node v8.5.0 v7.3.0. based on docs should still work. other posts regarding issue relate issues resulting writing source (and sourcemaps) different directory. launch.json { "configurations": [ { "name": "launch program", "type": "node", "request": "launch", "program": "${workspaceroot}/server/server.ts", "cwd": "

powershell - Poweshell get file with last date included -

i have saved file : get-childitem -path $ospathtemp | rename-item -newname { $_.basename + '_' + $_.lastwritetime.tostring('ddmmyyyy') + $_.extension } how can select file again ? tried : $path = "\\srvsccm01\_source$\os\refws2016" + '_' + { $_.lastwritetime } + $_.extension the file named: refws2016_xxxxx.wim simple enough... add -passthru rename-item , save result in variable. $file = get-childitem -path $ospathtemp | rename-item -newname { $_.basename + '_' + $_.lastwritetime.tostring('ddmmyyyy') + $_.extension } -passthru then reference $file .

compiler errors - Maven - type javax.persistence.InheritanceType cannot be resolved. It is indirectly referenced from required .class files -

i'm facing this these maven config: apache maven 2.2.1 (r801777; 2009-08-06 16:16:01-0300) java version: 1.6.0_45 java home: c:\program files\java\jdk1.6.0_45\jre default locale: pt_br, platform encoding: cp1252 os name: "windows 7" version: "6.1" arch: "amd64" family: "windows" i've added dependency <dependency> <groupid>com.da.fra</groupid> <artifactid>da-fra-menu-java</artifactid> <version>${pom.version}</version> <scope>provided</scope> </dependency> and error came up: type javax.persistence.inheritancetype cannot resolved. indirectly referenced required .class files i've run mvn:dependency-tree @ project "da-fra-menu-java" , surprise, project needs persistence-api.jar. 1st question: why didn't appear when run mvn dependency:tree in project? in order find solution i've included @ pom <dependency> <groupi

PHP DatePeriod error when using DateInterval to loop over months -

i using dateinterval object loop on months. when running following code below: $interval = new dateinterval('p1m'); $daterange = new dateperiod('2017-08-01', $interval , '2017-10-01'); foreach($daterange $d){ $start_date = $d->format("y-m-d"); echo $start_date; } //expected output: // 2017-08-01 // 2017-09-01 gives following error: fatal error: uncaught exception 'exception' message 'dateperiod::__construct(): constructor accepts either (datetimeinterface, dateinterval, int) or (datetimeinterface, dateinterval, datetime) or (string) arguments.' in c:.. stack trace: #0 c:\..: dateperiod->__construct('2017-08-01', object(dateinterval), '2017-10-01') #1 {main} thrown in c:\.. how can expected output? the dateperiod constructor not used correctly. see official reference dateperiod . try this: $daterange = new dateperiod( new datetime('2017-08-01'), $interval , ne

javascript - The picture I draw is invisible after I reset the width and height of the canvas -

in js file: function main_part2() { var canvas = document.getelementbyid("viewport"); var context = canvas.getcontext("2d"); var eye = new vector(0.5, 0.5, -0.5); raycasting(context, eye, part2); } function change_size() { var canvas = document.getelementbyid("viewport"); var width = document.getelementbyid("width").value; var height = document.getelementbyid("height").value; canvas.width = width; canvas.height = height; main_part2(); } in html file: <body onload="main_part2();"> <canvas id="viewport" width="512" height="512" style="background-color: black"></canvas><br><br> <label for="width">width: </label><input id="width" type="number"><br><br> <label for="height">height: </label><input id="height" type="n

r - Package that suggests `parallel` fails compile in windows -

i developing package suggests r's parallel package (so description has suggests: parallel (>= 1.13.1) statement. compiles fine under osx , linux fails when building on windows (using win-builder ). here end of install.log win-builder spits out: *** installing indices ** building package indices ** installing vignettes ** testing if installed package can loaded *** arch - i386 error: package or namespace load failed 'spectrolab' in library.dynam(lib, package, package.lib): dll 'parallel' not found: maybe not installed architecture? error: loading failed execution halted *** arch - x64 error: loading failed 'i386' * removing 'd:/rcompile/cranguest/r-devel/lib/spectrolab' find full output win-builder here https://win-builder.r-project.org/4k9qc0st397h/ there 1 function tries use parallel . goes more or less this: #' smooth spline functions spectra #' ... roxygen stuff ... #' @importfrom stats smooth.spline #' @importfr

typescript - "Error: Debug Failure. False expression: Output generation failed" when Importing Custom Declarations File in Angular 2 Service -

i have old, yucky javascript file full of stuff need make available angular service, , cannot figure out how it. i'm suprised @ how hard find tutorial this. maybe i'm out of loop don't know how ask question... i've created declaration file (let's it's called oldstuff.d.ts ). clarification: declaration file only. actual code lives in different file: oldstuff.js at top of angular service, i'm importing declaration file this: import './oldstuff.d'; i not doing else anywhere in application attempt declaration file included. this import enough vs code recognize definitions, , intellisense working expect. in fact, can use angular cli build project, , seems build ok. however , try inject service constructor elsewhere in application, build fails following error: error in ./src/app/oldstuff.d.ts module build failed: error: debug failure. false expression: output generation failed @ object.assert (c:\projects\angular\myapp\node_modul

php - JQuery upload fails only on big files? -

i want upload mp3 files jquery. works fine on normal tracks. if want upload mixes, big files > 100mb, upload fails. this function uploading: $(document).ready(function() { $('#upfile').on('change', function() { $('#btnsubmit').fadein(); }); $('#uploadform').submit(function(e) { if($('#upfile').val()) { e.preventdefault(); $('#btnsubmit').fadeout(); $('#progress-div').fadein(); $(this).ajaxsubmit({ beforesubmit: function() { $("#progress-bar").width('0%'); }, uploadprogress: function (event, position, total, percentcomplete) { $("#progress-bar").width(percentcomplete + '%'); $("#progress-bar").html('<div id="progress-status"&

vba - Reply with To Recipient Names in Greeting and Body -

i created macro replies sender first name added greeting, adds text body, , adds signature in fonts want. now want pull of names of recipients, assigning value them can place elsewhere in body of email. if not done, settle getting of names greeting, though preferred able move names around. i can pull of names. need exclude names, such in cc line of original email. take names line , place them in body, means assigning them value. here whole macro runs now. pulls names , adds them, including in cc of original email. puts in body , signature, main concern being able separate recipients ccs , being able place them elsewhere in body. sub autoaddgreetingtoreply() dim omail mailitem dim oreply mailitem dim greettime string dim strbody string dim sigstring string dim signature string dim strgreetnameall string dim lastname string dim strgreetname string dim long select case application.activewindow.class case olinspector set omail = activeinspector.currenti

uml - Use case documentation with dynamic fields -

i have describe use case scenario window in system. in window have dynamic fields, example: onchange in field makes show field (in case field same type "upload") . how can describe in documentation? maybe anology be: "a select many options selected in ". hope understandable.

box api - Box API Slow Search Performance -

we have enterprise box account 17k files. using search endpoint takes 5-6 seconds retrieve first set of results query (see below). https://api.box.com/2.0/search?query=fees&file_extensions=pdf&content_types=file_content&type=file&limit=200&offset=0 can done improve performance, or typical response time? noticed when using box website (see below), appears quicker 2-3 seconds. https://app.box.com/folder/0/search?query=fees&pagesize=20&sortdirection=desc&types=pdf&kinds=file_content&metadata=&folderid=0 in addition, in website search results there extract highlighting, possible through api? there field can requested information? edit - was able improve time using fields parameter, still 4-5 seconds retrieve first 200 matches. fields=name,size,path_collection,created_at,modified_at

html - Can I set the window.print settings with javascript? -

i working on creating printable document html page output large. don't want have restyle page work printing (ie. print media queries again), wondering if there way can change window.print (or window print dialog) settings. i have figured out setting scale equal 80% generates pdf; however, don't want people have remember this. there way in chrome? i have tried adjusting browser page zoom leads same behaviour (squished content) covers portion of page. technique based on question: force page zoom @ 100% js . also, have tried adjusting body scale transform: scale(0.8); , no avail. resulted in large amount of whitespace around elements in pdf couldn't remove.

javascript - jQuery add dynamic content from one element to another element -

i'm adding livechat website, problem have adds dynamic onclick page gets blocked csp policy. i have managed work around removing dynamic code , adding own. what cannot figure out how grab link id can either id="online-icon" or id="offline-icon" , span class lhc-text-status text client-side not strong point, apologies if code below mess, can adding above id code. $(document).ready(function () { $('body').on('click', '.status-icon', function () { $(this).closest('#lhc_status_container').remove(); $('<div id="lhc_status_container">' + '<a id="need add status here" class="status-icon" href="#">' + '<span class="lhc-text-status">and here</span>' + '</a>' + '</div>').appendto("#livechatcase"); $("#onlin

latex - define image as newcommand -

Image
i'm trying set image (canadian flag) command in latex résumé project. beginner in latex , i'm trying replicate command definition based on fontawesome package (pre-define images), integrating image. here's original command works (faat comes fontawesome package): \newcommand{\emailsymbol}{\faat} \newcommand{\email}[1]{\printinfo{\emailsymbol}{#1}} here's try doesn't work: \newcommand{\canflag}{\def\@canada.png} \newcommand{\canadaflag}[1]{\printinfo{\canflag}{#1}} any idea on how achieve i'm trying do? you can graphicx package achieve this \documentclass[12pt]{article} \usepackage{graphicx} \newcommand\canadaflag{\includegraphics[height=8pt]{flag}} \begin{document} \section{before start} \canadaflag using... \end{document}

Django admin inlines with different readonly fields -

say have model inlines in django admin. how can make fields(of inline) readonly if inline object exists editable new instances? for example if model has related comments, wont let existing comments editable, possible create new (from inline admin).

inotifywait - Why does this simple email script sends two emails every time -

why script send 2 emails instead of one? #!/bin/sh monitordir="/path/to/directory" inotifywait -m -r -e create --format '%w%f' "${monitordir}" | while read newfile [ -z "${newfile}" ] && : || movie=$(find "$newfile" -type f -not -name ".*" \( -iname "*.mkv" -o -iname "*.mp4" -o -iname "*.avi" \) -exec basename {} \; | sed 's/\.[^.]*$//') [ -z "${movie}" ] && : || echo "please don't reply automatically generated email message." | mail -s "$movie on plex!" "email1@gmail.com,email2@gmail.com" done

suppress logging in spring batch 3 -

i writing spring-batch application, based on example found. when run in eclipse, produces annoying info logs deep inside framework. i'd suppress that, system.out statements show - clarity. i figured logging inherited commons-logging1.1.1.jar , that's in classpath, because when take out reference errors logger. question1: framework used logging in sample application , how can change default info warn? question2: adopting log4j override default behavior? i've create 2 property files under /resources: commons-logging.properties, this: org.apache.commons.logging.log=org.apache.commons.logging.im‌​pl.simplelog, , simplelog.properties, this: org.apache.commons.logging.simplelog.defaultlog=warn worked. - –

MySQL - order by two columns with condition -

i have data in mysql table. need order results condition: if effective_to null , show first , order effective_from desc if effective_to not null , order effective_to desc my data name effective_from effective_to person 01 1999-04-01 1999-05-31 person 02 1999-04-01 2000-07-06 person 03 1999-04-01 2000-09-25 person 04 1999-04-01 2000-09-25 person 07 1999-04-01 2000-09-25 person 05 2013-04-29 null person 08 2010-06-17 2012-09-27 person 09 2010-12-02 2012-09-27 person 10 2017-02-10 null person 11 2017-02-10 null person 12 1999-04-01 2000-07-06 person 13 2011-04-28 2015-10-06 person 05 2013-04-29 2017-02-15 person 06 2015-09-22 2017-02-15 person 06 2015-09-22 2017-02-10 i need results order name effective_from effectiv

angular - subscribing to BeahviorSubject in app.component constructor only triggers on first app load -

using angular2 in ionic 3 project: i need change menu in app.component based on user subscription plan. in order after login, have currentuser$ asobservable of behaviorsubject. code setup: app.component.ts -> constructor: this._authprovider.currentuser$ .subscribe(currentuser => { //this._accountsandsettings = accountsandsettings triggered++; console.log('triggered', triggered); if (currentuser.license === "agency") { this._isagency = true; }; ._menucontroller .enable(true); this._rootpage = "maintabspage"; }, accountsandsettingserror => { //display alertcontroller , call platform.ready() this._rootpage = "authloginpage"; }); loginpage.ts - >login: private _login(): void { //check missing credentials if (this._loginform.invalid) { //alert pop-up let missingcredentialsalert = ._alertcontroller .create({ message: "some credentials missin

Android JSON makeHttpRequest return null on mobile data -

i have app access json data website. app works fine on wifi , mobile data on phone , phones tested. however, users having problem on mobile data. when use wifi, works fine, doesn't work on mobile data. here's code getting json data. list<namevaluepair> params = new arraylist<namevaluepair>(); // getting json string url jsonobject json = jparser.makehttprequest(url, "get", params); it seems json returns null mobile data on phones. i'm not sure why. here's class json parsers public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } // function json url // making http post or mehtod public jsonobject makehttprequest(string url, string method, list<namevaluepair> params) { // making http request try { // check request method if(method == "post"){ // r

Python looking to find an easier way to shorten my .casefold().count() -

my python code running fine code looks bit tedious , messy. wondering if there easier way write it. have text file , required find if letters 'aardvark' can found inside line. if i.casefold().count('a') >= 3 , i.casefold().count('r') >= 2 , i.casefold().count('d') >= 1 , i.casefold().count('v') >= 1 , i.casefold().count('k') >=1: if all( i.casefold().count(letter) >= 'aardvark'.count(letter) letter in 'aardvark') kinda silly solution works

java - Use variable in AdminApp.update() function in WAS wsadmin -

i developing automatic deploy web app uses websphere application server (was) application server. using wsadmin features deploy file automatically. using jython version of wsadmin. able deploy using static version of command, having content argument constant. turns out content argument needs variable because file have different name every time deploy. want able use command follow: file_name_var = /path/to/file adminapp.update('myapp', 'file', '[-operation add -contents file_name_var -contenturi meta-inf/web.xml]') do guys have idea of how can accomplish it? have tried few intuitive declarations variable inside update function, hasnt worked

node.js - Nodejs read stdout of some process and do stuff -

i want read stdout of process nodejs, in windows. so far got this: i simulate process output : ping -t google.com > ping.txt the ping output dumped in ping.txt file. file watched in node changes. so, in nodejs got code: var filename = 'ping.txt'; var fs = require("fs"); fs.watch(filename, function (event, filename) { if (event == 'change') { console.log('change', filename); fs.stat(filename, function (err, stats) { console.log('size ', stats.size); if(stats.size > 500){ fs.truncate(filename,10,function(){ console.log("truncated"); }); } }) } }); but nodejs output: size 0 change ping.txt size 192 change ping.txt size 253 change ping.txt size 375 change ping.txt size 436 change ping.txt size 559 truncated change ping.txt size 620 truncated change ping.tx

Error initialising SparkContext, running Spark on windows -

setting default log level "warn". adjust logging level use sc.setloglevel(newlevel). warn nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable error sparkcontext: error initializing sparkcontext. java.net.socketexception: permission denied: listen @ sun.nio.ch.net.listen(native method) @ sun.nio.ch.serversocketchannelimpl.bind(serversocketchannelimpl.java:224)

dateformatter - Formatting Highchart dateime time categories -

can please tell me how specify format categories in following code. why xaxis categories in milliseconds getting converted "1970-01-01 00:00:00" here link fiddler var chart = new highcharts.chart({ chart: { renderto: 'container' }, title: { text: 'categorized chart' }, xaxis: { categories: [1496275200000,1498867200000,1501545600000,1504224000000], type : 'datetime' }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); $('#preview').html(chart.getcsv()); take idea official example your code xaxis: { //categories: [1496275200000,1498867200000,1501545600000,1504224000000], type : 'datetime' }, series: [{ data: [[1496275200000,29.9],[1498867200000,71.5],[1501545600000,106.4] , [1504224000000,129.2]] }] fiddle demo

javascript - Vanilla JS mobile menu works on chrome but not on Firefox or Edge (no toggling) -

i use following code in site display mobile menu in viewports equal to, or under 768px. the code works fine in chrome not in firefox , edge, where, after resizing, menu won't open (no toggling). why? document.addeventlistener('domcontentloaded', ()=>{ let clicks = 0; let menu = document.queryselector('#menu-mainmenu'); // menu identifier. let menubutton = document.queryselector('.menubutton'); // button class in pagebuilder. let mobilebehavior = ()=>{ menu.style.display = 'none'; menubutton.addeventlistener('click', ()=>{ clicks++; if (clicks % 2) { menu.style.display = 'block'; } else { menu.style.display = 'none'; } }); }; if (window.innerwidth <= 768) { mobilebehavior(); } // event cleanups: window.addeventlistener('resize', ()=>{ if

scala - what's the means of compile:fastOptJS::artifactPath in sbt's scalajs task? -

i'm fresh scala.js. problem not specify stage i'm encountering puzzle of sbt's scope relative concept. i'm learning scalajs sbt. package js sbt fastoptjs task. inspect fastoptjs , there many dependencies defined, such compile:fastoptjs::artifactpath one. document , task defined under scope {<build-uri>}<project-id>/config:intask::key full name. both compile , fastoptjs task , compile configration definition. how should understand define of compile:fastoptjs::artifactpath ? thanks lot.

c++ - unknown function already exists error -

i have strange error when compiled code says member function alreadys exist within classes not error says error lnk2005 "public: void __thiscall membershiptype::print(void)" (?print@membershiptype@@qaexxz) defined in persontype.obj project1 c:\users\okpal\source\repos\project1\project1\source.obj and also error lnk1169 1 or more multiply defined symbols found project1 c:\users\okpal\source\repos\project1\debug\project1.exe 1 i wondering if figure out error class code below #include <iostream> #include <string> using namespace std; class addresstype { //class defintions , prototypes member variables public: addresstype(); string streetaddressnum, streetname, streettype, city, stateinitials; int zipcode; }; class persontype { public: persontype(); string firstname; string lastname; int personnum; char gender; int personid; addresstype address; void setinterest1(string interest1);//muta

XCGLogger Incomplete output to Xcode console -

using 5.0.1' clipped logs on xcode console e.g. if try print long json (with method: info, debug, error, etc). see paragraph of content never end of json. i'm printing both: file , xcode console. can see full json in file not in xcode console

python - Static Ports In Django w/ Visual Studio -

has found out way have visual studio run django app on static port rather changing ports every run? have separate program sending requests server becomes hassle having change port every time re run server. thanks in advance direction on subject.

How to binding C array type in objective-c library using Objective Sharpie? -

the method need bind have argument in primitive array example: (bool)isrectangle:(const cgpoint[4])corners; how bind const cgpoint[4] type c# type? note: using sharpie, result below [static] [export("isrectangle:")] void isrectangle(cgpoint[] corners); and when build it, got error cannot convert 'coregraphics.cgpoint[]' 'foundation.nsobject' define const cgpoint[4] struct in structsandenums.cs : [structlayout(layoutkind.sequential)] public struct rectangle { public cgpoint lefttop; public cgpoint righttop; public cgpoint leftbotton; public cgpoint rightbotton; } your definition becomes: //(bool)isrectangle:(const cgpoint[4])corners; [export("isrectangle:")] bool isrectangle(rectangle corners);

javascript - Website Scrape, Grep by Text, IP Rotate, Accessible via HTTP-Call -

create script can accessed via http call fetches content of url, searches string in content , returns whether content part of website or not. output: • server-side script / application can: ◦ installed on linux server ◦ server can scaled horizontally load balancer in front • delivered zip package installation / execute instructions

truststore - How to use confluent-kafka with the key store file -

when use key store file, add property ssl.keystore.location ssl.keystore.password ssl.key.password ssl.truststore.location ssl.truststore.password in config, throws error: can not find property ssl.truststore.location" how can use librdkafka key store file? troubles me, 1 know how use confluent-kafka key store file? confluent-kafka: https://github.com/confluentinc/confluent-kafka-dotnet/ follow configuration.md: https://github.com/edenhill/librdkafka/blob/master/configuration.md i can not find property in configuration.md ssl.keystore.* , ssl.truststore.* java client properties, make use of java's jaas framework , java-specific trust/keystores. librdkafka (and sibling clients) makes use of openssl uses pem , cert file formats. see guide how set up: https://github.com/edenhill/librdkafka/wiki/using-ssl-with-librdkafka and question explains how convert keystores openssl file types: converting java keystore pem format

java - Sending test emails with Google AppEngine dev server -

i'm developing application send out notification emails , i'd perform end-to-end testing on email before deploy capability. end, i've got dummy smtp service running on development machine accepts incoming mail , stores in single box pop client can access, no matter sender , receiver are. i've used other applications make sure emails sent, they're readable various clients, , on. see that, default, there com.google.appengine.api.mail.mailservice application code can call send messages and, in real environment, sends email. however, in dev environment, mail seems dropped on floor. see log messages worker threads this: sep 13, 2017 9:05:38 pm com.google.appengine.api.mail.dev.localmailservice log info: mailservice.send sep 13, 2017 9:05:38 pm com.google.appengine.api.mail.dev.localmailservice log info: from: myapp <myapp-sender@myapp.appspotmail.com> sep 13, 2017 9:05:38 pm com.google.appengine.api.mail.dev.localmailservice log info: to: recipient <us

javascript - Custom colors in C3.js timeseries chart -

i trying set custom colors in c3.js timeseries chart following this example . first element of each array used identify dataset, if have array: var datatest1 = ['data1', 30, 200, 100, 400, 150, 250]; the color property can accessed this: colors: {data1:'#0000'} or: colors: {'data1':'#0000'} however, if use first element of array access them: var data1id = datatest1[0]; and then: colors: {data1id:'#0000'} it fails. not sure may doing wrong no feedback in browser... here working example: var axis = ['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06']; var datatest2 = ['data2', 130, 340, 200, 500, 250, 350]; var datatest1 = ['data1', 30, 200, 100, 400, 150, 250]; var data1id = datatest1[0]; var data2id = datatest2[0]; var chart = c3.generate({ data: { x: 'x', columns: [

java - Change JCombobox item color when choose by keyboard or mouse -

Image
normally when choose items in jcombobox mouse or keyborad , down keys, background of item 'blue' color. i want change color blue other color follows. another option use jlist#setselectionbackground(color) . import java.awt.*; import javax.accessibility.accessiblecontext; import javax.swing.*; import javax.swing.plaf.basic.basiccombopopup; public class combotest { public jcomponent makeui() { // test: // uimanager.put("combobox.selectionbackground", color.green); // uimanager.put("combobox.selectionforeground", color.cyan); string[] model = {"male", "female"}; jcombobox<string> combo1 = new jcombobox<>(model); accessiblecontext ac = combo1.getaccessiblecontext(); basiccombopopup pop = (basiccombopopup) ac.getaccessiblechild(0); jlist list = pop.getlist(); list.setselectionforeground(color.white); list.setselectionbackground(color.orange); // ???: focus bo

Is there a way to validate oauth token sent by approuter in plain java application ( micro service in cloud foundry ) without using spring -

i have approuter written in node.js sends jwt token java application after user authentication. i need verify token , scope in spring application before executing rest api, there way same thing without using spring feature? one option use /check_token endpoint of uaa. nice thing approach it's pretty easy without of external libraries since it's matter of sending http request. there's no crypto (other tls) required, uaa handles you. however, require client credentials can identify application checking token uaa , has overhead of sending http request. ex: curl 'http://uaa.example.com/check_token' -i -u 'app:appclientsecret' -x post \ -d 'token=53dbe3e05dcf4ff38d350bc74a7fc97bscopes=password.write%2cscim.userids' where app , appclientsecret app's client credentials & scopes attribute optional, if include it, uaa validate scopes indicate present on token. more @ following links: https://github.com/cloudfoundry

linux - C Language Cat Program that Opens File from User Input -

basically program trying implement simple c version of unix cat command. display 1 file , if done correctly should able execute on command line single command line argument consisting of name of needs displayed. of questions have tried @ reference "how continuously write file user input? c language", "create file user input", , "fully opening file in c language". these, however, did not me since 1 wanted open file when selected cursor, other in language, , final 1 bit hard follow since i'm not @ level yet. below code far , if able lend me advice i'd appreciate it! #include <stdio.h> #include <stdlib.h> #define max_len 30 int main (int argc, char** argv) { file *stream; char filename[max_len]; printf("file name: "); scanf("%s", filename); stream = fopen(filename, "r"); while(1) { fgets(stream); if(!feof(stream)) { printf("%s",

android - How to customize spinner box? -

Image
i want spinner dropdown below images, i created below this xml layout: <spinner android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="20dp" android:background="@drawable/edittext_shape" android:padding="10dp" android:paddingleft="4dp" android:id="@+id/rol_type" android:layout_marginbottom="2dp"> spinner shape <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item><layer-list> <item><shape> <gradient android:angle="90" android:startcolor="@color/white" android:endcolor="@color/app

php - Resourcespace - Image should not displayed using URL after logout from panel -

i have setup of resourcespace in local system , working fine. but after logout resourcespace panel, if access image through url in browser, gets open , displayed. what solution image should not open after user logout resourcespace. image must open when user logged in otherwise not.

javascript - can't get fonts using this function -

@return void getall: function(filters) { var self = this, cached = localstorage.get('googlefonts'), key = $rootscope.keys['google_fonts']; if (cached) { self.paginator.sourceitems = cached; return filters ? self.paginator.filter(filters) : self.paginator.start(cached); } $http.get('https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key='+key) .success(function(data) { localstorage.set('googlefonts', data.items); self.paginator.sourceitems = data.items; filters ? self.paginator.filter(filters) : self.paginator.start(data.items); }); }, /** * load given google fonts dom. * * @param {mixed} names * @return void */ load: function(names) { var head = $('head'); $rootscope.loading = true; //make array of fon

.net - Odata Integration Services -

Image
i working in integartion d365 ax7 in visual studio using odata services. getting error in authenticating services: i don't know reason error occurs.

indexing - how to find index of duplicated word in python -

i write code in python import re text = input('please enter text: ') word = re.findall('\w+', text) len_word = len(word) word_pos = [] in range(len_word): if text.index(word[i]) in word_pos: prev_index = text.index(word[i]) + 1 last_index = 0 # print('index1: ' , last_index) text = text[prev_index:] # print('new_text: ' , new_text) word_pos.append(text.index(word[i]) + prev_index + last_index) last_index += prev_index else: word_pos.append(text.index(word[i])) print(word_pos) and output of input: a , is: [0 , 2] , , correct , in siguation: a , answer : [0 , 2 , 1] , want see : [0 , 2 , 4] , , want dynamic code because don't know when duplacated word input. , if there solution want more duplicated word index thanks you can that: import re text = input('please enter text: ') words = re.findall('\w+', text) word_pos = [] pos = 0 # track wo

javascript - Make a p element both content editable and JQuery UI Sortable -

is possible make p element both content editable , jquery ui sortable? in simple example below, p elements sortable cannot edit text. there anyway overcome this? note have tried nesting p 's in containers container sortable , p editable still cannot edit inner p . $(document).ready(function() { $( ".elements" ).sortable({ connectwith: ".elements" }); }); p { height: 100px; background-color: red; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <script type="text/javascript" src="../dist/js/visual-designer.min.js"></script> <div class="elements"> <p id="foo" contenteditable="true">foo. help! can sorted cannot edited.</p> <!-- if nest p's in containe

php - How to clear magento 2 object instance? -

i have product collection using below code. $productcollection = $url->create('magento\catalog\model\resourcemodel\product\collectionfactory'); $collection = $productcollection->create()->addattributetoselect('*')->load(); using above code have tried insert attribute value. using below code have insert attribute code. $product_coll->load($_product->getid())->setdata('view_page_product', $more_set_ids)->save(); but faced 1 issue. automatically product blank attribute value use above product data. ex. product id : 4,5 4 product attribute: dimension: 15w * 14h 5 product attribute: dimension: "blank" i have run script 4 product dimension automatically insert in product 5. so please tell me solution. how fix issue. thanks :)

python - Django sending Email confusion -

i've used 1 application sending email user notification. in application setting.py file contains confusing terms in setting file email_use_tls = true i'm not sure , email_host = 'smtp.gmail.com' email_host_user = 'rquest186@gmail.com' what variety in two and if host declared here mail.py def send_mail(title,message,reciver): try: mails = 'smtp.gmail.com' mailp = 587 mailusr = "idefusiontest2015@gmail.com" mailpass = "********" # create text/plain message msg = mimemultipart('alternative') msg['subject'] = title msg['from'] = mailusr msg['to'] = reciver html="<html><head></head><body><p>"+message.replace("\n","<br>")+"</p></body></html>" part2 = mimetext(html, 'html') msg.