Posts

Showing posts from September, 2011

"Unexpected character" error when invoking Neo4j rest endpoint with curl -

i facing problem when invoking cypher query on local running neo4j 3.0 via curl windows command line: curl -h accept:application/json -h content-type:application/json -d '{"statements":[{"statement":"match (a:t_application) return a.id, a.name"}]}' http://localhost:7474/db/data/transaction/commit the response got on windows command line is: {"results":[],"errors":[{"code":"neo.clienterror.request.invalidformat","message ":"unable deserialize request: unexpected character (''' (code 39)): expected valid value (number, string, array, object, 'true', 'false' or 'null')\n @ [ source: httpinputoverhttp@23482f11; line: 1, column: 2]"}]} maybe missed character somewhere or need escape something. hope can me on this. best markus

Facebook Messenger API implementation in c# asp.net mvc app -

in node.js implementation app.post('/webhook/', function(req, res) { console.log("message received " + req.body); if(!req.body){ console.log("no request body found"); res.sendstatus(200); return; } messaging_events = req.body.entry[0].messaging; (i = 0; < messaging_events.length; i++) { event = req.body.entry[0].messaging[i]; sender = event.sender.id; console.log("sender " + event.sender + ", message " + event.message.text); if (event.message && event.message.text) { text = event.message.text; // handle text message sender sendtextmessage(sender, "text received, echo: "+ text.substring(0, 200)); } } res.sendstatus(200); }); how implement in .net mvc application. how implement line app.post('/webhook/', function(req, res) in controller in mvc. at last searching , gathering data facebook post model json data { "entry"

excel - Rearranging custom buttons -

i new programming tried experiment excel ribbons. using custom ui editor. wanted use insertbefore , insertafter controls rearrange custom buttons. if not use unique namespace , insertafterq/insertbeforeq @ button level order of buttons not change, however, if use cannot see related macro (probably due namespace), therefore onaction not after clicking buttons. tried various combinations of idq cannot make work. below example correctly executes button 2 not in namespace specified. simple example: <customui xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:x="mynamespace"> <ribbon> <tabs> <tab idq="x:customtab" label="my order form" insertaftermso="tabhome"> <group idq="x:customgroup" label="my order form tools"> <button idq="x:custombutton1" label="clear" size="large" onactio

serialization - How to implement global string to constructor map in C++? -

i have interface file parser. parser can configured, saved file. new parsers new file types can added using .dll plugins. class fileparserinterface { public: qstring tostring() const = 0; qstring constructorname() const {return "fileparserinterface";} somedatastruct getdata() = 0; } therefore need way save instances name (can name of constructor). have method instance string, eg: static std::shared_ptr<fileparserinterface> fileparserfromstring(const qstring& name, const qstring& parameters); i have no idea how thread-safely implement this. using boost , qt libraries. prefer use stdlib , qt when possible.

apache - How to handle a hardlink with php? -

i have hardlink (created php link() function ) on server named lookslikeadirectorybutreallyisphpfile , linked arealdir/index.php lookslikeadirectorybutreallyisphpfile , arealdir in root directory web server however when request http"//example.com/lookslikeadirectorybutreallyisphpfile source code , not php processed result of code. i attempted handler in root directory's .htaccess file, doesn't anything: <files "lookslikeadirectorybutreallyisphpfile"> sethandler application/x-httpd-php </files>

jsf 2 - Primefaces v.5.3.5 confirm dialog render issue outside main h:form and inside main form is rendered but it is not working properly -

i using pf v.5.3.5 , jsf v.2.2.8. frequent topic in so. noticed there bug in pf v.5.3.5 documentation related appendto attribute. 1st approach the p:confirmdialog rendered , commandbuttons rendered actions not work , message not rendered if placed inside of nested h:form. 2st approach if place dialog outside of main h:form not rendered @ if add global="true" attribute. 3st approach the p:confirmdialog rendered , commandbuttons rendered actions not work , message rendered if nested h:form removed. <h:form> ... <p:confirmdialog id="asksessiondialog1" widgetvar="asksessiondialog1" severity="alert" appendto="@(body)" rendered="#{treedata.asksessiondialogrendered}" visible="#{treedata.asksessiondialogrendered}"> <h:form> <f:facet name="message"> <h:outputte

python - Python3: Continuous variable update within Mainframe -

basically, have created thread continuously writes global variable in infinite loop. have mainframe should read , display variable. the problem once mainframe runs, displays value of variable read @ time of startup, , not continuously update itself. how mainframe update it's variable values specified interval? the variable in question called "data": notes: if run code is, "data" variable set none. adding "time.sleep(5)" before executing mainframe allow time set variable http request, , see data populated. thanks help! #!/library/frameworks/python.framework/versions/3.5/bin/python3 # -*- coding: utf-8 -*- tkinter import * import time import urllib.request bs4 import beautifulsoup import threading queue import queue data = none class httpreq(threading.thread): def run(self): global data while true: url = "https://twitter.com/realdonaldtrump" page = urllib.request.urlopen(url)

internet explorer - UFT opening browser with old session for IE Browser -

i automating website user can login different roles.but, after performing operation specific roles when again opening browser roles uft opening browser old session. note : issue occurring if running test cases in suite. if running scripts individually it's working fine. moreover, using function delete cookies , clear caches before opening browser using command "rundll32.exe inetcpl.cpl,clearmytracksbyprocess 255" please on this. try using browser.deletecookies and/or browser.clearcache .

graphics - Applet Resize in DDA algorithm implementation in Java -

i implementing line dda algorithm in java. code seems fine. the problem facing resizing applet size. applet output small , want work applet window size of 640-by-480. have used resize(640,480) ; in beginning of paint() method not work. is, gives output correct on small window (i think 350-by-200) , enlarges 640-by-480 , program not terminate (i have forcefully exit program). appreciated. implementation code is: package line; import java.applet.applet; import java.awt.color; import java.awt.graphics; import java.util.scanner; public class ddaline extends applet { @override public void paint(graphics g) { //resize(640,480); g.setcolor(color.red); float x,y,x1,y1,x2,y2,dx,dy,steps,incrx,incry; int i; scanner sc = new scanner(system.in); system.out.println("enter value of x1 : "); x1 = sc.nextint(); system.out.println("enter value of y1 : "); y1 = sc.nextint(); syst

Groovy regex PatternSyntaxException when parsing GString-style variables -

groovy here. i'm being given string gstring- style variables in like: string target = 'how brown ${animal}. ${role} has oddly-shaped ${bodypart}.' keep in mind, not intended used actual gstring!!! is, i'm not going have 3 string variables ( animal , role , bodypart , respectively) groovy resolving @ runtime. instead , i'm looking 2 distinct things these "target" strings: i want able find instances of these variables refs ( "${*}" ) in target string, , replace ? ; and i need find instances of these variables refs , obtain list (allowing dupes) names (which in above example, [animal,role,bodypart] ) my best attempt far: class targetstringutils { private static final string variable_pattern = "\${*}" // example input: 'how brown ${animal}. ${role} has oddly-shaped ${bodypart}.' // example desired output: 'how brown ?. ? has oddly-shaped ?.' static string replacevarswithquestionmarks(str

excel - OptionButton numbering loop -

hope have elegant solution simple problem! i using activex option buttons, within worksheet , not userform or group box because of way sheet designed. code contained sub within option button code form. this code pretty self-explanatory of i'm trying do: public sub sectiond_click() if optionbutton1.value = true thisworkbook.sheets("boolean").range("b2").value = 1 elseif optionbutton2.value = true thisworkbook.sheets("boolean").range("b2").value = 0 end if if optionbutton3.value = true thisworkbook.sheets("boolean").range("b3").value = 1 elseif optionbutton4.value = true thisworkbook.sheets("boolean").range("b3").value = 0 end if if optionbutton5.value = true thisworkbook.sheets("boolean").range("b4").value = 1 elseif optionbutton6.value = true thisworkbook.sheets("boolean").range("b4").value = 0 end if end sub i make such num

machine learning - Recommendations without ratings (Azure ML) -

i'm trying build experiment create recommendations (using movie ratings sample database), without using ratings. consider if user has rated movies, interested other movies have been rated users have rated movies. i can consider, instance, ratings 1 (exists in database) or 0 (does not exist), in case, how transform initial data reflect this? i couldn't find kind of examples or tutorials kind of scenario, , don't know how proceed. should transform data before injecting algorithm? and/or there kind of specific algorithm should use? if you're hoping use matchbox recommender in aml, you're correct need identify user-movie pairs are not present in raw dataset, , add these in rating of zero. (i'll assume have set of real user-movie pairs have rating of one, described above.) i recommend generating random candidate pairs , confirming absence training data in execute r (or python) script module. don't know names of dataset's features, here pse

python - Require minimum number of data points for resampling? -

is there way make df2=df2.resample('d',how="mean",label="left",closed="left") requires number of points (say 10) make average. , if there isn't nan day data set looks like: 2004-02-27 20:00:00,2.5666666666666678,0.8638333333333333,,,,,,,,2.5666666666666678,,,,,,4.9,1.0,1.0,1.9088083333333328,0.0214,2.218625,0.0214,246.66666666666663,9.866666666666667,0.0,1.0,1.0 2004-02-27 21:00:00,8.216666666666667,0.95425,,,,,,,,8.216666666666667,,,,,,4.9,1.0,1.0,1.909341666666667,0.0214,2.2172416666666668,0.0214,251.91666666666663,11.308333333333335,0.0,1.0,1.0 2004-02-27 22:00:00,5.116666666666666,0.9855,,,,,,,,5.116666666666666,,,,,,4.9,1.0,1.0,1.9110833333333337,0.0214,2.2185916666666663,0.0214,257.1666666666667,12.54166666666667,0.0,1.0,1.0 you can create boolean mask tells enough data points exist. enough_points = df2.resample("d", label="left", closed="left").count() >= 10 then calculate means

android - Route Calculation not showing route from current position -

i using skmap's calculateroutewithpoints not able route current position. how can set start , end point while calculating routes points(skposition)? instead of using skposition use skviapoints: skroutesettings skroutesetting = new skroutesettings(); skroutesetting.setstartcoordinate(new skcoordinate(77.597231,12.973654)); skroutesetting.setdestinationcoordinate(new skcoordinate(77.614500, 13.009965)); skroutesetting.setroutemode(skroutesettings.skroutemode.car_fastest); skroutesetting.setnoofroutes(1); viapointlist = new arraylist<skviapoint>(); viapointlist.add(new skviapoint(i+1000,newskcoordinate(77.629580,13.020566)); viapointlist.add(new skviapoint(i+1000,newskcoordinate(77.622440,13.037359)); skroutesetting.setviapoints(viapointlist); skroutesetting.setrouteexposed(true); skroutemanager.getinstance().setroutelistener(this); skroutemanager.getinstance().calculateroute(skroutesetting); if using skm

javascript - automatically play sounds on mobile device -

for project, have play sound when scroll finished. on ios devices autoplay disabled. didn't find affordable solution automatically play sound. creating fake click didn't work, guess not real click. any solution ? thnak's help

Is it possible to display a custom message when android application is requesting permission to use the gps, bluetooth, etc... before installation -

http://i.stack.imgur.com/ho31v.png there android application request permission use bluetooth , gps before install. possible diplay message custom content @ moment? you cannot , please see link , questioned before: how can customize permission dialog in android?

How can I use connection pooling in perl using MySQL? -

this question has answer here: perl connection pooling 2 answers we have perl application using dbi connect mysql , execute sql statements. creates multi connections, want handle using connection pooling , have no idea connection pooling. how do this? if there multiple connections same database same dsn inside 1 process, can replace calls dbi->connect dbi->connect_cached , the dbi take care of reusing connections . that's not pooling, should work.

asp.net mvc - Kendo grid prevent server side filtering? -

i have simple kendo-grid configuration below (mvc project) @(html.kendo().grid<reviewmodel>() .name("grid") .datasource(datasource => datasource .custom() .pagesize(20) .schema(schema => schema.model(m => m.id(p => p.id))) .transport(transport => { transport.read("readdata"); }) ) .columns(columns => { columns.bound(m => m.id).visible(false); columns.bound(m => m.code).width(110).filterable(ftb => ftb.cell(cell => { cell.operator("contains"); cell.showoperators(false); })); columns.bound(m => m.name).filterable(ftb => ftb.cell(cell => { cell.operator("contains"); cell.showoperators(false); }));}) .filterable(ftb => ftb.mode(gridfiltermode.row)) .pageable(p => p.enabled(true).info(false).input(true).numeric(fa

How does C++ proceed for += with a variable without value? -

this question has answer here: why uninitialized variable print in c++? 4 answers i learning c++ , had question "weird" things noticed while testing have learnt. so use : int marc[9]; int sum = 0; (int x =0; x < 9; x++) { marc[x] = x*4; sum += marc[x]; } cout << sum << endl; and normal result 144 however, if changed int sum = 0; to int sum; i got crazy result 19557555002 so wondering happening in second case? thanks answer :) you operating on uninitialized memory in second case. non-static local variables not initialized 0 runtime in other languages, if need sum have defined value, must initialize yourself. 19557555002 integer interpretation of bytes present @ memory address allocated sum . further reading: what happens declared, uninitialized variable in c? have value?

javascript - (reactjs) get child component value -

i have following react component timepicker: export default class timepicker extends component{ render(){ return( <div> <input id={this.props.nameid} type="text"></input> </div>); } } timepicker used singletask: export default class singletask extends component{ .... render(){ .... <timepicker nameid="time" /> ..... } } how can access input value in timepicker singletask? you can solve in 2 ways: only change in singletask component: add ref timepicker component , access it's dom. there can query input choice of jquery selector. here have used tag selector (note: there no dependency of jquery included). : export default class singletask extends component{ yourfunction(){ var selectedtime = react.finddomnode(this.refs.timepickercomp).queryselector('input').value; } render(){ .... <timepicker ref="timepickercomp"

.net - Visual Studio my application do not execute (Crash) -

Image
i have problem, developed application in visual studio 2012 before framework 4.0, had migrate framework 4.5 because things. application gets stuck when trying run on client computer (that not have visual studio 2012 installed), on first form appears this: and when click repair, error appears: staff appreciate maximum help, not know whether install program on client computer, tried install pc client framework 4.5.1 did not work , framework 4.0 did not work

java - How to start sevice in dialer (default or stock dialer) of android -

i want start service when dialer (default or stock dialer) open. service toasts message. how start service dialer. startservice command working in mainactivity , not working while dialer open. my code shown below : manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.chatheads"> <uses-permission android:name="android.permission.system_alert_window" /> <uses-permission android:name="android.permission.dial_action" /> <uses-permission android:name="android.permission.call_phone" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity">

javascript - How to take html element without text? -

edit: sorry bad explanation have: var x = $("span", this).get( 0 ); var y = x.outerhtml and give me: <span>'some text'</span> want tag <span></span> atributes. question how it?;p thanks help! the problem in code: var x = $("span", this).get( 0 ); <-- have parent (even tag name) , taking first child var y = x.outerhtml <-- here you're trying parent (you eant - tag name) :% so, if know var x = $("span"... <---- string - can create string want var tag = "span"; var x = $(tag, this).get( 0 ); var y = x.outerhtml; // dumbest way var result = '<'+tag+'>'+'<'+tag+'/>';

java - Authentification failed while connecting to ActiveDirectory from a remote host -

i wrote code on ubuntu 16 , tried connect activedirectory on windows server 2012 virtual machine. user name : siwar user password : siwarmp domain name is: squeezer.celtron.com vm host address (windows server 2012) : 192.168.1.115 following code did not work , generated authentification: package ldap; import java.util.hashtable; import javax.naming.authenticationexception; import javax.naming.context; import javax.naming.namenotfoundexception; import javax.naming.namingenumeration; import javax.naming.namingexception; import javax.naming.sizelimitexceededexception; import javax.naming.directory.attribute; import javax.naming.directory.attributes; import javax.naming.directory.dircontext; import javax.naming.directory.initialdircontext; import javax.naming.directory.searchcontrols; import javax.naming.directory.searchresult; public class ldapmain { static dircontext ctx = null; static string userlog = "cn=siwar,ou=users,dc=squeezer,dc=celtron,dc=com";

java - Android Studio: Variable 'requiredPermissions' is accessed from within inner class, needs to be declared final -

i'm working run time permissions , trying make method displaying permission rationale/s taken permission/s , rationale/s problem is: "variable 'requiredpermissions' accessed within inner class, needs declared final" that's how call method: showrationale(r.string.permission_access_fine_location_rationale, new string[]{manifest.permission.access_fine_location}); and that's method: private void showrationale(int rationale, string[] requiredpermissions) { snackbar.make(findviewbyid(r.id.mycoordinatorlayout), rationale, snackbar.length_indefinite) .setaction(r.string.go_grant_permission, new view.onclicklistener() { @override public void onclick(view view) { // 'requiredpermissions' below causes problem activitycompat.requestpermissions(mapsactivity.this, requiredpermissions, my_permissions_request_a

java - How do we unit test this lambda expression? -

we have rest end point (jax-rs) invoked browser. passing around outputstream have browser display result of call. here method. @path("/mypath/{userid}") @post public response createuser(@pathparam("userid") final int userid ) { streamingoutput stream = (outputstream) -> { user user = userhelper.finduser(userid); userhelper.updateuser(user,outputstream); }; return response.ok(stream).build(); } using junit , mockito, how verify if userhelper.finduser , userhelper.updateuser has been called ? basically want verify interactions. to "unit" test should create test class , create new instance of class method belongs in test class. userhelper not defined in lambda class member? if can mocked: create mock userhelper object mockito inject mock test class. call createuser method. verify on mock assert updateuser method called once. you can go step further , verify user , outputstream objects passed us

swift - Does AVPlayer support .m3u8 format in tvOS -

in tvos app. using .m3u8 format supported video. facing strange problem in video play. when playing video , when trigger system popup (i.e. hold "home" bring "sleep/cancel" popup, or in-app purchase confirmation prompt), , click on cancel button, in condition video play fine. if disconnect network video stop progress bar in continuous running mode. i not understand problem.

c++ - clang-format: how to prevent all function arguments on next line? -

i have c++ function call i've manually , intentionally formatted this: dosomethingforapurposethatcausesalongfunctionname( arg_0, arg_1, arg_2); clang-format wants re-format this: dosomethingforapurposethatcausesalongfunctionname( arg_0, arg_1, arg_2) i not want this. allowallparametersofdeclarationonnextline appears control behavior function declarations, function calls? there corresponding setting? my .clang-format looks this: basedonstyle: google binpackarguments: false binpackparameters: false allowallparametersofdeclarationonnextline: false alignafteropenbracket: alwaysbreak i think need allowallparametersofdeclarationonnextline: true it works me unless first argument on same line function call, in case puts them on same line. i have experimentalautodetectbinpacking: false which may have effect? i'm using version 3.8.0.

c++11 - C++ Embded lambda in initializer list for const vector member -

i have class has const vector member holds unique pointers objects. when constructed, sequence object should steal ownership of vector of unique pointers passed constructor sequence object owner of objects owned unique pointers in vector parameter. class sequence { const std::vector< std::unique_ptr< statement > > m_statements; sequence( std::vector< std::unique_ptr< statement > > & statements ); }; the first time tried implement constructor, did following : sequence::sequence( vector< unique_ptr< statement > > & statements ) m_statements( statements ) { } but of course not compile since 1 can't copy-construct unique_ptr , can't copy-construct vector . c++ doesn't allow initialize const members in body of constructor (like java final members), within initializer list. thus, 1 possible solution drop const modifier of m_statement and, using loop, move content 1 vector other in body of constructor. b

Maximo Anywhere 7.6 - Physical Count App - Issue during the Physical Count Update -

while updating physical count of item in physical count app, below error being thrown. i'm able update physical count maximo portal. unable understand root cause of issue. could please help? [7/28/16 10:49:33:896 utc] 000053ad systemout o 28 jul 2016 10:49:33:896 [error] [maximo] [cid-mxoslc-3849] processing failed oslcinvbalview. object structure 1. primary object invbalancesview. key null.bmxaa1840e - inventory transaction records cannot inserted directly here. [7/28/16 10:49:33:896 utc] 000053ad systemout o 28 jul 2016 10:49:33:896 [error] [maximo] [cid-mxoslc-3849] bmxaa1840e - inventory transaction records cannot inserted directly here. psdi.util.mxapplicationexception: bmxaa1840e - inventory transaction records cannot inserted directly here. @ psdi.app.inventory.invtrans.add(invtrans.java:168) @ psdi.mbo.mboset.addatindex(mboset.java:4584) @ psdi.mbo.mboset.add(mboset.java:4493) @ psdi.app.inventory.invbalances.adjustphysicalcount(invbalances

mongodb - Can't extract geo keys -

i try create 2dsphere index in mongodb, error "can't extract geo keys: { _id: objectid('57963b5365ba4df2c13a4965'), loc: { coordinates: [ -180.0, 65.33018130000001 ], type: \"point\" } } longitude/latitude out of bounds, lng: -180 lat: 65.3302" why happening?

c - Unintentional infinite 'for' loop -

i started programming in c, , while practicing loops, came following piece of code: #include <stdio.h> int main() { int x; (x=0;x=10;x=x+1) printf("%d\n",x); return 0; } when run code, fall infinite loop. in c manual says condition x =10 true, can't head around it. if give variable x value of 0 @ beginning, should loop not start, or when value of x reaches 10, shouldn't loop stop? thanks in advance! the condition part of for loop wrong. doing : for (x = 0; x = 10; x = x +1) { // operations } the condition have got here x = 10 affectation. x = 10 return 10, means true . for loop equivalent : for (x = 0; true; x = x + 1) { // operations } this why have got infinite loop, should replace affectation operator = comparason 1 2 equals sign == . means for loop while x equals 10. edit : virgile mentioned in comments, second for loop, x go 0 int_max , behavior undefined.

concept and advantages of Transient and Non-Transient memory in ARM? -

in arm architecture manual mentioned cache can transient , non transient , implementation defined. failing understand concept , use of transient memory respect cache. trying write software enabling mmu , have enabled l1 , l2 cache. using lpae. know mair register controls attribute. failing documentation it. i want know concept want check feasibility of applying present design. arm-v7-a-r page 134 "for armv7-a implementation includes large physical address extension, implementation defined whether transient attribute supported cacheable normal memory regions. if implementation supports attribute, set of possible cacheability attributes normal memory region becomes: • write-through cacheable, non-transient • write-back cacheable, non-transient • write-through cacheable, transient • write-back cacheable, transient • non-cacheable." the arm arm says, shortly after part you've quoted: the transient attribute indicates benefit of caching relative

java - Tomcat doesnt log anything after it started -

i'm working intellij idea, on spring boot application. today noticed don't tomcat logs anymore, after tomcat started, while tomcat starting logs mapping security configuration sql requests until it's started, when changes in application, calling service inserts data database. i tried change log4j had same problem, configured logging file in application.properties, , when watched had same problem, looks problem tomcat, cant figure out. how can solve problem ? edit: here configs used logging: debug=true spring.output.ansi.enabled=always logging.file=c:\\users\\***\\desktop\\log.txt and library i'm using: <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-tomcat</artifactid> <exclusions> <exclusion> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-

sql - Extract a specific line from a SELECT statement based on the last Trasanction date -

good day, i have sql code return me quantities received on time, want display latest one select * (select distinct [dbo].[ttcibd001110].[t_cmnf] [manufacturer], [dbo].[ttcibd001110].[t_item] [item code], [dbo].[ttcibd001110].[t_dsca] [description], [dbo].[ttcibd001110].[t_seak] [search key 1], [dbo].[twhinr110110].[t_trdt] [transaction date], [dbo].[twhinr110110].[t_cwar] [warehouse], [dbo].[twhinr110110].[t_qstk] [quantity inventory unit] [dbo].[twhinr110110] left join [dbo].[ttcibd001110] on [dbo].[twhinr110110].[t_item]=[dbo].[ttcibd001110].[t_item] [dbo].[twhinr110110].[t_koor]='2' , [dbo].[ttcibd001110].[t_cmnf]='manufacturerx') tabel ltrim(tabel.[item code])='1000045' now, selection want select line latest transaction date, stuck. can me in way? thank you! change beginning select top 1 and after use order [transaction date] desc

Customize forgot_password.jsp in Liferays login hook -

use case: an existing liferay user has forgotten password. he clicks on link "forgot password" (login hook). the user enters loginname screenname . now problem: if user enters loginname (which i recognize regex) , clicks button "send new password" want prevent default action of button , display infomessage instead (eg. can't send new password...) to honest have no idea @ moment how approach this... maybe create ext plugin , override forgotpasswordaction class? is possible within forgot_password.jsp ? can without writting plugin ? hope can me. thanks without plugin no, can not that. the simplest way make if password check done in javascript or maybe control using ajax use jsp hook , place code in forgot_password.jsp 2. second way make struts action hook override default action /login/forgot_password of update password form.for in liferay-hook.xml add: <struts-action> <struts-action-path>/login/forgot_p

Quickly add blank lines at specified line numbers using vim? -

i know how add blank lines above or below current position of cursor (using o , o ) there quick way add blank lines @ arbitrary line numbers? realize original line numbers give no longer accurate after first blank line has been added, e.g. if wanted add blank lines line 5, 10, , 15, after blank line has been added line 5, second blank line should added line 11, , third blank line should added line 17. edit: can use macro task, i.e qao<esc>q . have still manually move line numbers individually. here general way add blank lines in specific line number without affecting other lines: :g/^/if (index([5,10,15],line('.')) != -1)| s//\r/g |endif you can add or change items in list [5,10,15] ( inside index() function ). items lines affected.

java - Unable to build Hibernate SessionFactory -

hello i'm experiencing error when trying build entitymanager hibernate. ...info | 2016-07-28 14:55:20 | [main] internal.pooledconnections (pooledconnections.java:39) - hhh000115: hibernate connection pool size: 20 (min=1) info | 2016-07-28 14:55:20 | [main] dialect.dialect (dialect.java:153) - hhh000400: using dialect: org.hibernate.dialect.postgresql95dialect info | 2016-07-28 14:55:20 | [main] internal.lobcreatorbuilderimpl (lobcreatorbuilderimpl.java:124) - hhh000424: disabling contextual lob creation createclob() method threw error : java.lang.reflect.invocationtargetexception info | 2016-07-28 14:55:20 | [main] type.basictyperegistry (basictyperegistry.java:148) - hhh000270: type registration [java.util.uuid] overrides previous : org.hibernate.type.uuidbinarytype@550a1967 exception in thread "main" javax.persistence.persistenceexception: [persistenceunit: entitymanager] unable build hibernate sessionfactory @ org.hibernate.jpa.boot.internal.entitymanagerfac

python - How to execute multiple update queries once in pymongo? -

i have more 100000 update queries need execute, db.collection_name.update(upsert=true) can execute 1 query statement,it slow if execute queries 1 one. is there way collect multiple queries list execute once in pymongo? i tried use bulk , , doesn't save time, not transaction operation :( here code snippet: bulk = self._db.initialize_unordered_bulk_op() user_id, result in results.items(): time_stamp = time.strftime('%y-%m-%d:%h:%m:%s') history = { 'create_at': time_stamp, 'results': result } bulk.find({'user_id': user_id}).update( {'$set': {'update_at': time_stamp}} ) bulk.find({'user_id': user_id}).update( {'$addtoset': {'history': history}} ) bulk.execute() it same speed following update statement: self._db.update( {'user_id': user_id}, {'$set': {'update_at':time.strftime('%y-%m-%d:%h:%m:%s')}},

javascript - Image is occupying only in little space inside box -

Image
we using stackoverflow links code upload image in site once upload, occupying little part in box here . but image should occupy full box. var canvas = new fabric.canvas('canvas'); document.getelementbyid('file').addeventlistener("change", function (e) { var file = e.target.files[0]; var reader = new filereader(); reader.onload = function (f) { var data = f.target.result; fabric.image.fromurl(data, function (img) { var oimg = img.set({left: 0, top: 0, angle: 00,width:100, height:100}).scale(0.9); canvas.add(oimg).renderall(); var = canvas.setactiveobject(oimg); var dataurl = canvas.todataurl({format: 'png', quality: 0.8}); }); }; reader.readasdataurl(file); }); canvas{ border: 1px solid black; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://rawgit.com/kanga

c++ - Drawing 2D stuff with SDL_Renderer and OpenGL stuff with SDL_GLContext -

i have been learning sdl 2d programming while , wanted create program using sdl , opengl combined. set this: sdl_init(sdl_init_video); window = sdl_createwindow("sdl , opengl", sdl_windowpos_centered, sdl_windowpos_centered, width, height, sdl_window_opengl); context = sdl_gl_createcontext(window); the program black window white line displayed using opengl. here code rendering: glclearcolor(0, 0, 0, 0); glclear(gl_color_buffer_bit); glbegin(gl_lines); glvertex2d(1, 0); glvertex2d(-1, 0); glend(); sdl_gl_swapwindow(window); so thing is, render textures additionally using pure sdl , sdl_renderer object, did before without opengl. tried out didn't work. possible , how? did creating sdl_renderer , after drawing opengl stuff doing this: sdl_rect fillrect; fillrect.w = 50; fillrect.h = 50; fillrect.x = 0; fillrect.y = 0; sdl_setrenderdrawcolor(renderer, 100, 200, 100, 0); sdl_renderfillrect(renderer, &fillrect); sdl_renderpresent(rendere

c++ - const correctness and member pointers -

i have const on accelerate method, yet can call power method. way stop this. class engine{ public: void power(){ } }; class car{ public: car() : p(new engine()){} void accelerator() const{ p->power(); } private: engine* p; }; for car , const method methods not modify car member variables. so, long car::accelerator not make p point different location, valid. since p not modified in accelerator (meaning not point different memory address), program valid. the moment make p point different location, program fails compile: void accelerator() const { p= nullptr; //wrong }

R leaflet Language of the map : Can we specify to use English language -

Image
i have started use leaflet package shiny in r. regions china, in map abbreviation in chinease language. can changed english? i searched on web. not able understand, , how search this. appreciated. what see on map tiles, plain images generated tile server specify (or use default). in case, tile server openstreetmap: exact same tiles on openstreetmap.org website (see example: http://www.openstreetmap.org/#map=4/28.46/86.92 ) as these images, understand cannot change them. now can change tile server until find 1 serves images names in language need. have @ http://leaflet-extras.github.io/leaflet-providers/preview/ example.

windows 10 universal - AppStudio App not showing keyboard -

i have created simple appstudio app on microsoft website. web hosted app, simple container website. however, whenever click on text field keyboard not automatically pop up. have tried both mode on , off no avail. work on websites not sure if app itself. any appreciated. thank you

javascript - better design for Ajax replace div with another div -

i new ajax. have template has "name" , button. wheni button clicked, name , button replaced messages. code works perfectly. ajax: $('#fulfillbutton').bind('click',function() { $.ajax({ type : "get", contenttype : "application/json; charset=utf-8", url : "/order/${orderid}", datatype : "json", cache: false, timeout: 12000, success: function (data) { alert("success"); }, error: function (data,textstatus) { if(textstatus == "timeout") { $('#main-panel').replacewith('<div class="error-message">' + "timeout, please clcik button beblow scan again!" + '</div>'); } else { var responsetext = data.

javascript - controller from another module not working -

hey having problem trying child controller working. have created 2 modules in total. 1 handling directives , controllers them , handle gmail side of things. //js file 1 var gmailmod = angular.module('gmailmod', []); gmailmod.controller('gmailctrl',function gmailctrl(gmailfactory){ this.authorize = function(){ console.log("clicking"); //gmailfactory.gmailauthorize(); } }); //jsfile2 var emailmodule = angular.module('emailmod', ['ui.bootstrap']); i have third file called config declares dependencies angular.module('seamysapp', ['ngroute', 'emailmod', 'gmailmod']) so anyways email mod works when try declare child controller on button form gmailmod <div ng-controller="gmailctrl"> <button ng-click="authorize()" class="btn-info" >not authorized yet! click here! :)</button> </div> nothing works. can't authorize function

docusignapi - Not receiving event notification from DocuSign API -

i using docusign rest api v2. during envelope creation process, send our rest api url receive notifications. the events receiving in our live setup. in our local development setup not receiving notifications. for this, have whitelisted ip ranges mentioned in docusign page on our side. https://trust.docusign.com/en-us/trust-certifications/ip-ranges/ but still, not receiving notifications development setup. what else need done? unfortunately i'm unable respond original post, i've experienced same issue (reported here ). appears occur when envelopes sent far can tell, , i'm able retrieve status afterwards - it's not in line api guide tells us, nor happening previously.

Is it possible to send JSON object in HTTP GET request in android? -

i have json object , wanted send server via http request form android device. possible send json in http request? you use post method send json objects server. can use great example. post json android device

c++ - Template inheritance and a base member variable -

i weird error when trying use template inheritance. code: template <class t> class { public: int {2}; a(){}; }; template <class t> class b : public a<t> { public: b(): a<t>() {}; void test(){ std::cout << "testing... " << << std::endl; }; }; and error: error: use of undeclared identifier 'a'; did mean 'std::uniform_int_distribution<long>::a'? void test(){ std::cout << "testing... " << << std::endl; } and in case affect use these flags: -wall -g -std=c++11 i don't know wrong since same code pure classes without templating works fine. i don't know wrong since same code pure classes without templating works fine. this because base class (class template a ) not nondependent base class, type can't determined without knowing template arguments. , a nondependent name. nondependent names not looked in dependent base

java - I want to add object to realm DB every time an item is clicked from the recyclerview -

i followed tutorial it's not working well, here's did: public class realmhelper { realm realm; realmresults<fav_places> fav_places; boolean saved; public realmhelper(realm realm) { this.realm = realm; } public boolean save(final fav_places favs) { if (favs == null) { saved = false; } else { realm.executetransaction(new realm.transaction() { @override public void execute(realm realm) { try { fav_places fav = realm.copytorealm(favs); saved =true; } catch (realmexception e){ e.printstacktrace(); saved=false; } } }); } return saved; } public list<com.nuku.mc.populate_recyclerview.fav_places> retreivefrom() { fav_pla