Posts

Showing posts from January, 2012

java netty as tcpServer,delphi TIdTCPClient as tcpClient -

i use java netty tcpserver , delphi tidtcpclient tcpclient.the tcpclient can connect , send message tcpserver tcpclinet can not receive message sendback tcpserver . here tcpserver code written java: public class nettyserver { public static void main(string[] args) throws interruptedexception { eventloopgroup bossgroup = new nioeventloopgroup(); eventloopgroup workergroup = new nioeventloopgroup(); try { serverbootstrap b = new serverbootstrap(); b.group(bossgroup, workergroup) .channel(nioserversocketchannel.class) .childhandler(new channelinitializer<socketchannel>() { @override public void initchannel(socketchannel ch) throws exception { ch.pipeline().addlast(new tcpserverhandler()); } }); channelfuture f = b.bind(8080).sync(); f.channel().closefuture().sync(); } {

android - check the cellphone setting permission under API level 23 -

how can check permission under api level 23,in presence of cellphone setting gives rejected permission. example,even camera permission rejected,though can take photo in app enter image description here

Django Views---can't see the URL correctly -

inside app called batches, have set different url patterns. have 3 urls batches, individuals , business names. seems when goind last 2 seeying info batches time. inside app-batches have 3 tables/classes. please see url pattern of website: urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^batches/', include('batches.urls')), url(r'^screenings/', include('screenings.urls')), url(r'^individuals/', include('batches.urls')), url(r'^businessnames', include('batches.urls')), ] this have in viewes: from __future__ import unicode_literals .models import businessname .models import individuals .models import batches django.shortcuts import render django.http import httpresponse # create views here. def index(request): all_batches = batches.objects.all() html = '' batch in all_batches: url = '/batches/' + str(batch.id) + '/' html += &

c++ - How can I reshape a Mat 2D to vector<vector<Mat>>? -

i convert mat dimensions [2000][256] , want convert vector<vector<mat> > dimensions [256][20][10][10]. in matlab, possible reshape(mat2d, 10, 10, 20, 256) ; same here. i found 1 solution: vector<vector<mat>> reshape2d4d(mat &a, int dim1, int dim2, int dim3, int dim4) { vector<vector<mat>> b; (int = 0; i<dim1; i++) { b.push_back(vector<mat>()); (int j = 0; j<dim2; j++) b[i].push_back(mat(dim3, dim4, cv_64f, scalar::all(1))); } mat in = a.reshape(1, 1); mat subimg; (int = 0; < 256; i++) { (int j = 0; j < 20; j++) { subimg = in(cv::range(0, 1), cv::range(100*j, 100*j + 100)); subimg.reshape(10, 10); b[i][j] = subimg; } } return b; }

node.js - Can't access Mongo from Node container running in Istio -

i'm trying run stateful mongo inside kubernetes , works these configurations outside of istio. mongodb: { uri: "mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo", dbname: "app" } but when run node application inside istio, loses ability connect mongo. there i'm missing or can't use stateful-sets istio yet? stateful mongo config below. apiversion: v1 kind: service metadata: labels: service: mongo name: mongo spec: ports: - name: tcp port: 27017 targetport: 27017 clusterip: none selector: service: mongo role: mongo *********** apiversion: apps/v1beta1 kind: statefulset metadata: name: mongo spec: servicename: "mongo" replicas: 3 template: metadata: labels: role: mongo environment: test service: mongo spec: terminationgraceperiodseconds: 10 containers: - name: mongo image: mongo:3.4.6 resources:

javascript - ToggleFade an element with display:none? -

i'm trying toggle fade login box when 'login' button pressed. until 'login' button pressed want box hidden display: none can't seen or interacted (i wasn't sure if having no visibility prevent buttons being clicked - maybe pointer events altered though). the toggle works fine except first time button pressed in hide class removed (displaying box) toggle fades out box. html: <a id="loginbtn" class="loginbtn" href="/">login</a> <div id="logincontainer" class="logincontainer hide"> <a class="registerbtn" href="/">register</a> </div> css: .loginbtn { color: #1493d1; background: #fff; border-radius: 98px; cursor: pointer; margin: 15px 0 0 0; padding: 8px 15px; position: absolute; right: 0px; /*float: right;*/ text-decoration: none; } .logincontainer { width: 175px; height: 250px; backgrou

javascript - js upload file - No files were uploaded -

i uploading image file on server-side , script give error error: "no files uploaded." <form enctype="multipart/form-data" method="post"> <input name="file" type="file"/> <input class="btn btn-warning" type="button" value="upload"/> </form> js code $(':button').click(function () { var formdata = new formdata($('form')); $.ajax({ url: "/files/create", type: 'post', success: completehandler, data: formdata, cache: false, contenttype: false, processdata: false }); console.log(formdata); }); function completehandler() { console.log("complete success"); } have idea? can connected? try this: //html part <form enctype="multipart/form-data" method="post"> <input name="file" type="file"/

jquery ui - Is there any JQUERYUI grid and snap functionality in Kendo Ui? -

i want know there functionality in kendoui draggable in can define intervals jquery draggable grid functionality ? done using jquery ui how can achieve in kendoui draggable $('#box-2').draggable({ grid: [ 20,20 ] }); here jsfiddle for jqueryui demo

python - How to start a Scrapy spider from another one -

i have 2 spiders in 1 scrapy project. spider1 crawls list of page or entire website , analyzes content. spider2 uses splash fetch urls on google , pass list spider1. so, spider1 crawls , analyze content , can used without being called spider2 # coding: utf8 scrapy.spiders import crawlspider import scrapy class spider1(scrapy.spider): name = "spider1" tokens = [] query = '' def __init__(self, *args, **kwargs): ''' spider works 2 modes, if 1 url crawls entire website, if list of urls analyze page ''' super(spider1, self).__init__(*args, **kwargs) start_url = kwargs.get('start_url') or '' start_urls = kwargs.get('start_urls') or [] query = kwargs.get('q') or '' if google_query != '': self.query = query if start_url != '': self.start_urls = [start_url]

javascript - Waiting for 2 promises to come back to use simultaneously in a function -

first-off: hope question has not been asked , answered elsewhere... i've been looking , web on , can't seem find (maybe it's not possible). basically, i'm trying build db (in case mongo) info webapi (the crypto exchange kraken). objective build collections various objects requests. here gitub repo: mongonode here's current code (i'm using simple callbacks , request @ moment: chaining everything): // external modules var request = require('request'); var yargs = require('yargs'); var _ = require('underscore'); var async = require('async'); var mongoclient = require('mongodb').mongoclient, co = require('co'), assert = require('assert'); // own modules // variables var tickerarr= [] // generator function connection co(function*() { // connection url var url = 'mongodb://localhost:27017/cryptodb'; // use connect method connect server var db = yield mongoclient.connect(url);

java - Convert database time to IST datetime -

i have time value stored in database in hh:mm:ss format (using mysql's time type). time considered value of ist timezone. server on java code runs follows utc timezone. how can formatted datetime in yyyy-mm-dd hh:mm:ss in ist (or in utc millis)? following i've tried till now: // ... code truncated brevity datetimeformatter formatter = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm:ss"); localtime time = resultset.gettime("send_time").tolocaltime(); localdatetime datetime = time.atdate(localdate.now()); system.out.println(datetime.format(formatter)); the above correctly prints datetime on local machine, on ist, i'm concerned how behave on remote server. your approach fine , should work regardless of computer's time zone since there no time zone information in either localtime or localdatetime . 1 possible issue localdate.now() returns today's date in computer's local time zone, not in ist. may want replace localdate.now(

Create Hunt Group with Twilio Twiml -

i trying create basic hunt group using twiml. pseudo code: dial 'number1' 'timeout=10 seconds' if 'dialcallstatus' not 'completed' dial 'number2' 'timeout=10 seconds' if 'dialcallstatus' not 'completed' dial 'number3' 'timeout=10 seconds' if 'dialcallstatus' not 'completed' hangup call how can achieve please?

ruby on rails - Testing unmarshalling of asynchronous ActionMailer methods using Sidekiq -

tldr; how can test poro argument asynchronous actionmailer action (using sidekiq) serializes , deserializes correctly? sidekiq provides rspec matchers testing job enqueued , performing job (with given arguments). -- to give context, have ruby on rails 4 application actionmailer. within actionmailer method takes in poro argument - references data need in email. use sidekiq handle background jobs. turns out there issue in deserializing argument fail when sidekiq decided perform job. haven't been able find way test correctness of un/marshaling such poro called action being used when performed. for example: given actionmailer action class applicationmailer < actionmailer::base def send_alert profile @profile = profile mail(to: profile.email) end end ... i use this profile = profiledetailsservice.new(user) applicationmailer.send_alert(profile).deliver_later ... and have test (but fails) let(:profile) { profiledetailsservice.new(use

python - How can I access each elements in tensor? -

let me assume have tensor like test = tf.constant([1,2,3],[4,5,6],[7,8,9]) i want value(not row or col) in tensor. how can this? want (2,3) value 6 in here. also want in multi-dimensional array. 'slice' or other tensor functions not fit me because want deal multi dimensional array(not 2x2 2x3x4x10 etc..) please help what want tf.gather or tf.gather_nd

java - Validating a truststore against a keystore in one step -

i have .p12 keystore , .jks truststore. is there easy way (possibly script or 3rd party software) verify whether valid , matching ? just transform pkcs#12 1 jks 1 keytool , compare binary files.

java - Andriod OS 4.4.2 fails connecting to MobileFirst server after TLS 1.2 enabled -

we have mobile hybrid project running on mobilefirst 7.1.0.00.20170627-0807. android versions 4.4.2 , earlier cannot connect server using https if tls 1.2 enabled getting below clients logs while connecting worklight server. 07-25 06:13:06.236: w/system.err(4251): javax.net.ssl.sslpeerunverifiedexception: no peer certificate 07-25 06:13:06.236: w/system.err(4251): @ com.android.org.conscrypt.sslsessionimpl.getpeercertificates(sslsessionimpl.java:146) 07-25 06:13:06.236: w/system.err(4251): @ org.apache.http.conn.ssl.abstractverifier.verify(abstractverifier.java:93) 07-25 06:13:06.236: w/system.err(4251): @ com.worklight.wlclient.certificatepinning.hostnameverifierwithcertificatepinning.verify(hostnameverifierwithcertificatepinning.java:42) 07-25 06:13:06.236: w/system.err(4251): @ com.worklight.wlclient.tlssnienabledsocketfactory.createsocket(tlssnienabledsocketfactory.java:94) 07-25 06:13:06.236: w/system.err(4251): @ org.apache.http.impl.conn.defaultc

Trying to populate a ListView according to the layout of Android.resource.layout.simple_list_item2 without using extra/temporary lists -

i have this arraylist<customer> customers; list , initialized , ready use. want view 2 member fields of each , every single customer on listview, one: image this layout provided in android resources simple_list_item2 can't code custom adapter use it. first textview in row of listview showing return value of customers.get(i).getdefinition() , second textview displaying customers.get(i).getincharge(). how can code neccessary custom adapter?

windows - How can I install a driver using InnoSetup? -

i'd install driver serial port using innosetup. have inf file, , can install driver manually through device manager, i'd able include driver in installer users don't have go through trouble of installing driver themselves. see installhinfsection on msdn. documentation mentions how invoke installation calling 'rundll32.exe'. you'll end this: [files] .. source: "driver\my_x86driver.inf"; destdir: {app}\driver; source: "driver\my_x86driver.sys"; destdir: {app}\driver; [run] .. filename: {sys}\rundll32.exe; parameters: "setupapi,installhinfsection defaultinstall 128 {app}\driver\my_x86driver.inf"; workingdir: {app}\driver; flags: 32bit; note might need run setup in 64bit mode in 64bit systems able install driver: [setup] .. architecturesinstallin64bitmode=x64 also can put checks run version of .inf file depending on machine architecture (e.g. check: is64bitinstallmode ).

php - How to correctly retrieve records from a many to many relationship (Doctrine - DQL query) -

i have following dql query: $qb->select('v, b, c, t, p, m, s, f, h') ->from('urlbuilderbundle:version', 'v') ->leftjoin('v.ddlbrands', 'b', 'with', 'b.version = v.id , b.isactive = 1 , v.isactive = 1') ->leftjoin('v.ddlcampaignobjectives', 'c', 'with', 'c.version = v.id , c.isactive = 1') ->leftjoin('v.ddlthemes', 't', 'with', 't.version = v.id , t.isactive = 1') ->leftjoin('t.ddlproducts', 'p', 'with', 'p.isactive = 1') ->leftjoin('v.ddlmediums', 'm', 'with', 'm.version = v.id , m.isactive = 1') ->leftjoin('m.ddlsources', 's', 'with', 's.ddlmedium = m.id , s.isactive = 1') ->leftjoin('v.fields', 'f', 'with', 'f.version = v.id , f.isactive = 1') ->leftjoin('f.helptext

regex - Need regrex to separate the integer from the array to comma separated -

Image
i looking have regrex passing value in array comma separated.here regrex used fetching value. regrex : id="selectedagency(.+?)" using regrex able find below value matching in id="selectedagency[1]" hence outcome receives follows: &selectedagencies=[14],[12],[10],[9] however have actual output below: &selectedagencies= 14,12,10,9 thanks remove [] use different regex: regex : id="selectedagency\[(\d+)

apache - how to redirect "www.somedomain.com/folder1/demo.jpg" request to some other page using mod_rewrite? -

code block: options +followsymlinks rewriteengine on rewritecond %{http_host} mysite.000webhostapp.com$ [nc] rewritecond %{http_host} !folder1 rewriterule ^(.jpg)$ http://mysite.00xxxtapp.com/folder1/$1 [r=301,l] i think want filename in new url well? (not ".jpg") rewriterule ([^/]+\.jpg)$ http://mysite.00xxxtapp.com/folder1/$1 [r=301,l] or rewriterule ([^/]+\.jpg)$ /folder1/$1 [l] if want keep seeing old url edit so need more 1 rewriterule. i suggest steps all "fake" urls redirect php script all images in /folder1/ must redirected or made inaccessable (suggestion: put them outside document root|) rewriteengine on # images in somefolder parsed through php script rewriterule somefolder/([^/]+\.jpg)$ /imageshower.php [l] # redirect no access image rewriterule folder/*\.jpg /no-access.jpg [r] the php script able checking 'is user logged in?' or have rights <?php $filename = basename($_server[

Automated Python translation 2to3 error -

i want translate python2 code python 3.it simple,but not work import sys import mysqldb import cookbook try: conn = cookbook.connect () print "connected" except mysqldb.error, e: print "cannot connect server" print "error code:", e.args[0] print "error message:", e.args[1] sys.exit (1) conn.close () print "disconnected" i got in terminal 2to3 harness.py refactoringtool: skipping optional fixer: buffer refactoringtool: skipping optional fixer: idioms refactoringtool: skipping optional fixer: set_literal refactoringtool: skipping optional fixer: ws_comma refactoringtool: can't parse harness.py: parseerror: bad input: type=1, value='print', context=('', (9, 0)) refactoringtool: no files need modified. refactoringtool: there 1 error: refactoringtool: can't parse harness.py: parseerror: bad input: type=1, value='print', context=('', (9, 0)) why? don't know if solve prob

java - Access Session attributes in aspect -

i'm trying access session attributes in aspectj @aspect. when have exception bellow. java.lang.illegalstateexception: no thread-bound request found: referring request attributes outside of actual web request, or processing request outside of receiving thread? if operating within web request , still receive message, code running outside of dispatcherservlet/dispatcherportlet: in case, use requestcontextlistener or requestcontextfilter expose current request. @aspect @component public class globalfilter { @autowired private entitymanager entitymanager; private static httpsession httpsession() { servletrequestattributes attr = (servletrequestattributes) requestcontextholder.currentrequestattributes(); return attr.getrequest().getsession(true); } @before("execution(public !void org.springframework.data.repository.repository+.find*(..))") public void beforefind() { httpsession httpsession = httpsession(); long idclient = (long) httpsession.getattri

Can I do this with a custom Visual Studio Code Extension? -

i have additional feature in visual studio code - "scope this" full visual studio solution explorer. it context menu (right click) entry in file explorer of visual studio code - should limit files , folders displayed. is such thing possible visual studio code extension? i never built extension vs code before , know if possible or if waste time. according the api docs , there no way filter visible files in explorer can done files.exclude setting. however, it possible open folder workspace.openfolder complex command. close opened editors, , forget original workspace root path. your extension need remember initial root path , opened editors undo "scope this" menu, , reopening every time cause quite lag.

Issue while connecting to HBASE using Jython -

we trying connect hbase using jython when try connect getting following issue. please if 1 can of great help. 17/07/25 16:48:33 info zookeeper.zookeeper: client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 gmt 17/07/25 16:48:33 info zookeeper.zookeeper: client environment:host.name=bp.bp 17/07/25 16:48:33 info zookeeper.zookeeper: client environment:java.version=1.8.0_92 17/07/25 16:48:33 info zookeeper.zookeeper: client environment:java.vendor=oracle corporation 17/07/25 16:48:33 info zookeeper.zookeeper: client environment:java.home=/usr/java/jdk1.8.0_92/jre 17/07/25 16:48:33 info zookeeper.zookeeper: client environment:java.class.path=/home/pse/workspace/jython/jython.jar:/home/pse/.p2/pool/plugins/org.python.pydev_5.1.2.201606231256/pysrc/pydev_sitecustomize:/home/pse/workspace/operations engine:/home/pse/workspace/java jars/org-apache-commons-logging.jar:/home/pse/workspace/hadoop/hadoop-core-1.2.1.jar:/home/pse/workspace/hadoop/zookeeper-3.3.

User Define Table type in transaction Replication -

i have replication setup store procedure article. , store procedure having user define table type parameter. is possible replicate table type in replication subscriber ? sql version: sql server 2014 developer edition. i have tested flow, in repl_command getting count publisher nothin in replication monitor. replication type: transaction pull type. source version : sql server 2014. destination version: sql server 2008 r2.

r - Error: object 'mle.result' not found -

i wrote these r codes simulation , estimation given below. library(numderiv) library(matrix) library(lambertw) alpha=3.5 beta=2.0 theta=0.5 lambda=4.0 n=50 #generate random variable uniform distribution u<-0 u=seq(0,0.99,0.01) (q in 1:n) { x[q]<- (lambda/beta)* w((((beta/lambda^2)*log(1-theta*u[q]/(1-u[q]))* exp(beta/lambda)))^(1/alpha),branch = 0) } bxiiwg_ll <- function(par){ -sum(log(par[1]*par[2]*x^(par[2]-1)*(1+x)+ par[3]*par[2]*x^(par[2]-1))*(1-par[4])*(1+x^par[2])^(-par[3]-1)* exp(-par[1]*x^par[2])/(1-par[4] (1+x^par[2])^(-par[3])*exp(-par[1]*x^par[2]))^(2)) #maximum likelihood estimation mle.result <- nlminb(c(alpha,beta,theta,lambda), bxiiwg_ll,lower=0,upper=inf) the results got follows: (1) error: object 'mle.result' not found. (2) warnings: in w((((beta/lambda^2) * log(1 - theta * u[q]/(1 - u[q])) : values of (((beta/lambda^2) * log(1 - theta * u[q]/(1 - u[q])) * exp(beta/lambda)))^(1/alph

javascript - First finish reading data from Firebase and then do something else -

so problem empty array returned because reading data firebase not finished yet. using method still executes inside before. var userslist = []; const ref = firebase.database().ref() ref.child('users').once('value').then(snap => { snap.foreach(childsnap => { const key = childsnap.key ref.child(`users/${key}/points`).on('value', function(snapper) { var points = snapper.val() userslist.push({uid: key, points: points}) }) }) }).then(function() { console.log(userslist) }) using then() not magical solution. need return promise within callback, code not doing. in case want final then() invoked once users loaded, need return promise resolves when done. const ref = firebase.database().ref() ref.child('users').once('value').then(snap => { var promises = []; snap.foreach(childsnap => { const key = childsnap.key promises.push(

datetime - Freemarker : Convert unix timestamp string to date format string -

i getting unix timestamp in string format in ftl file. want reformat date readable string such "yyyy-mm-dd". how should convert timestamp formatted date string ? i got date in required format using below code: calbookingentry.getstarttime()?number?number_to_datetime?string["yyyy-mm-dd"]

php - Call to a member function name() on null in laravel 5.4 -

Image
when pressing send button it's giving error this- here routes web.php bellow- route::group(['prefix'=>'ajax', 'as'=>'ajax::'], function() { route::resource('message/send', 'messagecontroller@ajaxsendmessage')->name('message.new'); route::delete('message/delete/{id}', 'messagecontroller@ajaxdeletemessage')->name('message.delete'); }); here controller messagecontroller.php bellow: public function ajaxsendmessage(request $request) { if ($request->ajax()) { $rules = [ 'message-data'=>'required', '_id'=>'required' ]; $this->validate($request, $rules); $body = $request->input('message-data'); $userid = $request->input('_id'); if ($message = talk::sendmessagebyuserid($userid, $body)) { $html = view('ajax.newmessagehtml&#

python logging does not release file -

i have been using logging , notice after first compile, output file logging hangs, , cannot remove till close idle. i believe should "close" logging before compilation finishs, don't know how way using logging: logfile = os.path.join(backup_folder,'test.log') logging.basicconfig(filename=logfile,level=logging.debug,format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s') logging.debug('test') so seems have found way adding in end: logging.shutdown() this instruction close handlers openned.

Randomize a string list from a text file in an array Python? -

i have text file several countries listed in called countries.txt . trying take countries text file , place them in array randomized , randomized list gets printed. have tried editing code in few ways , none of them produce outcome want. below first way tried it. know i'm printing actual array trying something: results = [] def load(): open('countries.txt') inputfile: line in inputfile: results.append(line) random.shuffle(results) print(str(results)) and outcome follows: ['armenia\n'] ['bangladesh\n', 'armenia\n'] ['china\n', 'armenia\n', 'bangladesh\n'] ['denmark\n', 'bangladesh\n', 'armenia\n', 'china\n'] ['armenia\n', 'bangladesh\n', 'denmark\n', 'china\n', 'estonia\n'] ['armenia\n', 'estonia\n', 'bangladesh\n', 'china\n', 'france\n', 'denmark\n'

ios - The document picker ... failed to launch -

i have created own documentpickerextensionviewcontroller , want able open in excel app on ios. in office app press open -> ... more -> locations , choose extensions name. after 2 seconds of loading dialog pops saying "the document picker ... failed launch (0)". i can't find error when googling. know might have done wrong? i found solution. tried creating new test app , document provider xcode worked out of box. realised xcode creating document provider project file provider project , missing in xamarin project file provider since won't using icloud. after adding file provider project no longer got error message.

javascript - AngularJS Ghosting in IE -

Image
got problem app wrote in angularjs. seems in internet explorer ghosting of elements or elements not rendering correctly in firefox , chrome works perfectly. updated angularjs 1.5.9 see if fixed issues doesn't. i've included image of issue below. if resize ie window redraws elements , looks second picture. mentioned present in ie. has come across before , knows how fix it? the issue what should , after resizing window

javascript - How do I declare a dependency on an ng-metadata module? -

i have project using ng-metadata ( https://github.com/ngparty/ng-metadata ) build handful of angular 1.5 modules. have test module/component looks this: import { ngmodule, component, inject, input, output, eventemitter } 'ng-metadata/core' import { platformbrowserdynamic } 'ng-metadata/platform-browser-dynamic' @component({ selector: 'test', template: require('./test.template.html') }) class testcomponent { @input() type: string; constructor() { console.log(`test: ${this.type}`) } } @ngmodule({ declarations: [testcomponent] }) class heromodule {} platformbrowserdynamic().bootstrapmodule(heromodule) everything seems happy when compiled , i'm attempting use module in project (that not using ng-metadata has compatible version of angular). i'm including shims directed ng-metadata docs , javascript file contains module described above (built webpack). have new module in project wants list heromodule

javascript - Shortest way to compare your score to three ranges in jQuery -

i have following code: function display_message() { var low = data.result[0].max; //returns 30 var medium = data.result[1].max; // returns 60 var high = data.result[2].max; // returns 100 // mypoints 67 example if(mypoints > low) { if(mypoints > medium) { alert('you got high score'); } else { alert('you got medium score'); } } else { alert('you got low score'); } } this code works fine. compare average score standard low / medium / high score . low score: 0-30 points medium score: 31-60 points high score: 61-100 points my question though how make code bit prettier? not sure if code considered clear , efficient. any opinions appreciated, thank you there no need if else low, check smallest highest. if (mypoints <= low) { //low msg } else if (mypoints <= medium) { //medium msg } else { //high msg } or can go opposite direction , chec

java - JButton action in other class -

i have main frame 2 panels: jpanel menu = new menu(); menu.setbounds(0, 37, 300, 644); contentpane.add(menu); menu.setvisible(false); jpanel fahrtenbearbeiten = new fahrtenbearbeiten(); fahrtenbearbeiten.setbounds(0, 0, 1422, 668); contentpane.add(fahrtenbearbeiten); in menu panel, want make button, sets fahrtenbearbeiten panel's visible(false) . problem is: how can reach action triggered in menu panel ( menu.java ) , has action in other file ( haupt.java )? declare fahrtenbearbeiten jpanel global variable private jpanel fahrtenbearbeitenpnl = new jpanel(); create method public void hidefahrtenbearbeitenpnl() { fahrtenbearbeitenpnl.setvisible(false); } call method on object of class contains panel. example: menu.hidefahrtenbearbeitenpnl(); let me know if i've got question wrong. (maybe post whole class(es) easier support)

.htaccess - Add subdirectory to url in htaccess -

i'm trying add subdirectory url. example, /news must go /blog/news including articles i came this: rewritecond %{request_uri} !^/news/.*$ rewriterule ^(.*)$ /blog/news/$1 [r,l] see below fix! i fixed following rule: rewriterule ^news/(.*)$ /blog/news/$1 [r=301,nc,l] make sure clear cache when testing , set r=302 make temporary redirect. set r=301 once know working.

Max value from field Spring Data and Mongodb -

i want calculate maximum value of field code within entity "user", use spring data, have seen code as: ".find({}).sort({"updatetime" : -1}).limit(1)" but not know how integrate "repository" @query or equivalent solution, return maximum value of said field. can me? thank you. you can write custom method repository. example have: public interface userrepository extends mongorepository<user, string>, userrepositorycustom { ... } additional methods repository: public interface userrepositorycustom { user maxuser(); } and implementation of it: public class userrepositoryimpl implements userrepositorycustom { @autowired private mongotemplate mongotemplate; @override public user maxuser() { final query query = new query() .limit(1) .with(new sort(sort.direction.desc, "updatetime")); return mongotemplate.findone(query, user.class) } }

python - Assign init arguments automatically in decorator -

i trying assign arguments passed init class. cannot arguments, nor class self (the self init gets passed first arg): class unpack_arguments(object): def __init__(self, f): self.f = f def __call__(self, *args, **kwargs): import ipdb; ipdb.set_trace() class someobject(object): @unpack_arguments def __init__(self, one=1, two=2, three=3, four=4): pass # @ point, can # # obj = someobject() # obj.one # 1 # obj.two # 2 # obj.three # 3 # obj.four # 4 obj = someobject() i try find things can't find class instance of someobject or key names one , two , etc: ipdb> kwargs {} ipdb> args self = <__main__.unpack_arguments object @ 0x1077a3f60> args = () kwargs = {} ipdb> self.f <function someobject.__init__ @ 0x1077a06a8> ipdb> dir(self.f) ['__annotations__', '__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__&

html - grunt-include-replace adding a folder when it compiles -

i'm @ wits end trying figure out. have include replace pulling src folder , compiling dist folder. doing that, however, it's adding src folder dist folder , putting html file that. if pull root directory instead of src folder, works fine , puts html dist folder no folder. why adding path src folder create src folder inside dist folder , how stop doing that? my code set this... distdir: 'dist', srcdir: 'src', includereplace: { dist: { options: { includesdir: '<%= srcdir %>/includes/' }, src: '<%= srcdir %>/*.html', dest: '<%= distdir %>' } } never mind. figured out. have this: files: [ { src: '*.html', dest: '<%= distdir %>/', expand: true, cwd: '<%= srcdir %>/' } ]

asp.net mvc - Sending hyperlink in the email issue -

mvc 4, c#, visual studio 2015, using smtp server. sending hyperlink in email. few people (out of email sent to) receive not complete hyperlink, part of hyperlink blue-underlined-active (represented in bold below). when clicked on, takes https://abcd.efgh.org , not page whole link points to. few use gmail receive emails. https://abcd.efgh.org /testone/testtwo/12?enr=12c873%2goyrjmhxsi%2b9g12xsmv1veb%2ccnndj3o23gi7giu5r5ypyb9ldtkqdbavgwzdpk%2kw%3d%3d ---- view sendmyemail.html.cshtml-------------------------------------------------------------------- @using actionmailer.net @model emailsend @{ layout = "~/views/shared/_email_layout.cshtml"; var emailcontent = model.email.emailcontent; // text emailcontent = emailcontent.replace("{my_hyperlink}", @viewbag.hyperlink); } <!doctype html> <html> <head> <title>mytitle.html</title> </head> <body> <div> @html.raw(em

r - RMarkdown: preserve source code formatting in code cell -

Image
my rmarkdown source looks (screenshot rstudio): (notice empty lines) when press ctrl+shift+k got view expected (with empty lines). however, if run chunk (evaluate) , compile ( ctrl+shift+k ), get: (no empty lines) is there way how preserve empty lines in source code? (i checked knitr options: strip.white=false, tidy=true, tidy.opts=list(blank=true) no joy.) i'm using rstudio 1.0.153 other info: sessioninfo() r version 3.4.1 (2017-06-30) platform: x86_64-pc-linux-gnu (64-bit) running under: debian gnu/linux 9 (stretch) matrix products: default blas: /usr/lib/openblas-base/libblas.so.3 lapack: /usr/lib/libopenblasp-r0.2.19.so locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c [3] lc_time=en_us.utf-8 lc_collate=en_us.utf-8 [5] lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 [7] lc_paper=en_us.utf-8 lc_name=c [9] lc_address=c lc_telephone=c [11] lc_measurement=en_us.utf-8 l

lisp - Allegro CL, Debugging functions step by step -

this question has answer here: how debug in [clozure] common lisp? 3 answers i trying understand how function works in lisp, used allegro cl quite time ago, , remember had special function in repl, let see how function worked step step, in matlab. example, if had function: (+ 1 (* 2 3 (/ 6 2) ) ) you see each function step step, like: (+ 1 (* 2 3 3) ) and then: (+ 1 18) and finally: 19 many in advance. thanks jkiiski, the code showing step step function be: (step (+ 1 (* 2 3 (/ 6 2)))) and shows in detail how lisp parses data , evaluates function. after many steps gives: [step] cg-user(2): result 6: 2 6: (/ 6 2) [step] cg-user(2): result 5: 18 result 4: 18 result 3: 18 result 2: 18 2: (+ 1 18) [step] cg-user(2): result 2: 19 result 1: 19

SPARK_WORKER_INSTANCES for Spark 2.2.0 -

in spark 2.2.0, not see option spark_worker_instances launch multiple workers per node. how do this? if @ spark-env.sh file inside conf directory of spark folder, see option spark_worker_instances=1 . can change number want. so when spark started sbin/start-all.sh number of worker nodes defined should started on machine.

ios - Pushing a button in a Scrollview without UserInteraction on -

i using uitableview headers , footers, whole tableview has horizontal uiscrollviews inside. use lock titles function, in excel. the userinteraction disabled on uiscrollview in uitableview header , uitableview footer , scrolls when body scrolls. in header have button situated in uiscrollviews contentview , need able interact it, not... has come across in past? much of unneeded code has been omitted... - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { uitableviewheaderfooterview *viewheader; uibutton *flow; viewheader = [[uitableviewheaderfooterview alloc] initwithframe:cgrectmake(0, 1, self.tableview.frame.size.width, 48)]; uiview *thiscontentview = [[uiview alloc]initwithframe:cgrectmake(0, 0, contentwidth, 48)]; flow = [[uibutton alloc] initwithframe:cgrectmake( flowrate.frame.origin.x + flowrate.frame.size.width + 5, 14, colwidth1, 20)]; [flow.imageview setimage:[uiimage imagenamed:@"ic_flow"

big o - What would be the complexity of this Sorting Algorithm? What are the demerits of using the same? -

the sorting algorithm can described follows: 1. create binary search tree array data. (for multiple occurences, increment occurence variable of current node) 2. traverse bst in inorder fashion. (inorder traversal return sorted order of elements in array). 3. @ each node in inorder traversal, overwrite array element @ current index(index beginning @ 0) current node value. here's java implementation same: structure of node class class node { node left; int data; int occurence; node right; } inorder function (returning type int obtaining correct indices @ every call, serve no other purpose) public int inorder(node root,int[] arr,int index) { if(root == null) return index; index = inorder(root.left,arr,index); for(int = 0; < root.getoccurence(); i++) arr[index++] = root.getdata(); index = inorder(root.right,arr,index); return index; } main() public static void main(string[] args) { int[] arr = new int[]{100

json - JMSSerializerBundle and custom normalaizers -

in our project useing jmsserializerbundle , api responses need use custom normalizers . when using standard symfony serializer working well, in jms-only way of attaching normalizers, using subscribinghandler interats few types like: null string boolean double float array so question is, know of solution have jms , symfony custom normalizers work together?

php - DynamoDB Query Iterator -

based on official dynamodb documentation, query operation retrieve maximum of 1mb of data, , recommended use getiterator method retrieve entire list of data matching query. sample code provided on http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-dynamodb.html#query below. $iterator = $client->getiterator('query', array( 'tablename' => 'errors', 'keyconditions' => array( 'id' => array( 'attributevaluelist' => array( array('n' => '1201') ), 'comparisonoperator' => 'eq' ), 'time' => array( 'attributevaluelist' => array( array('n' => strtotime("-15 minutes")) ), 'comparisonoperator' => 'gt' ) ) )); // each item contain attributes added foreach ($iterator $item) {

jsonschema - How to use JSON schema oneOf for arrays with fixed values -

i want specify multiple values oneof , have defined below schema validates ( http://json-schema-validator.herokuapp.com/ ). note there deliberately 1 value under oneof in example. { "id": "test-schema", "$schema": "http://json-schema.org/draft-04/schema#", "description": "test schema", "type": "object", "properties": { "alpha": { "type": "object", "properties": { "beta": { "oneof": [ { "type": "object", "properties": { "obja": { "type": "object", "properties": {

html - CSS positioning images in the correct place -

i have following html: #cake1 { float: left; } #cake2 { width: 200px; height: 200px; } <img id="cake1" src="https://www.bbcgoodfood.com/sites/default/files/styles/category_retina/public/recipe-collections/collection-image/2013/05/rosewater-raspberry-sponge-cake.jpg?itok=ovpusqm9" /> <h2>cake</h2> <img id="cake2" src="https://www.bbcgoodfood.com/sites/default/files/styles/category_retina/public/chocolate-avocado-cake.jpg?itok=e2ewe_dx" /> i trying cake2 appear under cake1 using css, instead of displaying on right of image. i removed float:left ; <html> <head> <style> #cake2{ width: 200px; height: 200px; } </style> </head> <body> <img id="cake1" src="https://www.bbcgoodfood.com/sites/default/files/styles/category_retina/public/recipe-collections/collection-image/2013/05/rose

C# Outlook Retrieving the COM class factory for component with CLSID failed due to the following error: 80080005 -

i getting below error when try access outlook folder download attachment inbox. code working when run windows form application. when use windows service auto scan outlook folder, getting issue. *pollingservice encountered error 'retrieving com class factory component clsid {0006f03a-0000-0000-c000-000000000046} failed due following error: 80080005.' for more information, see , support center @ http://go.microsoft.com/fwlink/events.asp .* microsoft not recommend, , not support, automation of microsoft office applications unattended, non-interactive client application or component (including asp, asp.net, dcom, , nt services), because office may exhibit unstable behavior and/or deadlock when office run in environment. if building solution runs in server-side context, should try use components have been made safe unattended execution. or, should try find alternatives allow @ least part of code run client-side. if use office application server-side solution, app

linux - Does iomem comprehensively list everything that's addressable? -

there address range here that's not listed in /proc/iomem. when tried read in address range, got values, 0x000000ab, indicate there behind address range. so question title is: iomem comprehensively list that's addressable? there else that's memory-mapped not listed iomem? the environment issue linux running on custom made board x86 cpu.

android - Enable Debug mode on your development device for Firebase -

i have user properties/tags want test in real-time in firebase console. have have piping set correctly see tags builds uploaded hours later. i have read command adb shell setprop debug.firebase.analytics.app <package_name> should take care of doesn't seem working me. steps have taken: ran build via android studio opened terminal in android studio , ran adb shell setprop debug.firebase.analytics.app com.x.y.android.qa.debug (where x , y app identifiers, qa flavor , debug debug build) i still see no devices available in firebase debugview dashboard. am missing step? need build , deploy app command line? thanks, otterman

c# - Accessing dimensions (width/height) from a VideoPlayer source URL -

i working on unity project requires me download video file (mp4 format) , play using videoplayer component. because file downloaded @ runtime, have "stream" via url downloaded location, opposed loading videoclip. to accurately size target rendertexture , gameobject video playing to, need dimensions of video file itself. because not videoclip cannot use: videoclip clip = videoplayer.clip; float videowidth = clip.width; float videoheight = clip.height; because using source url opposed videoclip, return null. can video dimensions directly file somehow? you can retrieve these information texture videoplayer constructs. get videoplayer videoplayer videoplayer = getcomponent<videoplayer>(); get texture videoplayer texture vidtex = videoplayer.texture; get videoplayer dimension width/height float videowidth = vidtex.width; float videoheight = vidtex.height; make sure texture after videoplayer.isprepared true . see other answer full code o

postgresql - ERROR: extra data after last expected column - COPY -

when try import data delimiter | receive error: error: data after last expected column i able load data if remove double quote or single quote filed have issue in below sample data requirement need data without removing any. this copy command: copy public.dimingredient '/users//downloads/archive1/test.txt' delimiter '|' null '' csv header escape '"' ; my table: public.dimingredient ( dr_id integer not null, dr_loadtime timestamp(6) without time zone not null, dr_start timestamp(6) without time zone not null, dr_end timestamp(6) without time zone not null, dr_current boolean not null, casnumber character varying(100) collate pg_catalog."default" not null, ingredientname character varying(300) collate pg_catalog."default" not null, matchingstrategy character varying(21) collate pg_catalog."default", percentofconfidence double precision, disclosurestatus