Posts

php - Non existent pages to error page htaccess file -

i trying write rewrite rule return 404 on urls spam parameters. used following rewrite tool return error 404 query string voxter.pdf&gpvoq , parameters gpvoq not producing 404 error. rewritecond %{voxter.pdf&gpvoq} (^|&)parm1=gpvoq [nc] rewriterule (.*)/error-404.php? [r=404,l] can u please me mistake doing? %{voxter.pdf&gpvoq} isn't apache variable. match literal. need using %{query_string} variable instead: rewritecond %{query_string} (voxter.pdf|gpvoq) [nc] rewriterule ^ /error-404.php? [r=404,l] or similar regex.

c# - What to use in the blank space in order to add the "x" variable from class A without creating another object of A? -

i have use this keyword in order add 3 values of x present in 3 classes. i not allowed create instance of class a in method m1 . class program { static void main(string[] args) { c c = new c(); int op = c.m1(); console.writeline(c.x); console.writeline(); } } public class { public int x = 10; } public class b:a { public int x = 100; } public class c:b { public int x = 1000; public int m1() { return (x + base.x + _____ ); //what use in blank space in order //add "x" variable class without //creating object of } } } cast current instance ( this ) a . can use ((a)this).x heres complete code of method, how define it public int m1() { return (x + ((b)this).x + ((a)this).x ); }

How to solve OverflowError: Python int too large to convert to C long with opencv? -

__author__ = 'kyle' help_message = """script: frame_grabber.py usage: python frame_grabber.py path/to/video requires: opencv 2.4.8+ purpose: select , save frames given video. commands: key function previous frame d next frame q exit shift + skip 10 frames forward shift + d skip 10 frames backwards s saves current frame dbl click saves current frame controls: slider navigate through video """ # check if user has provided path file # otherwise display help_message import sys import time t # check if opencv module present # otherwise stop application try: import cv2 except importerror e: print "fatal error: not import opencv, ", e exit(-1) else: print "using opencv ", cv2.__version__ # these flags may depend on opencv version: # in opencv 3.0.0 these flags implemented # cv2.cap_prop_pos_...

php - How to replace some characters in tsv file like HTML Math and Engineering symbol entities -

actually want replace these html math , engineering symbol entities numbers. there equivalent code ¼ ¼ , ½ ½ . examples given in link below . i have used str_replace , preg_match non of them worked. please tell me way this. highly appreciated. you can use mb_encode_numericentity function this, http://php.net/manual/en/function.mb-encode-numericentity.php $string = '¼ ½ ⅖ ⅘ ⅚ '; $convmap= array(0x0080, 0xffff, 0, 0xffff); $string = mb_encode_numericentity($string, $convmap, 'utf-8'); echo $string; output: ¼ ½ ⅖ ⅘ ⅚ demo: http://sandbox.onlinephpfunctions.com/code/c554aae1696c8ded4cdd97329269828c4cbf836b note: convert other characters outside ascii character set. if want convert 5 characters str_replace might better route. $string = ' figure ¼,½,⅖,⅘,⅚ not'; $find = array('¼', '½', '⅖', '⅘', '⅚'); $replace = array('&#...

java - Serlaize case class with the variable inside it in scala with jackson -

i tiring serialize case class using jackson fasterxml , can see constructor parameters after deserialize (taskrequest , tasknamein) not variables inside class (jobsrequests null example): //@jsonignoreproperties(ignoreunknown = true) // tried remove no luck @jsonautodetect case class job(taskrequest: list[taskrequest] = nil,tasknamein:string) { { this.jobsrequests = taskrequest this.taskname= tasknamein } @jsonproperty @volatile private var jobsrequests: list[taskrequest] = nil @jsonproperty var task_name: string = "" } any suggestions ? jackson uses getter java beans standard construct json. try adding @beanproperty properties , constructor parameters compile class getter/setters. example or use jackson scala-module . can take @ tests see how use module serialization .

javascript - Page action icon displays only in extension page -

Image
i'm learning creating chrome extensions. have studied page actions, used create icon inside address bar. code follows: in manifest.json : { "manifest_version" :2, "name" : "gtmetrix", "description": "test google chrome extension", "version" : "1.0", "page_action":{ "default_icon" : "icon.png", "default_popup" : "popup.html", "default_title" : "test google chrome extension" }, "background": { "scripts": ["background.js"] }, "permissions" : [ "activetab" ] } in background.js chrome.tabs.getselected(null, function(tab) { chrome.pageaction.show(tab.id); }); in popup.html <html> <head> <script src="jquery.min.js"></script> <script src="popup.js"></script> <!-...

CSS selector for first TH after a caption in a table -

i have table want select first th if contains caption . thought might this: .mytable caption + tr th:first-child { /* stuff */ } it's instead selecting nothing. bug in css or logic? see jsfiddle: https://jsfiddle.net/ukb13pdp/1/ .objecttable th:first-child { background-color: blue; color: white; } .objecttable caption + tr th:first-child { background-color: red; } <table class='objecttable'> <caption>caption table</caption> <tr> <th>a</th> <th>b</th> </tr> <tr> <td>1</td> <td>2</td> </tr> </table> <br/><br/> <span>no caption table</span> <table class='objecttable'> <tr> <th>c</th> <th>d</th> </tr> <tr> <td>3</td> <td>4</t...