Posts

bash - How do I truncate the last two characters of all files in a directory? -

this question has answer here: bash script remove 'x' amount of characters end of multiple filenames in directory? 3 answers so pretty simple question. of files in directory of form 6bfefb348d746eca288c6d62f6ebec04_0.jpg . want them 6bfefb348d746eca288c6d62f6ebec04.jpg . essentially, want take off _0 @ end of every file name. how go doing bash? with perl's standalone rename command: rename -n 's/..(\....)$/$1/' * if looks fine, remove -n . it possible use standalone rename command syntax similar sed 's s/regexp/replacement/ command. in regex . matches 1 character. \. matches . , $ matches end of line (here end of filename). ( , ) special characters in regex mark subexpression (here 1 . , 3 characters @ end of filename) can reused $1 . sed uses \1 first back-reference, rename uses $1 . see: back-references , sub...

How to install skype in Android Emulator? -

i new android app development. want create intent launch skype. in order test this, assume emulator must have skype installed. i tried launch play store on emulator skype app. google playstore, when launched on emulator complains there no wifi or data connection. how can emulator connect host wifi(wifi laptop connected to?)? there way skype app on emulator without playstore? thank you assuming you're using latest android studio , emulator, skype application apk file other sites , drag onto emulator install application. however suggest @commonsware stated, use physical android device instead of emulator (probably most) apps won't work correctly due google play services being missing. try images in android sdk contain part of google play services within them, it's worth shot not rely on long run.

html - CSS button width issue in Chrome -

i want the width of button 85px wide. contains arrow , word "content." okay in ie, in chrome shortens width of button. widths of other components in menu button okay except "content." preface, chapters, figures, tables, abbreviations , acronyms, , executive summary good. there third level below chapters shows chapters, excluded in following code brevity. third level works well. /* menu styles2 */ .third-level-menu2 { position: absolute; top: 0; right: -500px; width: 500px; list-style: none; padding: 0; margin: 0; display: none; overflow:hidden; max-height: 450px; overflow-y:auto; } .third-level-menu2 > li { height: 30px; background: #005070; } .third-level-menu2 > li:hover { background: rgb(148,138,84); } .second-level-menu2 { position: absolute; top: 30px; left: 0; width: 400px; list-style: none; padding: 0; margin: 0; display...

c - PPM scanning and printing -

i want scan in documents file of type .ppm image files follows following data structure p3 4 4 255 255 255 0 255 255 0 255 255 0 255 255 0 255 255 0 255 0 0 128 128 128 255 255 0 255 255 0 0 255 0 0 0 255 255 255 0 255 255 0 255 255 0 255 255 0 255 255 0 every 3 integers mark column after first 3 lines, marks pattern of 4x4 table indicated on second line. my first step read in file height , width can vary , reprint in exact format using scanf , printf. my attempt @ follows: scanf(" %d%d %d", &width, &height, &depth); printf("p3\n%d %d\n %d\n", width, height, depth); while(scanf("%c", &input) >= 1) { (int = 0; < width; i++) { printf("%c %c %c ", input, input, input); (int j = 0; j < height; j++) { printf("\n"); } } } any idea missing? there number of errors in code: you s...

webpack - Runtime Error when running Angular 4 app via `ng serve` -

i have spring boot project uses angular on frontend. upgraded project angular 2 angular 4. both before , after upgrade, can build , run application , runs fine when it's bundled war , run on tomcat server. however, when developing frontend changes, run frontend separately via angular cli command, ng serve . when on angular 2, working fine. i'm on angular 4, when run application via ng serve , following error in developer console when try load application in browser. uncaught error: unexpected value '[object object]' imported module 'appmodule'. please add @ngmodule annotation. @ syntaxerror (compiler.es5.js:1690) [<root>] @ :4200/vendor.bundle.js:99805:44 [<root>] @ array.foreach (<anonymous>) [<root>] @ compilemetadataresolver.webpackjsonp.../../../compiler/@angular/compiler.es5.js.compilemetadataresolver.getngmodulemetadata (compiler.es5.js:15365) [<root>] @ jitcompiler.webpackjsonp.../../../compiler/@a...

appmaker - Move record from one data model to another with a button -

i have 2 data models, 1 called requested_allocations , called approved_allocations. i want add 'approve' button each row of table displaying requested_allocations records. when user clicks button, record added approved_allocations , removed requested_allocations. i have set both data models , have added 'approve' button requested_allocations table. imagine need add onclick event button, i'm not sure do. guidance great! it doable creating new record approved_allocations model, copying fields requested_allocations , removing source record... inefficient/complex. i recommend remove 1 of models , add 'status' field remaining one. you'll able query approved/requested records filters: // querying requested allocations app.datasources.allocations.query.filters.status._equals = 'requested'; and change allocation status single line of code: // approve button click (assuming shared datasource row) widget.datasource.item.status = ...

How to Parse Big (50 GB) XML Files in Java -

currently im trying use sax parser 3/4 through file freezes up, have tried allocating more memory etc not getting improvements. is there way speed up? better method? stripped bare bones, have following code , when running in command line still doesn't go fast like. running "java -xms-4096m -xmx8192m -jar reader.jar" gc overhead limit exceeded around article 700000 main: public class read { public static void main(string[] args) { pages = xmlmanager.getpages(); } } xmlmanager public class xmlmanager { public static arraylist<page> getpages() { arraylist<page> pages = null; saxparserfactory factory = saxparserfactory.newinstance(); try { saxparser parser = factory.newsaxparser(); file file = new file("..\\enwiki-20140811-pages-articles.xml"); pagehandler pagehandler = new pagehandler(); parser.parse(file, pagehandler); pages = pagehandler.getpages(); ...