Posts

python - How to identify if a page of PDF contains text using PyPDF2? -

the original task crop pdf several seperated parts. have adjusted params complete task,but sometimes, croping method lead 'blank page' looks like,it has text(using extracttext method). want know how filter 'blank page' mentioned above. below part of croping method: original = 'input.pdf' target = 'output.pdf' pdf = pdffilereader(open(original, 'rb')) page in pdf.pages: in range(4): new_page = copy.copy(page) if == 0: # top left new_page.mediabox.upperright = (285.5, 780) new_page.mediabox.lowerleft = (20, 570) elif == 1: # bottom left new_page.mediabox.upperright = (285.5, 400) new_page.mediabox.lowerleft = (20, 190) elif == 2: # top right new_page.mediabox.upperright = (572, 780) new_page.mediabox.lowerleft = (306.5, 570) elif == 3: # bottom right new_page.mediabox...

sql - Finding the least in Count(*) -

i'm trying find lid have committed least during given time period. following table: | requestdate | bid | lid | percentagecontributed | datecomitted | 1/10/2016 | s7444319c | s2262450a | 0.25 | 18/10/2016 | 1/10/2016 | s7444319c | s4495282i | 0.25 | 7/10/2016 | 1/10/2016 | s7444319c | s4792394d | 0.25 | 28/10/2016 | 1/10/2016 | s7444319c | s7173102k | 0.25 | 9/10/2016 | 25/10/2016 | s9981233w | s2848191x | 1.00 | 13/11/2016 | 28/10/2016 | s7611209x | s2848191x | 0.33 | 13/11/2016 | 28/10/2016 | s7611209x | s4792394d | 0.33 | 4/11/2016 | 28/10/2016 | s7611209x | s7145303q | 0.33 | 5/11/2016 i have tried following code: select lid, count(*) totalnumcommitte commits datecommitted between '2015-11-03' , '2017-01-09' group lid but managed following: | lid | totalnumcommitte | s2...

angular - angular2 typescript function to sort an array of objects by multiple fields -

i trying convert this function angular2/typescript in order sort array of objects multiple fields. i new typescript, can please me check it's clean? i calling prodatatemp.sort(this.utilsservice.sort_by('brand', 'name', 'model')); and in utils-service.ts: sort_by(...args: any[]) { //multiple sort https://stackoverflow.com/questions/6913512/how-to-sort-an-array-of-objects-by-multiple-fields var fields = [], n_fields = args.length, field, name, reverse, cmp; var default_cmp = function(a, b) { if (a == b) return 0; return < b ? -1 : 1; }; var getcmpfunc = function(primer, reverse) { var dfc = default_cmp, // closer in scope cmp = default_cmp; if (primer) { cmp = function(a, b) { return dfc(primer(a), primer(b)); }; } if (reverse) { re...

debugging - Vim airline customise settings -

in this screenshot of vimrc settings, have installed plugin vim-airline using vundle. after going through airlines docs, found set of lines customise airline. the problem ones highlighted in red. blue highlighted 1 works fine red 1 not. left 1 same right one. tried using different unicode symbols not work. workaround situation troubling ocd :p. thanks in advance. this well-known issue related font (size , family) used in terminal. for better display, have 2 solutions: do not use arrows separators configure terminal emulator use patched font right size if prefer first solution, make sure have code in .vimrc : let g:airline_right_sep = "" let g:airline_left_sep = "" if prefer other solution, take @ this: https://github.com/powerline/fonts i have used hack font size 11 long time , arrows displayed in editor...

javascript - Regex - Match whole string -

what regular expression (in javascript if matters) match if text exact match? is, there should no characters @ other end of string. for example, if i'm trying match abc , 1abc1 , 1abc , , abc1 not match. use start , end delimiters: ^abc$

How to specify which writing object (keyboard/barcode scanner) can be used to write in textbox using C#? -

Image
my question is: how can set input "object" enabled entering text textbox? case is: i'm making program need use barcode scanner, , in 1 form in program want constraint user can write down using barcode scanner. ideas how implement that? i can see both of them device manager (1. 1 barcode scanner): a barcode scanner uses keyboard interface of computer: i.e. point of view of textbox, keyboard. if want force user use barcode scanner instead of "normal" keyboard, have somehow disable normal keyboard in situation. not know how that.

angular - ionic 2 custom directives not working in android 5 -

i have custom directive below limit number of characters in input field in ionic 2 app. see below. unfortunately works in android 4.2.2 not on android 5.1.1. can help? import { directive, input, hostlistener } '@angular/core'; /* generated class limitto directive. see https://angular.io/docs/ts/latest/api/core/index/directivemetadata-class.html more info on angular 2 directives. */ @directive({ selector: '[limit-to]' // attribute selector }) export class limitto { @input('limit-to') limitto; constructor() { } //hostlistener decorator handle event handlers input (onkeypress) @hostlistener('keypress', ['$event']) onkeypress(ev) { const limit = +this.limitto; //convert number // once reaches limit set, stop propgating event. if (ev.target.value.length === limit) { ev.preventdefault(); } } } thank you, ashley