Posts

Showing posts from March, 2014

python - How to download a file from Mozilla Firefox using HTML? -

my task is, if user clicks download link download file, file should automatically downloaded. done task , got successful output in browsers chrome , ie.now problem is, code not working browsers mozilla firefox , safari. please me solve issue. ff = open('sample.html','a') ms = """<h2>product summary</h2> <center><table border = "1"> <tr> <th>product id</th> <th>product download</th> </tr>""" ff.write(ms) row in __builtin__.product_info: ff.write("<tr>") ff.write("<td> %s</td>" %str(row[0]).strip()) ff.write("<td>") ff.write("<a href= '%s' download>download</a>" %str(row[1]).strip()) #(the problem here..) ff.write("</td>") ff.write("</tr>") m = """</center></table> <br> </pre> </b

c# - Error : possible unintended reference comparison to get a value comparison cast the right hand -

i have following code gives warning "possible unintended reference comparison; value comparison, cast right hand side type string ": // ocontrol of type control if ((ocontrol.name == odatarowview["conname"].tostring())) { //do stuff } else { //do other stuff } i've tried fix using each of following still warning if ((ocontrol.name == convert.tostring(odatarowview["conname"]))) { //do stuff } else { //do other stuff } if ((ocontrol.name == (string)odatarowview["conname"])) { //do stuff } else { //do other stuff } please explain reason still warning , best practice way deal this? these options work: if (equals(ocontrol.name, odatarowview["conname"])) // best option if ((string)ocontrol.name == odatarowview["conname"].tostring()) // assuming neither item null if (ocontrol.name string == odatarowview["conname"] string) // assuming second item string

java - Declaring scope for a bean -

my code: <?xml version="1.0" encoding="utf-8" standalone="no"?> <!doctype beans public "-//spring//dtd bean //en" http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="person" class = "org.dalai.listpers.person" scope = "singleton"> </bean> </beans> i think doing right, anyway error on line 4 : attribute "scope" must declared element type "bean" any hints how solve appreciated the scope attribute supported in spring 2.0, , have using correct dtd/schema. you can refere below link same. http://forum.spring.io/forum/spring-projects/aop/22379-why-does-scope-attribute-cause-xml-parsing-exception

oracle - Extract text from CLOB PL/SQL NameSpace -

i trying extract data clob column , see in separate column. query using: select xmltype(t.detailbericht).extract('//tekst_reden_afwikkeling/text()').getstringval() ozg_if.mtwk_abcdef t the colum t.detailbericht contains clob text following contents: <ns0:zaak xmlns:ns0="http://www.xxxxx.xx/xxx_xxx_xxxxxxxxxxxx/text_text_v002"> <ns0:code_reden_afwikkeling>d99</ns0:code_reden_afwikkeling> <ns0:tekst_reden_afwikkeling>volledig betaald</ns0:tekst_reden_afwikkeling> <ns0:code_koptekst>490</ns0:code_koptekst> <ns0:omschrijving_koptekst>volledig voldaan.</ns0:omschrijving_koptekst> </ns0:zaak> anybody got ideas? hmm apparently seems work when replace ns0: nothing code using: xmltype(replace(t.detailbericht,'ns0:','')).extract('//tekst_reden_afwikkeling/text()').getstringval() tekst_reden_afwikkeling

html - What is wrong with my CSS code? -

i'm new html / css. want build web site stumbled across problem. my divs inside "content div" have blank space @ top line div, , can't seem figure out causing problem. can please help? apreciate it. thank you! <head> <meta charset="utf-8"> <title>vlad olar</title> <style type="text/css"> body { padding:0; margin:0; font-family:lato, segoe, "segoe ui", "dejavu sans", "trebuchet ms", verdana, sans-serif; background-color:#d8dce1; } .clear { clear:both; } .fixedwidth { width:960px; margin:0 auto; padding:0 0; } #topbar { background-color:#4c7585; height: 40px; width: 100%; } #front { height: 360px; width: 100%; background-color:#d8dce1; } #line { height:10px; width:100%; background-color:#4c4c4c; } #foto { height:120px; wid

how to send JSON to a REST web service -

i wrote simple web service in mailrest class path: @path("/service") the post method want test is: @post @path("/sendtest/") @consumes(mediatype.application_json) @produces(mediatype.text_plain) public string test(jsonobject json) { string input = (string) json.get("input"); string output = "the input sent is:" + input; system.err.println(output); return "hello"; } my mailrestclient class is: static final string rest_uri = "http://localhost:9999/mail"; static final string mail = "service/sendtest"; public static void main(string[] args) { mail mail = new mail(); mail.setfrom("testfrom"); mail.setto("testto"); byte[] attachment = new byte[] {}; string attachmentbase64encoded = datatypeconverter.printbase64binary(attachment); gson g = new gson(); string json = g.tojson(mail); ????? } i understand best method calling i saw exam

vba - Excel file contains invalid hidden characters that can't be removed -

i have peculiar problem hidden characters in excel spreadsheet uses vba create text file. i've attached link test version of file, , i'll explain best can issue. the file creates plain txt file can used feed data system use. works normally, we've been supplied approximately 15,000 rows of data, , @ random points throughout there hidden characters. in test file, there's 1 row , it's cell b11 has hidden characters @ beginning , end of value. if put cursor @ end of it, , press backspace key, if nothing has happened, you've deleted 1 of characters. as far excel concerned, hidden characters question marks, they're not, text stream parse those, doesn't, , instead throws invalid procedure call error. i've tried using excel's clean formula, i've tried vba equivalent, tried using 'replace', nothing seems recognise characters. excel convinced they're question marks, ascii character call gives me same answer (63), replace doesn&#

linux - Cut 13*10^6 lines from file -

so i've got file contains 63*10^6 lines. need cut first(or last) 13*10^6 of lines there , write file. best way it? the tool called tail , can give -n flag , if use + in front, skips amount of lines. thus: tail -n +13000000 < file_in > file_out will skip first 13 million lines. analogue head show first lines, if write: head -n -13000000 < file_in > file_out it print 13 million last ones. the < , > i/o redirections , means head (or tail ) read file_in , write file_out .

java - Execution failed for task ':app:dexDebug' in Android Studio -

com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.7.0_75\bin\java.exe'' finished non-zero exit value 2 when developing app error , not able run app. build getting successful. not run app. please provide me information solve this........ and getting exception while build app aapt err(1229713066): c:\users\rramnath143729\androidstudioprojects\appathon_app\app\src\main\res\drawable-hdpi\ic_drawer.png: libpng warning: iccp: not recognizing known srgb profile has been edited aapt err(2016822147): c:\users\rramnath143729\androidstudioprojects\appathon_app\app\src\main\res\drawable-mdpi\ic_drawer.png: libpng warning: iccp: not recognizing known srgb profile has been edited aapt err(949986979): c:\users\rramnath143729\androidstudioprojects\appathon_app\app\src\main\res\drawable-xhdpi\ic_drawer.png: libpng warning: iccp: not recognizing known srgb profile has been edited aa

java - Updating a column value of type json failed with an exception -

i using postgresql , 1 of column of type json . i using rest api , response json string storing in json column. using hibernate, not able update column. note: using google gson make json , store db. example: gson gson = new gson(); mybean.setjsondata(gson.tojson(response)); myhomedao.attachdirty(mybean); //error here log: caused by: org.postgresql.util.psqlexception: error: column json_data" of type json expression of type bytea hint: need rewrite or cast expression. position: 247 @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2198) @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:1927) @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:255) @ org.postgresql.jdbc2.abstractjdbc2statement.execute(abstractjdbc2statement.java:561) @ org.postgresql.jdbc2.abstractjdbc2statement.executewithflags(abstractjdbc2statement.java:419) @ org.postgresql.

web services - What is the reason of java.lang.reflect.InvocationTargetException when calling a SOAP WS? -

i tryig understand soap ws. write simple classes follow. when deploy application in glassfish , test it, server returns java.lang.reflect.invocationtargetexception. can problem is? @webservice public class authorws { authorservice authorservice = new authorservice(); @webmethod public author getauthorbyid(int authorid) { return authorservice.getauthorbyid(authorid); } @webmethod public arraylist<author> getallauthors() { return authorservice.getallauthors(); } } service class: public class authorservice { authordao authordao = new authordao(); public author getauthorbyid(int authorid){ return authordao.getauthorbyid(authorid); } public arraylist<author> getallauthors(){ return authordao.getallauthors(); } } dao class: public class authordao { public author getauthorbyid(int authorid){ sessionfactory sessionfactory = new configuration().configure().buildsessionfactory(); criteria criteria = sessionfactory.opensession().createcriteria

excel - How to get timestamp of a remote country in VBA? -

i want timestamp of different country in vba. there direct function or way it? example, in india working mexico , want task based on mexican time. able splitting timestamp , manipulating not consider daylight saving in it. there simple solution writing big user-defined function? know time zone offset & client's time zone offset, use calculate difference dim indiatz single dim mexicotz single dim mytime date dim utc date dim mexicotime date indiatz = 5.5 mexicotz = -4 'note assumes they're in eastern time, 'mexico covers central, mountain & pacific @ -5, -6 & -7. 'you'll need figure out 1 need. mytime = 'need invert offset india utc utc = datediff("h", mytime, indiatz * -1) 'need invert offset utc mexico mexicotime = datediff("h", utc, mexicotz * -1)

c++ - Where is cdb.exe located in Visual Studio 2013? -

i'm trying configure debugger qt creator. however, can't find cdb.exe. internet, found out supposed located in c:\program files (x86)\windows kits\8.0\debuggers\x64\cdb.exe . yet, don't have directory c:\program files (x86)\windows kits\8.0\debuggers . have directory called c:\program files (x86)\windows kits\8.1\debuggers\x64 contains files dbghelp.dll , srcsrv.dll , symsrv.dll . cdb.exe , gui equivalent windbg.exe part of debugging tools windows , have downloaded part of windows sdk, in past has been part of ddk also. you can here: https://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx if you're interested in tools there link standalone debugging tools (as part of windows 8.1 sdk) here: https://www.microsoft.com/click/services/redirect2.ashx?cr_eac=300135395 dbghelp.dll, srcsrv.dll , symsrv.dll shipped part of windows , has been since windows 2000 (i think true of dbghelp.dll).

c# - SqlDependency fires immediately -

i want use sqldependency notifications when datas changed others applications using database. public class databasechangesnotification : idisposable { private static string chainedeconnexion = configurationmanager.connectionstrings["transfertcontext"].connectionstring; private static readonly lazy<databasechangesnotification> _instance = new lazy<databasechangesnotification>(() => new databasechangesnotification()); private databasechangesnotification() { system.diagnostics.trace.writeline("--- sqldependency start ---"); sqldependency.start(chainedeconnexion); } public void dispose() { system.diagnostics.trace.writeline("--- sqldependency stop ---"); sqldependency.stop(chainedeconnexion); } public static databasechangesnotification instance { { return _instance.value; } } public void abonnernotification(string req

escaping - Working with Parameters containing Escaped Characters in Python Config file -

i have config file i'm reading using following code: import configparser cp config = cp.configparser() config.read('mtxxx.ini') mt=identify_mt(msgtext) schema_file = config.get(mt,'kbfile') fold_text = config.get(mt,'fold') the relevant section of config file looks this: [536] kbfile=mt536.kb fold=:16s:transdet\n later try find text contained in dictionary matches 'fold' parameter, i've found if find text using following function: def test (find_text) return {k k, v in dictionary.items() if find_text in v} i different results if call function in 1 of 2 ways: test(fold_text) fails find data want, but: test(':16s:transdet\n') returns results know there. and, if print content of dictionary, can see is, expected, shown as :16s:transdet\n so, matches when enter search text directly, doesn't find match when load same text in config file. i'm guessing there's magic being applied here when

html - Modifying a XSLT XPATH code for a different output -

Image
i need modify xslt code different output result. need output table sigle, number of students , average. here's xml code : <?xml version="1.0" encoding="iso-8859-1" ?> <?xml-stylesheet href="class.xsl" type="text/xsl" ?> <university> <student><sname>charlie parker</name> <course sigle="inf8430" note="69" /> <course sigle="inf1030" note="65" /> <course sigle="inf1230" note="73" /></student> <student><name>miles davis</name> <course sigle="inf8430" note="65" /> <course sigle="inf1030" note="77" /> <course sigle="inf1230" note="83" /></student> <student><name>john coltrane</name> <course sigle="inf9430" note="24" /> <course sigle="inf1030" note="64" />

performance - Gradle build is too slow -

for example if changed small code result in gradle console x processing com/google/android/gms/internal/c$b.class... processing com/google/android/gms/internal/f.class... processing com/google/android/gms/internal/iy$1.class... processing com/google/android/gms/internal/kj.class... processing com/google/android/gms/internal/qn.class... processing com/google/android/gms/internal/jl$a.class... processing com/google/android/gms/internal/qo.class... processing com/google/android/gms/internal/os.class... processing com/google/android/gms/internal/c$d.class... processing com/google/android/gms/internal/qw.class... processing com/google/android/gms/internal/ke$1.class... processing com/google/android/gms/internal/qt.class... processing com/google/android/gms/internal/jt$a$a.class... processing com/google/android/gms/internal/jv$1.class... processing com/google/android/gms/internal/ju$a.class... processing com/google/android/gms/internal/li.class... processing com/google/android/gms/inte

Qlikview folder list using QMS api -

Image
i able list of qlikview files using following code qms api. string key = client.gettimelimitedservicekey(); servicekeyclientmessageinspector.servicekey = key; serviceinfo[] qvservice = client.getservices(servicetypes.qlikviewserver); documentnode[] alldocs = client.getuserdocuments(qvservice[0].id); but lists qlikview files. folders? can kindly suggest me code folders well? there sample in qms api documentation under getsourcedocumentfolders method. example writes name of documents , folders console using recursion navigate through sub folders. this not need, can adapt store these in array, etc. have attempted change variable names match code supplied: list<documentfolder> sourcedocumentsfolders = client.getsourcedocumentfolders(qvservice[0].id, documentfolderscope.general | documentfolderscope.services); foreach (documentfolder sourcedocumentfolder in sourcedocumentsfolders.orderby(x => x.general.path)) { // print names of source d

java - Use of the Service method in Servlet while there is already doGet and other 6 methods present -

i coding simple servlet . prints values passed user , or in respective url parameters. when implementing doget method , saw same function can performed service method . code below : protected void service(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { printwriter o = resp.getwriter(); string user = req.getparameter("username"); httpsession session = req.getsession(); servletcontext context = req.getservletcontext(); if (user != "" && user != null) { session.setattribute("myhuzu", user); context.setattribute("myhuzu", user); } o.println("request parameter has value " + user); o.println("session parameter has user name " + session.getattribute("myhuzu")); o.println("context parameter has user name " + context.getattribute("myhuzu")); o.println(&quo

c# - using linq on datatable and putting result back into datatable with same format -

what m trying relatively simple. use linq compute aggregated function on group , put result datatable of same format. did lot of research , think should use system.data.datasetextensions , copy datatable funtion. here random datatable: datatable adatatable = new datatable("adatatable"); // fake table data adatatable.columns.add("plant", typeof(int)); adatatable.columns.add("pdcatype_name", typeof(int)); adatatable.columns.add("month", typeof(int)); adatatable.columns.add("year", typeof(int)); adatatable.columns.add("status_name_report", typeof(string)); adatatable.columns.add("savings_per_month", typeof(double)); (int = 0; < 15; i++) { (int j = 1; j < 5; j++) { datarow row = adatatable.newrow(); row["plant"] = j; row["pdcatype_name"] = j;

Stalk bar chart in controlled order in SAS -

i want create stlak bar charts, column workscope having hsb,ohs,res. want reorder workscope in order of ohs,hsb,res in stalk bar. default taking in alphabetical order. how can achieve it. goptions reset=all; goptions colors=(red blue green); legend1 label=none order=('ohs' 'hsb' 'res'); proc gchart data=finalrepv3; vbar year / discrete type=sum sumvar=value subgroup=workscope legend=legend1 ; run; you can create sorting variable beforehand, use sort input data , plot using proc sgplot xaxis discreteorder = data . /* create dummy sorting variable */ data want; set finalrepv3; if workscope = "ohs" _sort = 1; if workscope = "hbs" _sort = 2; if workscope = "res" _sort = 3; run; /* put data in required order */ proc sort data = want; _sort; run; /* create plot */ proc sgplot data = want; vbar year / group = workscope response = value stat = sum; /* request x axis respe

r - Post-processing of rules from arules -

is there way how more 1 level of single variable gets used in single rule generated apriori in arules package? consider following example: df <- read.table(header = true, text = ' v1 v2 v3 d x d x d y b d x b d x b d y e y e y e x b e y b e y b e x c d y ') library(arules) rules <- apriori(df, parameter = list(support= 0.001, confidence = 0.5, target = "rules"), appearance = list(rhs=c("v3=x"), default = 'lhs')) inspect(sort(rules, decreasing = true, = "confidence")) output> lhs rhs support confidence lift 1 {v1=a, v2=d} => {v3=x} 0.1538462 0.6666667 1.444444 2 {v1=b, v2=d} => {v3=x} 0.1538462 0.6666667 1.444444 3 {v2=d} => {v3=x} 0.3076923 0.5714286 1.238095 4 {v1=a} => {v3=x} 0.2307692 0.5000000 1.083333 5 {v1=b} => {v3=x} 0

sapui5 - How can I add onfocus() functionality in text field in sap ui5 instead of liveChange() -

how can add onfocus() functionality in text field in sap ui5 instead of livechange(), have tried using onfocusin(), not working, suggest more functionalities. use attachbrowserevent method: oyourtextcontrol.attachbrowserevent("onfocus", function(oevent) { // whatever }); https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.control.html#attachbrowserevent

javascript - Why is my function not returning accurate count? -

expanding code i've been working on supplement tracker current function not returning accurate count of numbers greater average 'mean' nor count of integers below mean average. i've commented out 2 questions within code because don't quite understand why array set index[0]. i've learned comments , searching answers here. thankful site exists! looking learn bit more question. function supparray() { var nums = new array(); //create array var sum = 0; //variable hold sum of integers in array var avg = 0; //variable hold average var i; var count = 0; var count2 = 0; var contents = ''; //variable hold contents output var dataprompt = prompt("how many numbers want enter?", ""); dataprompt = parseint(dataprompt); for(i = 0; <= dataprompt - 1; i++) { //loop fill array numbers nums[i] = prompt("enter number",""); nums[i] = parseint(nums[i]); contents += nums[i] + " &qu

.net - Is using Xpath necessary when automating Sitecore testing with Webdriver -

i'm building out automated testing framework sitecore. i'm using xpath locate of elements because sitecore generates ids dynamically every time load page. can tedious. there better way this? should using xpath? thanks! not sitecore other sites or web applications find web-elements(dom level) changes dynamically, cannot depend on 1 or specific element locater type identifying them uniquely. you have select locater type wisely. because times may find class-name or link text more suitable xpath or css. also not single locater useful identify our web-element, can go sikuli , autoit or other tool can used web object identification. such objects can found in web-sites flash contents. answering efficient method quite difficult the xpath , css 1 can rely on most.

java - @jsonRootName not working with spring boot starter hateoas -

i developing rest application using spring-boot , using spring-hateoas . , dto have written is: bill.java @jsonignoreproperties(ignoreunknown = true) @jsonrootname("bills") public class bill{ depedencies: dependencies { compile "org.springframework.boot:spring-boot-starter-hateoas" compile "org.springframework.boot:spring-boot-starter-ws" compile "org.springframework.boot:spring-boot-starter-actuator" compile "org.springframework.cloud:spring-cloud-starter-eureka:${springcloudversion}" testcompile("org.springframework.boot:spring-boot-starter-test") } application.java: @configuration @import(billserviceconfig.class) @enableautoconfiguration @enableeurekaclient @componentscan({"com.billing"}) @enablewebmvc @enablehypermediasupport(type = enablehypermediasupport.hypermediatype.hal) public class application { billcontroller.java: @requestmapping(method = requestmethod.get, value = "") pu

c# - How to convert a view into a PNG? -

i want create png view. using code: //i instance user control ucformtoprintview miviewtoprint = new ucformtoprintview(); miviewtoprint.datacontext = ((ucformtoprintview)ccform).datacontext; //i use rendertargetbitmap render user control system.windows.media.imaging.rendertargetbitmap rtb = new system.windows.media.imaging.rendertargetbitmap(794, 1122, 72, 72, system.windows.media.pixelformats.pbgra32); rtb.render(miviewtoprint); //i use encoder create png system.windows.media.imaging.pngbitmapencoder encoder = new system.windows.media.imaging.pngbitmapencoder(); encoder.frames.add(system.windows.media.imaging.bitmapframe.create(rtb)); //i use dialog select path save png file microsoft.win32.savefiledialog savefiledialog = new microsoft.win32.savefiledialog(); savefiledialog.filterindex = 1; if (savefiledialog.showdialog() == true)

integral - Matlab partial area under the curve -

i want plot area above , below particular value in x axis. the problem facing discrete values. code below instance has explicit x=10 have written in such way can find index , calculate values above , below particular value if want find area under curve above , below 4 program work. though in plot matlab spline fitting(or sort of fitting connecting discrete values) there value y corresponding x=4 matlab computes cant seem store or access it. %example area under curve , partial area under curve using trapezoidal rule of integration clc; close all; clear all; x=[0,5,10,15,20];% domain y=[0,25,50,25,0];% values lp=log2(y); plot(x,y); full = trapz(x,y);% plot of total area i=find(x==10);% in our case distance value want half = trapz(x(1:i),y(1:i));%plot of partial area how can find area under curve value of ie x = 2 or 3 or 4 or 6 or 7 or ... this elaboration of patrik's comment, "first interpolate , integrate". for purpose of answer i'll assume

windows - Why is SetWindowsHookEx() returning NULL and LastError is ERROR_HOOK_NOT_INSTALLED -

i have code has been working without reported issues few years. sets low level keyboard hook user uses activate application. m_hkeyboardhook = setwindowshookex(wh_keyboard_ll, keybhookfn, getmodulehandle(null), 0); for 1 user of sudden (it worked him before years well), keyboard hook isn't working. upon investigation, can see setwindowshookex() returning null , getlasterror() returning 0x00000597 , error_hook_not_installed . i can't find documentation on means. what possibilities why might happen? system security settings? user account privileges? user using windows 7. i need specific answer how make error occur can solve user's problem looking @ http://blogs.msdn.com/b/alejacma/archive/2010/10/14/global-hooks-getting-lost-on-windows-7.aspx , seems might occur if cpu load high. another thought: did break when upgrading 64-bit windows? don't know if applies ll hooks, cannot inject 32-bit dll in 64-bit process. finally: ll hooks won't captu

javascript - Does the page visibility API actually support OS screen lock? -

according w3 page visibility specification , mozilla's page visibility api documentation , page visibility api supports detecting if browser window hidden because of os lock screen. unfortunately, of examples have found seem indicate not supported. cannot example js code or of js code report browser hidden when lock screen (on windows or os x). of examples have tried: http://ie.microsoft.com/testdrive/performance/pagevisibility/default.html https://jsfiddle.net/wvupj/ https://jsfiddle.net/fakj0puw/1/ none of these report page hidden when lock os. not supported though documentation indicates otherwise? because have insert code able link jsfiddle... var results = document.getelementbyid('results'); function handlevisibilitychange() { if (document.webkithidden) { results.innerhtml = results.innerhtml + 'hidden.<br>'; } else { results.innerhtml = results.innerhtml + 'visible.<br>'; } } document.addeventlistener(&q

java - How to use JFormattedTextField to allow only alphabets? -

i searched solution everywhere, found solutions allowing numbers, alphanumeric (using documentfilter ). but, need allow alphabets , intend use jformattedtextfield due advantages. so, how use jformattedtextfield allow alphabets (a-za-z) (no space, punctuation, letters)! since number variable, , if i'm not wrong jformattedtextfield uses masks fixed length of digits, more easy use litener change text event , validate text in element removing unallowed characters. something that: jtextfield f = null; f.getdocument().adddocumentlistener(new documentlistener() { @override public void insertupdate(documentevent e) { validateinputtext(); } @override public void removeupdate(documentevent e) { validateinputtext(); } @override public void changedupdate(documentevent e) { validateinputtext(); } });

shell exec - How to run cmd commands as administrator from php -

i trying learn php shell_exec() function believe, enables run cmd commands within php script.but in system, when open command prompt , type in command, example, ipconfig , says : 'ipconfig' not recognized internal or external command, operable program or batch file. so in order avoid it, have right click command prompt , select "run administrator" , works fine. now problem when try run similar commands ipconfig inside php script, same error given above. there way solve problem? mean there way run cmd commands administrator inside php? i attaching sample code below, can edit , me out. in advance. here's code : <?php $output = shell_exec('ipconfig 2>&1'); echo $output; ?> output (which wish avoid) 'ipconfig' not recognized internal or external command,operable program or batch file. right click command prompt , select "run administrator" i assume using xampp , defualt install location. if not ser

My virtualenv does not work after installing zsh -

i installed zsh, oh-my-zsh. , made zsh default shell. when try activate virtualenv source bin/activate there no effect. mean no errors , not in virtual environment. entered earlier bash shell , tried activating did not help? updated when create new virtualenv works well. how can activate older ones?

windows 7 - Strange FTP behavior when running the "MDelete" Command -

i running issue "mdelete" command in ftp when running on windows 7 professional 32 bit. below getting in log file after running mdelete command. ftp> ftp> mdelete siftinpt.dat obviously doesn't execute command." i expecting see ftp> mdelete siftinpt.dat a note script running, have same script running on 100+ pcs have windows 7 on them , not experience issue. have never run issue before. , when run mdelete command

mysql - Setting PHP Query into a nested array -

i trying use php logically store of data in nested associative arrays, , whenever loop through data or need reference data refer array pointer rather doing new queries each time. for example: my query is $query = $db->query(" select c.id campaign_id, c.campaign_title, c.start_date campaign_start_date, c.end_date campaign_end_date, cat.id category_id, cat.category_title, n.id nominee_id, n.title nominee_title, u.id voter_id, u.fullname voter_name campaign c left join categories cat on cat.campaign_id = c.id left join category_nominees cn on cn.category_id = cat.id left join nominees n on n.id = cn.nominee_id left join category_votes cv on cv.campaign_id = c.id , cv.category_id = cat.id , cv.nominee_id = n.id left join users u on u.id = cv.user_id c.active = 1 order u.fullname, c.campaign_title, cat.category_order, cat.category_title, cn.nominee_order, n.title ") or die(mysqli_error()); and i

php - How to get a good parameter from an image for a future recognition -

i working on image recognition app using php , need find parameter store in database. have 5000+ image loop trought need kind of filter. using akaze ( based on opencv lib) , store number of keypoints returned akaze_features function think parameter not optimal. here have experience kind of problem? there other parameters besides keypoints use classification? appreciated.

html - IE not working SCRIPT5007 HTML1524 errors, possibly doctype needs to be revised? -

i have application receives input words web app , processes them on backend (can done ruby or node.js) , returns words screen in uppercase. works fine firefox, not work ie.. tried ie 9 & 10. when say, not work mean response not returned webpage , instead user sees timeout error although backend application working. these types of errors see. failure occurs when function called: function escapehtml(text) { return text script5007: unable property 'replace' of undefined or null reference index.html but earlier when page loads, see these errors think may real problem; seems if "text" not able returned because doctype and/or codepage causing problem. html1524: invalid doctype. shortest valid doctype "". index.html, line 1 character 1 html1114: codepage utf-8 (http header) overrides conflicting codepage iso-8859-1 (meta tag) i have done several searches show doc type using valid, @ loss why continues problem in ie. <

assembly - Segment ignored in effective address with nasm -

i trying write simple bootloader in x86 assembly using nasm. @ several places in code, have use effective address of form [es:di] . code compiles without error, @ run time, segment ignored. instance, for mov ax, 0x07c0 mov es, ax mov di, 0x10 lea eax, [es:di] right after lea , registers : eax=00000010 edi=00000010 es =07c0 00007c00 0000ffff 00009300 but eax should have been 7c10 . problem occurs @ point of program (including when nothing has been done before), , program runs in real mode. my question is: normal? missing something? how can fix this? intel's manual may not super clear on this. or may not obvious look, @ least. if read section 7.3.16.1 ( address computation instruction ), says: the lea (load effective address) instruction computes effective address in memory ( offset within segment ) of source operand , places in general-purpose register. so, yes, i'd result expected one.

postgresql - Preserve the ordering in a table using Django -

i need have list of items ordered (by value field). element 0 .... element .... element n-1 how can implement in django optimize insert or delete operation? i must preserve ordering if insert new element in middle have move forward subsequent (the same situation cancellation) can have 12k elements in table... is there best way have in django?

Changing window properties in Visual C# from code-behind (WPF) -

i want background of wpf window change in specific situation (but other property). let's suppose name of window mywindow1 . if treat window other item (like in windows forms), mywindow1 doesn't seem have background property set; read-only properties shown in auto-complete. if try creating new object this: mywindow1 w1 = new mywindow1(); w1 seems have right properties available changing in autocomplete, including background, , ide shows no errors. when try starting program, hangs. what doing wrong, , best practice changing wpf windows properties code-behind in visual c# 2013? try xaml. < window x:class="wpf1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525" > <grid background="{dynamicresource {x:static systemcolors.inactivecaptiontextbrushkey}}"

r - Identifying the index number in a group of counts -

i have df need tally , group group. want identify index(?) of observation in grouping. the group a has 4 observations, want to attach index of 3 3rd a observation. df %>% group_by(group) %>% mutate(count = n()) # group index count #1 1 4 #2 2 4 #3 3 4 #4 4 4 #5 b 1 1 #6 b 2 1 #7 c 1 3 #8 c 2 3 #9 c 3 3 #10 d 1 1 you want use window function row_number() : df %>% group_by(group) %>% mutate(index = row_number()) # explicit row_number(group)