Posts

Showing posts from July, 2015

Stop a controlling object to move in Corona sdk -

i have 2 controls in space shooter-like game, left , right. ship move left , right , when ship moves left of x=40 (far left), revert x=40 , disable "move left" function temporarily, problem whenever move far left or far right of screen, middle of screen, ship moves further x=40(about x=35) moves , continues until let go of button. how can make when move ship far left, stops , lets me move right? here code: function left:touch() if(car01.x>40 , car01.x<280) motionx=-speed; return false end end left:addeventlistener("touch",left) function left:touch2() motionx=0; end local function movecar(event) if(car01.x>40 , car01.x<280) car01.x=car01.x+motionx return false elseif(car01.x==40) car01.angularvelocity=0 left:addeventlistener("touch2",left) car01.x=car01.x+motionx elseif(car01.x<40) car01.x=40 end end runtime:addeventlistener("enterframe",movecar) local function stop(event) if (event.phase==...

how to select all of duplicate record in mysql -

my records is: name | id | avg(point) point | 1 | 6 b | 2 | 6 c | 3 | 5 d | 4 | 5 e | 5 | 4 f | 6 | 3 g | 7 | 2 how select record below: 1.i want select top 3 record, result follow: name | id | avg(point) point | 1 | 6 b | 2 | 6 c | 3 | 5 d | 4 | 5 e | 5 | 4 2.i want select record not top 3, result follow: name | id | avg(point) point f | 6 | 3 g | 7 | 2 how can do? there several ways these. here's couple using in , not in . for top 3, can use in : select * yourtable point in (select distinct point yourtable order 1 desc limit 3) for rest, use not in instead: select * yourtable point not in (select distinct point yourtable order 1 desc limit 3) other...

osx - How to let other people use ssh to connect to my computer? -

my operating system mac os x. want use bash command let other people use ssh connect computer. how do? set user account them on computer; allow logon privileges user. os x server puts pretty gui face on doing this.

Materialize.toast in angular 2 -

i working on angular 2. have used materialize-css works fine classes problem came materialize toast . configured materialize gulpfile.js need add other js file in gulpfile? <a class="btn" (click)="materialize.toast('i toast', 4000)">toast!</a> used console shows error materialize not defined this works me. wish knew why - not find documented anywhere. import { toast } 'angular2-materialize'; ngoninit() { toast("i best toast there is!", 4000); }

How do I execute Windows commands in Java? -

i'm working on project, , give list of windows commands. when select one, perform command. however, don't know how that. going in visual c#, or c++, c++ classes complicated, , don't want make forms , junk in visual c# (really bad @ console applications). i hope helps :) you use: runtime.getruntime().exec("enter command here");

objective c - Obj-c is NSMutablearray thread safe in this Queue, and does reading it needs to be queued also? -

i'm working on ios app in xcode 7, , have had problems thread safety of global nsmutablearray read many times updates on tableview. because of strange chrashes, tried adding queue updating of global array (global view), array updated database function call (written class method other global functions). update called main threads other calls coming background threads , timer events. i add globals: nsmutablearray *mymutarray ; dispatch_queue_t the_queue ; then in viewdidappear the_queue = dispatch_queue_create("my_queue", dispatch_queue_serial) ; and function updating array (from classinstance) -(void)update_array { dispatch_sync("my_queue"),^{ mymutarray = [[nsmutablearray alloc] initwitharray:[globalfunction updatearrayfromdb] ] ; } } with hoping avoid thread problems, necessary have read function like: -(nsarray*)read_array{ __block nsarray *array ; dispatch_sync("my_queue",^{ array = [nsarray ar...

hashtable - Why the powershell convert my hash table into string block -

i have hashtable ( $applications ) looks that: name version ---- ------- adobe flash player 19 activex 19.0.0.226 enterprise library 4.0 - may 2008 4.0.0.0 entity framework designer visual studio 2012 - enu 11.1.21009.00 fiddler 2.4.0.6 google chrome 49.0.2623.87 iis 8.0 express 8.0.1557 so i'm trying exclude applications list , i'm using: [array]$excludeapps = "fiddler","chrome" foreach ($excludeapp in $excludeapps){ $applications = $applications -notlike "*$excludeapp*" } the result maybe filtered out exclude list not expected: @{name=adobe flash player 19 activex; version=19.0.0.226} @{name=enterprise library 4.0 - may 2...

How to conditionally copy the data rows from one Excel Worksheet to another -

i have list of projects , project details in "project master" excel worksheet placed in 4 columns: project type, project numbers, project value, , project managers' names. want write macro copy content of these 4 columns "project master" worksheet worksheet ("details") in same workbook if row contains project type "a". possible? regards, ck pertinent task description, sample worksheet content may shown in following table: type num value manager name b 3 3.14 i. newton 5 2.71 t. edison c 8 9.95 h. ford 1 4.99 s. jobs d 4 21 g. leibniz and corresponding sample vba sub copydetails() perform task shown below: sub copydetails() dim ws worksheet dim lastrow long set ws = thisworkbook.worksheets("project master") lastrow = ws.cells(ws.rows.count, "a").end(xlup).row = 2 lastrow if (ws.range("a" & i) = "a") ...

mysql - Coldfusion output variable as image from database -

this function upload photo in map in our network. after sets path of photo , puts source in imagepath. <cffunction name="uploadphoto" access="public" output="false" returntype="any"> <cfif isdefined("myform.submit")> <returnvariable="imagepath"> </cfif> <cfparam name="form.fileupload" default=""> <cfif len(trim(form.fileupload))> <cfset local.imagepath = 'img/profiles/' /> <cfset strpath = expandpath( "./" ) & local.imagepath /> <cffile action="upload" filefield="fileupload" destination="#strpath#" nameconflict="overwrite"> <p>thankyou, file has been uploaded.</p> </cfif> <cfset form.filename = cffile.s...

itext - ItextPdf : get Y position -

i'm using itextpdf 5 in project i want draw change bar element. my method drawbar take in input y1 , y2 positions : drawbar(float y1, float y2, pdfwriter writer){ // draw bar } but dont know how y position current pointer. feasible ? you looking getverticalposition() method on pdfwriter . "current" y pass false , "next" y if line break added pass true .

ios - UIWebView get user touch on tapping link -

i want perform action when user clicks link on uiwebview . doing making work : - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { nslog(@"request - %@", request.url.absolutestring); [webview.window makekeyandvisible]; [[uiapplication sharedapplication] setnetworkactivityindicatorvisible:yes]; if(isfirsttimeloaded) { [self shotoolbar]; [self updatebuttons]; } return yes; } - (void)webviewdidfinishload:(uiwebview *)webview { isfirsttimeloaded = yes; } this works fine. doesn't when uiwebview 's first load involves multiple redirection while loading page. want fire condition when user intentionally clicks on link. not on url redirection of uiwebview . you have check navigationtype - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigatio...

model view controller - MVC Pattern GUI Program java (Updating GUI) -

hi guys i'm working on java programs , have been stuck hours trying figure out. hoping you's can me out i'm finding gui part difficult. asked following: create class called hobby, has attributes, hobbyname , constructor hobby object, accepts string name parameter.create class called hobbylist, holds vector or array of 10 hobbies (these 2 classes represent data (or model) in system). add addhobby (adds hobby vector) , gethobby (returns vector of hobbies) methods hobbylist class. create 2 view classes, call 1 view class listview (use jlist gui display hobbies held in hobbylist) , call other class comboview class (use jcombobox).in each gui provide way add hobbylist , button refresh list display. keep listener class(es) separate gui classes (the listener class\classes will represent contr...

Eclipse CDT build C project with gcc not g++ -

i installed mingw32 base access gcc command (added /bin folder path ). installed eclipse cdt mars, created c project , selected mingw32 toolchain. if try compile simple program written in main.c , eclipse tells me couldn't find g++ . know eclipse can't find g++ because installed mingw32 base, gcc 1 available. created c project not c++ project. so why eclipse try compile g++ not gcc ? how can change this?

c - Matlab coder for converting feature extraction functions -

currently face problem: need obtain ( .c ) versions of (extracthogfeatures(x), extractlbpfeatures(x), rgb2hsv(x), imhist (x)) functions exist in computer vision toolbox. because need same output of these matlab functions use in android app. matlab coder me? work converting these matlab functions? i don't know how results coder be, in list of functions supported code generation rgb2hsv not included.

python - Blitting an image according to countdown -

i making game using python 3.5.1/pygame, , need animate drop falls ceiling. original code: def dropping(x,starty,endy,speed): if drip == true: index in range(starty,endy,speed): screen.blit(drop,(x,index)) while insert_variable_here == true: dropping(x,starty,endy,speed) pygame.display.update() this code blits of @ once instead of waiting next loop of "insert_variable_here". how can fix this? well try storing countdown string using if statements determine image blit. (i haven't used pygame months , have forgotten how blit, idea) import time import pygame *code here* countdown = str(your countdown code) if countdown > 60: blit image

java - Unexpected extraneous bytes after map value -

i have table in cassandra has column of type map (i.e) source_id_map map i using kundera orm cassandra. during select , below exception cassandra version : 2.1.8 any ideas, possible cause ? error while setting fieldsourceidmap value via cql, caused by: . org.apache.cassandra.serializers.marshalexception: unexpected extraneous bytes after map value @ org.apache.cassandra.serializers.mapserializer.deserializefornativeprotocol(mapserializer.java:110) @ com.impetus.client.cassandra.schemamanager.cassandradatatranslator$maptypebuilder.decompose(cassandradatatranslator.java:1177)

android - How to use SearchView in the toolbar on clicking search icon -

Image
i working on following screen: 1 screenshot here on toolbar ,i having search icon.to add search icon ,i have used following code: menu_friend_list_activity.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_search" android:icon="@drawable/search" android:orderincategory="100" android:title="@string/action_search" app:actionviewclass="android.support.v7.widget.searchview" app:showasaction="always" /> </menu> code inside activity @override public boolean oncreateoptionsmenu(menu menu) { menuinflater menuinflater = getmenuinflater(); menuinflater.inflate(r.menu.menu_friend_list_activity, menu...

java - Invoking JAX-RS service from a servlet -

i'm working on java web application using eclipse. have created web page servlet asks user choose file upload, , have web service want handle file. my issue how pass parameters servlet web service, , invoke service servlet. i have tried methods using context , httpconnections neither seemed have work. any or advice appreciated! my code servlet: protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { httpsession session = request.getsession(false); string uploadfile = request.getparameter("uploadfile"); string username = (string)session.getattribute("loginname"); url url = new url ("http://localhost:9763/cwengine_1.0.0/services/engine"); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setdooutput(true); conn.setrequestmethod("post"); conn.setrequestproperty("content-type", mediatype.text_plai...

pdfbox - PDPageContentStream drwastring method is not working -

i trying create new pdf document using java program using pdfbox api, exception in thread "main" java.lang.noclassdeffounderror:org/apache/commons/logging/logfactory every time facing same error. have added external jar file classpath, showing drawstring method of pdpagecontentstream object deprecated. what problem this?

swagger split definition yaml - model structure not shown -

Image
i using swagger 0.7.5 , trying split swagger.yaml file multiple. used swagger project create sample-api command create project. framework chosen express . execution of these commands created nodejs project expressjs setting , default swagger.yaml file. since targeting big application, want split yaml file across multiple. per documentation, have started externalizing response model external file , here how looks swagger.yaml swagger: "2.0" info: version: "0.0.1" title: hello service host: localhost:10010 basepath: / ... #skipping code brevity paths: /hello: x-swagger-router-controller: user get: description: hello operationid: hello parameters: - name: name in: query description: name of person whom hello required: false type: string responses: "200": description: success schema: # pointer definition $ref: ...

c# - A potentially dangerous Request.Form value was detected from the client Exception -

we have internet site on 2 servers load balance server code identical on both servers 1 of servers shows below exception every minut, "$maincontent$aspcontrol" changing each time. a potentially dangerous request.form value detected client (ctl00$maincontent$drpownernationality="...lect'"()&%<acx><script >prompt..."). @ system.web.httprequest.validatestring(string value, string collectionkey, requestvalidationsource requestcollection) @ system.web.httprequest.validatehttpvaluecollection(httpvaluecollection collection, requestvalidationsource requestcollection) @ system.web.httprequest.get_hasform() @ system.web.ui.page.getcollectionbasedonmethod(boolean dontreturnnull) @ system.web.ui.page.determinepostbackmode() @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) @ system.web.ui.page.processrequest(boolean includestagesbeforeasyncpoint, boolean includ...

c# - unable to bind string values which are separated with comma to a check box list -

im editing languages know checkboxes in gridview have string value english,spanish. while clicking edit button checkboxlist items should selected. i want gridview row column details , want bind in 1 checkboxlist. have binded languages checkbox . need to make checkboxes selected in selected state. gridview <asp:templatefield headertext="languages"> <edititemtemplate> <asp:textbox id="txtlanguages" runat="server" text='<%# bind("languages") %>'></asp:textbox> </edititemtemplate> <itemtemplate> <asp:label id="lbllanguages" runat="server" text='<%# bind("languages") %>'></asp:label> </itemtemplate> ...

python - pip install from github repo doesn't work -

i want use github repository contains json schemas in testing project. i trying install with: pip install git+https://github.com/org/repo.git collecting git+https://github.com/org/repo.git cloning https://github.com/org/repo.git /var/folders/7v/yqj59phx3q71thk7b9819nlm0000gn/t/pip-6uql0o-build complete output command python setup.py egg_info: traceback (most recent call last): file "<string>", line 1, in <module> ioerror: [errno 2] no such file or directory: '/var/folders/7v/yqj59phx3q71thk7b9819nlm0000gn/t/pip-6uql0o-build/setup.py' ---------------------------------------- command "python setup.py egg_info" failed error code 1 in /var/folders/7v/yqj59phx3q71thk7b9819nlm0000gn/t/pip-6uql0o-build/ first question: why cloning folder instead of /users/raitis/.virtualenvs/someenvironment/bin/python ? second question: need have setup.py file in repository if want install pip? note: after can install pip add req...

opennlp - Error when installing package ‘openNLPmodels.de’ in R / RStudio -

error when installing package ‘opennlpmodels.de’ in r / rstudio when try install package ‘opennlpmodels.de’ in rstudio following error messages. run win7, java 8 , latest versions of rstudio r. opennlp , opennlpdata correctly installed. can me install package? thank in advance!!! dominik frist alternative: installation r: > install.packages("opennlpmodels.de", repos = "http://datacube.wu.ac.at/", type = "source") installing package ‘\\xxx/r/win-library/3.2’ (as ‘lib’ unspecified) trying url 'http://datacube.wu.ac.at/src/contrib/opennlpmodels.de_1.5-2.tar.gz' content type 'application/x-gzip' length 8393712 bytes (8.0 mb) downloaded 8.0 mb "\\xxx" cmd.exe wurde mit dem oben angegebenen pfad als aktuellem verzeichnis gestartet. unc-pfade werden nicht untersttzt. stattdessen wird das windows-verzeichnis als aktuelles verzeichnis gesetzt. * installing *source* package 'opennlpmodels.de' ... ** inst ** no man pa...

r - data frame splitting based on specific conditions -

consider data frame having 1200 records , 30 variables. want divide data frame 6 sample each sample size of 200. far tried following r code: createsample<-function(df) { totalsample<-ceiling((nrow(df)/200)) samplesize=200 for(i in 1:totalsample) { ## user should have define file name , start & end row file <-'demo.csv' start <- (i-1)*samplesize end <- (i*samplesize) function1(file,start,end) ## call function again control reaches here } } createsample(rawdata) ## function call above code result unbound error, because can’t access first records 0 index value, instead in r can access first records index value 1. expectation is: in first iteration of loop want access 1-200 records. in next iteration want access 201-400 records. till total 6 time repetition, because loop execute total of 6 times. reading data frame want start , end value should dynamically change in each iteration....

jquery - Javascript string validation. How to write a character only once in string and only in the start? -

i writing validation phone numbers. need allow users write + character in begining of input field , prevent users writing later in field. in other words: +11111111 - right, 111111111 - right, +111+111+ - false, 1111+111+ - false the problem need perform validation while typing. result cannot analyse whole string after submision, not possible fetch position of + character because 'keyup' returns 0 . i have tryed many approaches, 1 of them: $('#signup-form').find('input[name="phone"]').on('keyup', function(e) { // prevent typing letters $(this).val($(this).val().replace(/[^\d.+]/g, '')); var textval = $(this).val(); // check if + character occurs if(textval === '+'){ // remove + occurring twice // check if + character not first if(textval.indexof('+') > 0){ var newvalrem = textval.replace(/\+/, ''); ...

JQuery Filter not filtering all records -

i using j query filter in code search records.my records consist of employee information.there 12 pages of records. its working fine on current page if search record on page 2nd,then not search it.i using following code search records, (function ($) { $('#search').keyup(function () { var rex = new regexp($(this).val(), 'i'); $('.searchable tr').hide(); $('.searchable tr.gradex').filter(function () { return rex.test($(this).text()); }).show(); }) }(jquery)); html structure,showing 1 record demo; <table class="table table-striped" id="datatable-editable"> <thead> <tr> <th>name</th> <th>dept</th> <th>salary</th> <th>date</th> <th style="min-width: 80px;">action...

antlr - XText Dangling Else - The Other Option -

so i've been using x-text , playing syntactic predicates. the classic example dangling else problem, solution given greedily parse else statement, i.e. don't terminate inner expression, so: ifstatement: 'if' condition=expression 'then' then=expression (=>'else' else=expression)?; i have grammar of processes, 2 may combined create 1 big process binary operator, example process 1 + process 2 affords choice between process 1 , process 2 in addition, processes may call other processes: process 1 -> process 2 means process 1, process two. in grammar, following: process 1 -> process 2 + process 3 should interpreted (process 1 -> process 2) + process 3 however, considering dangling else problem, resolution gives provides me wrong solution. how then, in x-text can say, "if makes sense to, , program still parses, jump out of inner statement @ earliest possible opportunity" here snippit of gramm...

Pyspark 'tzinfo' error when using the Cassandra connector -

i'm reading cassandra using a = sc.cassandratable("my_keyspace", "my_table").select("timestamp", "vaue") and want convert dataframe: a.todf() and schema correctly infered: dataframe[timestamp: timestamp, value: double] but when materializing dataframe following error: py4jjavaerror: error occurred while calling o89372.showstring. : org.apache.spark.sparkexception: job aborted due stage failure: task 0 in stage 285.0 failed 4 times, recent failure: lost task 0.3 in stage 285.0 (tid 5243, kepler8.cern.ch): org.apache.spark.api.python.pythonexception: traceback (most recent call last): file "/opt/spark-1.6.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/worker.py", line 111, in main process() file "/opt/spark-1.6.0-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/worker.py", line 106, in process serializer.dump_stream(func(split_index, iterator), outfile) file "/opt/spark-1.6.0-bin-hadoop2.6/py...

angularjs - Mock a Angular 1.5 component in unit tests -

i have basic angular 1.5 component looking : angular .module('app') .component('techs', { templateurl: 'app/techs/techs.html', controller: techscontroller }); and mock only component , not whole app because angular.mock.module('app') mocks every components of app. there way ? tried angular.mock.module('techs') have error occuring : failed instantiate module techs due to: module 'techs' not available! either misspelled module name or forgot load you should inject components $componentcontroller. forex: component = $componentcontroller('component', {yourscope}, {yourbindings});

Jenkins - How to make a job trigger 3 jobs on 3 different node simultaneously -

Image
i relatively new jenkins , not aware of many plugins available. need little in solving 1 of scenario. i have job (master) triggers 3 different jobs( a, b , c). need trigger these 3 jobs on 3 different nodes , these node names can not hard code need pass master job. so, master job reads these values parameters user , triggers a, b , c jobs any on appreciated. here 1 solution using jenkins join plugin , jenkins nodelabel plugin. on master job, add 1 node parameter per child job: next, add new join post-build action trigger child jobs using parameterized trigger plugin (add "current build parameters" option): it trigger job test.bruno.a , test.bruno.b , pass 2 node parameters these jobs (node_a , node_b). on child jobs, have add node parameter same name (node_a , node_b): (same job b...) when trigger master job, select target nodes 2 jobs: your child jobs use relevant nodes: i hope helps :)

java - Tracking andorid API's used by other application installed on phone -

i building android application, beginner this. want track api's used other applications installed in phone, example want know applications used or using camera. want know other applications doing?...so please me achieve this here 2 open-source projects might provide looking for: osmonitor , , android device info

formatting - How to create a report with fields in between paragraph text? -

Image
my report below. in shown report, text in black color static , text in red fields replaced value dynamically java. in above picture, line 1 , 2 have no problem. but paragraph not sure use? should use static-text box or text field? if use part static-text box , part dynamic, becoming clumsy , difficult maintain line spacing. so please advise how design following report in jasper studio 5.6. use textfield , string concatenation on text, when need number format use numberformat api or decimalformat api if need break line, set bold text can use html achive setting markup="html" on textelement example <?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"...

javascript - Filter ng-repeat by input date -

i'm working on 1 of first angularjs projects , i'm stuck. trying do? i'm trying filter ng-repeat selected date input type = date view: <div class="form-group col-md-3"> <label for="date">tender date</label> <input type="date" id="date" ng- model="searchdate.tenderdate"class="form-control"> </div> <div > <table class="table table-bordered"> <thead> <th>tender id</th> <th>business unit</th> <th>therapy unit</th> <th>tender date</th> </thead> <tbody ng-repeat="tender in tenders | filter:searchdate"> <td>{{tender.tenderid}}</td> <td>{{tender.businessunit}}</td> <td>{{tender.therapyunit}}</td> <td>{{tender.tend...

python - How to get PyCharm runserver to work with vagrant and heroku run? -

normally execute heroku run set environment variables .env file. can't prefix pycharm's command heroku run . how set environment variables? create python file in root of project. paste inside #! /usr/bin/env bash export $(cat /vagrant/.env | grep -v ^# | xargs) /home/vagrant/.virtualenvs/virtualenvname/bin/python "$@" make executable chmod +x python in pycharm set file python interpreter project. n.b. needs variables in .env seperated using equals sign , there no spaces. eg. django_secret_key=abc123abc124 django_settings_module=myproject.settings.local

oracle - How to get return value from stored procedure with output parameter in Grails? -

i have stored procedure has output parameter cursor here's code stored procedure use, don't know how return value def kf_fpy sql.call("{call calfpy(?,?,?,?,?)}",[workcenter,product,stattime,endtime,sql.resultset(oracletypes.cursor)]) { cursorresults -> cursorresults.eachrow() { x -> kf_fpy = x.getat('kf_fpy')//error occured } } and got error "method threw 'java.lang.nullpointerexception' exception. cannot evaluate $proxy11.tostring()" stored procedure: procedure calfpy(workcenter in varchar2,produ in varchar2,stdt in varchar2,etdt in varchar2,p_out out pkg_package.type_cursor) pkg_package: create or replace package pkg_package type type_cursor ref cursor; type type_record record ( kf_ws varchar2(20), kf_fpy number, kf_tfpy number, kf_pro varchar2(200) ); end; enter image description here check out...

excel - Restricting the user to delete the cell contents -

is there's way restrict user deleting cell contents without using protect method of excel. have code: private sub worksheet_beforedoubleclick(byval target range, cancel boolean) dim ws worksheet set ws = thisworkbook.worksheets("sheet1") if not intersect(target, range("c21:d" & ws.range("c" & ws.rows.count).end(xlup).row)) nothing cancel = true msgbox "you not allowed edit!", vbcritical + vbokonly endif end sub but disallows editing of cell contents. want make function disallow editing , deleting data in cell without using protect method. thanks! without lock , unlock, can use this. have there 1 global variable store selection value (to preserve beforechange state). function selectionchange, updating value of current cell, can restore cell value after users try. sub worksheet_change controling, if user targeting specified row , column (can adjusted whole range), , if try change value, prom...

browser - how to get client Ip address when the request is made from javascript -

i want client ip address makes request site. here code this: var w2 = httpcontext.request.userhostaddress; var w3 = this.request.userhostaddress; this works fine when request comes browser. when request comes javascript don't results excpected. here javascript requset: <script src="http://localhost:55866/dashboard/getcampine?mediaid=21&productstypid=5 "> </script> that get: w3=::1 w2=::1

android - populate a table layout with json -

i have android app should parse json output of php web service , display in table layout try following code no data showed after running app plz public class createtable extends activity { tablelayout tl; tablerow tr; textview companytv,valuetv; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); tl = (tablelayout) findviewbyid(r.id.maintable); adddata(); } public void adddata() { try { string data; defaulthttpclient client = new defaulthttpclient(); httpget request = new httpget("http://192.168.1.10:89/.../z.php"); httpresponse response = client.execute(request); httpentity entity=response.getentity(); data=entityutils.tostring(entity); log.e("string", data); jsonarray json=new jsonarray(data); ...

javascript - Bootstrap modal window does not close -

i using bootstrap modal in react application . have requirement modal window should not close when clicking on modal backdrop . using $(".modal").modal("backdrop":"static"); which works fine . in next scenario , want same modal close on clicking on backdrop using following code. $(".modal").modal("backdrop":true); but not working . i tried too $('#modal').modal('hide'); please provide feasible solution same. to close bootstrap modal can pass 'hide' option modal method follow $('#modal').modal('hide'); bootstrap provide events can hook modal functionality, if want fire event when modal has finished being hidden user can use hidden.bs.modal event can read more modal methods , events here in documentation

python 3.x - Strings inside of comments -

i noticed when place quotations around in comment line, words in quotations change color indicate interpreter sees them string. found confusing because thought interpreter supposed ignore comments. curious know if did wrong. code below. # output of concatenation above be: # 'spameggs' 'spameggs' changes color though part of comment line. its showing me comment ,no change of color of text mentioning,which editor using .seems editor problem.try open in idle.it red color. thanks

Java-netbeans 8.1: Unrecognized file? -

so developed java application , trying read file in, error message saying file configuration.txt doesnt exist. here file reading code: public static void main(string[] args) throws filenotfoundexception { //reading configuration file scanner readconfigurationfile = new scanner(new file("configuration.txt")); yes, have imported necessary io library , utilities included. i moved file everywhere (in package, or in project folder, or bin folder, etc..) , kept testing, didnt work. the way works when moved desktop , put path of file on desktop in code (so c:\user\....\configuration.txt) but thats not how want it, because others have run without changing code. any suggestions/help? have looked everywhere online , tried different methods didnt work. , complicate code avoided. thanks in advance if configuration file intended live inside application (it deployed inside jar or war) should not use file resource . say relative path org/example...

jar - How to use Python API of Stanford NER? -

this question has answer here: how install , invoke stanford nertagger? 5 answers version windows 7 python 2.7.10 nltk 3.1 stanford ner 3.6 (2015-12-09) issue i trained custom ner model stanford ner , got serialized model. tried using model carry out ner on unseen corpus via python api provided nltk. according documentation , should specify path model , path stanford-ner.jar . however, need specify both path stanford-ner.jar , path slf4j-api.jar because stanford ner requires logging module. i not figure out how specify 2 paths in nltk api. constructor takes 2 arguments first 1 path/to/model , second 1 path/to/jar . tried concatenating 2 jar paths, putting them in list , tuple none of methods worked. how can tell nltk find both jars in order invoke prediction? could provide code tried? looking @ source code nltk.tag.stanford module looks ...

c++ - Moving resources out of a generic class -

in context 1 follows : template <class t> struct mystruct { t resource; decltype(auto) getresource() { return std::move(resource); } }; is getresource method doing expect do, i.e. move resource member out of class ? want use in cases mystruct won't used more , it's ok "steal" memory it. with template <class t> struct mystruct { t resource; decltype(auto) getresource() { return std::move(resource); } }; decltype(auto) t&& . t&& doesn't steal resource, (but allows stolen implicitly). an alternative be template <class t> struct mystruct { t resource; t takeresource() { return std::move(resource); } }; here, once takeresource called, resource has been transferred. so example mystruct<std::unique_ptr<int>> foo; foo.resource = std::make_unique<int>(42); *foo.get_resource() = 51; // no transfer ownersh...

How to find and collect all the information available in a give contact in any android phone? -

currently displaying contacts of phone in app custom recyclerview. till showing name, mobile number , profile image of contact on list item view need information contact , display when list item of app clicked in custom detail page. for each contact there different set of information available, in few contacts have email few contacts not present. my questions are how can information of given contact without missing single bit.is there structure can traverse , check value each key? also when populating system contacts in apps list, find same contact multiple times in list. think due fact in device's account manager same number registered many accounts whatsapp, gmail. if how display number once in list. here can . have contact id base on can save details phone numbers ,emails in custom object , use object display details custom class like:: class contact{ int contactid; string name; arraylist<phone> phone; arraylist<email> emails; } class ph...

npm - Unable to install appcelerator CLI -Unexpect end of input -

tried reinstall appcelerator cli after reinstalling xcode having error installed node version v4.4.0 then every time try execute following command in order install appcelerator cli sudo npm install appcelerator -g it gives me following error : npm err! registry error parsing json npm err! darwin 15.3.0 npm err! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "appcelerator" "-g" npm err! node v4.4.0 npm err! npm v2.14.20 npm err! unexpected end of input npm err! {"_id":"appcelera ........etc with long json string. internet problem . tried network . proceded installation steps thanks

install4j + allow installer to create multiple new directories for installation location -

Image
i have issue installer generated install4j. during "install files" action throws error below i see these errors in log file: [info] com.install4j.runtime.beans.actions.installfilesaction: before install file: c:\dir1\dir2\jre\bin\file.dll; size: 24992 bytes; exists: false [info] filetime: mon mar 28 13:11:06 ist 2016, mode: 644, overwritemode: ask except update, shared: false, uninstallmode: if created, delayifnecessary: false [error] com.install4j.runtime.beans.actions.installfilesaction: install file not successful: c:\dir1\dir2\jre\bin\file.dll.dll [error] com.install4j.runtime.beans.actions.installfilesaction: execute action not successful on debugging looks installer unable create installation location. user admin privileges. in recent observation found above error occurs when use particular word(calling "home") in installation location, c:\home\dir2. if choose other path installs fine. not understand behaviour. can me out this. if understa...

java - Automation testing technique to test maps -

can me suggest me automated testing approach test maps, coordinates, assets plotted on maps. i trying build automated testing framework using selenium test maps, coordinates, location etc. if has tried before, please give suggestion better approach.

ios - Placing marker of bus station on googlemap -

i having trouble placing marker of bus station near me on google map application. let live in new york city,i want bus station marker on google map.but,i don't know how fetch bus station data of current city(new york) , place picker on it.i tried appcoda tutorial , gives me marker of custom search here : http://www.appcoda.com/google-maps-api-tutorial/ is there way can modified "maptask.swift" code bus station near me , place picker on each bus station? here maptask.swift import uikit import corelocation import swiftyjson class maptask: nsobject { let baseurlgeocode = "https://maps.googleapis.com/maps/api/geocode/json?" var lookupaddressresults: dictionary<nsobject, anyobject>! var fetchedformattedaddress: string! var fetchedaddresslongitude: double! var fetchedaddresslatitude: double! override init() { super.init() } func geocodeaddress(address: string!, withcompletionhandler completionhandler: ((status: string, success: bool) -...

java - Deleting default user database resource from Tomcat's default server.xml configuration file -

tomcat's (8.0.27) server.xml file contains default user database definition under global naming resources section: <globalnamingresources> <!-- editable user database can used userdatabaserealm authenticate users --> <resource name="userdatabase" auth="container" type="org.apache.catalina.userdatabase" description="user database can updated , saved" factory="org.apache.catalina.users.memoryuserdatabasefactory" pathname="conf/tomcat-users.xml" /> </globalnamingresources> some scans discovered tomcat-users.xml file contains plain text passwords. wondering whether resource can deleted? not planing use realm under engine definition nor using tomcat manager application. i didn't find answer under tomcat documentation section. yes can, if delete realm using resource : <!-- use lockoutrealm preve...

javascript - How do I make a list in AngularJS? -

i want make products list products name , add products price & pv , bv. here saved json data in $scope : $scope.products = [ {"id":1,"name":'sp0300370 nutrient super calcium powder',"price":21,"pv":18,"bv":18}, {"id":2,"name":'sp0300315 calcium powser metabolic factors',"price":25,"pv":21,"bv":21}, {"id":3,"name":'sp0300372 super calcium powder children',"price":26.5,"pv":23,"bv": 23}]; angular binded html : <div ng-controller="formcontroller"> <div class="form-group"> <label class="control-label col-sm-2">products</label> <input auto-complete ui-items="products" ng-model="product"> <button type="button" ng-click="productlist()" class="btn btn-success col-sm-offset-...