Posts

Showing posts from March, 2014

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();

python - Performance issues with pyqtgraph -

i'm trying convert code using matplotlib pyqtgraph since it's supposed more efficient, , provides lot more interactive features. i've got code converted, i'm running issues runs slowly. code reproduces this: import numpy np import qtpy.qtwidgets qt import pyqtgraph pg class graphwidget(qt.qwidget): """a widget simplifying graphing tasks :param qt.qwidget parent: :param dict[str, dict] layout: mapping title row/col/rowspan/colspan kwargs """ def __init__(self, parent, layout_spec): super(graphwidget, self).__init__(parent=parent) self.axes = {} glw = pg.graphicslayoutwidget(parent=self) name, layout in layout_spec.items(): self.axes[name] = pg.plotitem(name=name, title=name) glw.additem(self.axes[name], **layout) box_layout = qt.qvboxlayout() box_layout.addwidget(glw, 1) self.setlayout(box_layout) @property def normal_pen(

Merging multichannel audio tracks from Mumble with ffmpeg -

we record talks through mumble , because mumble has nitfy multichannel feature i'd figured subtitles youtube uploading each track youtube separately for file in *; ffmpeg -loop 1 -r 2 -i "$img" -i "$file" -vf scale=-1:380 -c:v libx264 -preset slow -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p -threads 0 "$file".mkv; done can prepend eg. sed shell script nickname each speaker in automatic captions i.e. subtitles youtube. works charm. but merging tracks ffmpeg gets tricky. use ffmpeg -i input1.ogg -input2.ogg -i input3.ogg -i input4.ogg -input5.ogg -filter_complex "[0:a][1:a][2:a][3:a][4:a] amerge=inputs=5[aout]" -map "[aout]" -ac 2 output.ogg somehow ffmpeg shortens resulting audio track , don't yet have idea why. tried using longest first , last since including silent tracks made shorter mixdown. here warnings: [parsed_amerge_0 @ 0x7f8b29f02d20] no channel layout input 1 [parsed_amerge

ms word - How to deal with multiple rows in non uniform table? -

i need search information in ms word table has non-uniform structure (i.e. splitted , merged cells) the structure is: +----------+----------------+---+ |something1| description1_1 | 1 | + +----------------+---+ | | description1_2 | 2 | | +----------------+---+ | | description1_n | n | +----------+----------------+---+ |something2| description2_1 | 1 | | +----------------+---+ | | description2_2 | 2 | +----------+----------------+---+ i need deal (make , set flags deal after) according find in of descriptions. whether possible in word api enumerate such subrows, knowing now? (i mean need description know handling , number in in next column has) the goal handle according result. cannot reach counts of such subrows in such megarow loop them. moreover, rows property seems stop working in such table.

asp.net core mvc - Add admin page without full fledged user management -

i building rather simple site asp.net core mvc 2.0 more or less image gallery, me. not using database far. json file metadata , image files itself. now site supposed hidden admin page (and i) can upload new pictures. what simple still secure way add admin page without having introduce full fledged user management site? i'd avoid add database , entity framework etc. site - there 1 user. in other words, secure , simple way add user management there 1 user authenticates: me, admin. store hashed version of desired username/password in appsettings.json , rehash values provided through login screen , compare them. here's example of how logging in accomplished. bootstraps off of default hasher present in asp.net identity use hashing function. you might want create other helpers in case want reset hashed password application versus having go settings file. appsettings.json { ... "logincredentials": { "usernamehash": "a

android - Unit test private and static methods in java -

i'm writing unit tests app of mine , practice try make methods in classes private possible, may end classes private methods, few public ones , calls static methods (either of other classes or textutils, etc) i know how test of classes trying rely on mockito , junit since robolectric , powermockito seem stretch boundaries of should done in unit testing. should disregard private , static methods along public methods chance call static or private ones? or how? all of private methods in class you're testing should called public/protected/package private method; otherwise they're unused code. so, concentrate on testing public api that's visible "client code" of app. internals (private methods) tested/covered side effect because implement public contract api specifies. testing implementation details (private methods) directly make tests harder maintain , code-under-test more difficult refactor.

Joomla 3.2 header module disappeared -

my header slideshow module disappeared of sudden. have double checked configuration.php , module menu assignment , reinstalled slideshow module nothing wrong. please me? thank in advance. www.totalshabake.com thank neil hint. found solution. added if statement below before template javascript file , worked charm. if(typeof jquery == 'undefined') { //copy , paste jquery core code here //................................................. //................................................. }

REST call from Xamarin -

i'm trying access rest web service on azure xamarin forms application. have app registration authentication, unable authenticate web service defined in different app registration. i've tried passing token on request, no luck. strikes me should possible , must missing obvious, have example of this? this code allows me authenticate , populates authresult expected , tries call web service passing accesstoken in. authentication work 401 on web service call, if call web service browser can login , view it. authenticationcontext authcontext = new authenticationcontext("https://login.windows.net/acme.onmicrosoft.com"); authenticationresult authresult = await authcontext.acquiretokenasync("https://graph.windows.net", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", new system.uri("http://my-authentication-redirect"), new platformparameters(this)); httpclient client = new httpclient(); client.defaultrequestheaders.authorization = new authentica

pojo - How to define a property of type List<E> in a Spring Bean? -

i work hybris , in beans.xml file can define pojos used in projects. i want know how can define pojo in spring property of type list e should type define in beans.xml. for example, want define pojo this: public class mypojo{ private string someproperty; public string getsomeproperty(){ return someproperty; } public void setsomeproperty(string someproperty){ this.someproperty = someproperty; } } and pojo contain list of mypojo: public class mypojolistholder{ private list<mypojo> mypojolist; public list<mypojo> getmypojolist(){ return mypojolist; } public void setmypojolist(string mypojolist){ this.mypojolist= mypojolist; } } mypojo defined in beans.xml follows: <bean class="my.package.mypojo"> <property name="someproperty" type="java.lang.string"></property> </bean> i can define mypojolistholder this: <bean class="my.package.mypojol

css - modal with items vertically centered aligned and with scroll -

i'm using bootstrap modal, , have list buttons inside modal body structure: image image image image options option1 option2 other option image image image image option3 option4 option5 ... image option7 so same margins between buttons , list items aligned vertically aligned , scroll because buttons can occupy more height default modal height. do know how achieve that? i'm doing this: http://jsfiddle.net/znhgdzl7/ , it's not working. i added max-height , overflow css. solve issue. may not values want, can adjust them accordingly. keep content within horizontal max, need add wrap property css. see new fiddle. display: flex; flex-wrap:wrap; max-height:50px; overflow-y:auto; new fiddle: http://jsfiddle.net/djwave28/znhgdzl7/7/

twitter - Making IAuthorizor or TwitterContext Global / Accessible -

one more follow extract bearertoken linqtotwitter iauthorizer i using auth / context / bearertoken in application wanted use l2t library check on rates. need twittercontext so, out of twitterctx scope. is possible set public class can access anywhere without need reauthorize? thank in advance. there different ways this. here couple can go singleton route or factory method. note: there's debate on whether singleton appropriate pattern use or whether global reference object appropriate @ all, that's isn't you're asking. public class twittercontextservice { static twittercontext twitterctx; public static twittercontext instance { { if (twitterctx == null) twitterctx = createtwittercontext(); return twitterctx; } } public static twittercontext createtwittercontext() { var auth = new applicationonlyauthorizer() { credentialstore

elasticsearch - forward slash issue in ELK query strings -

i have elk query in query_string looks like: {"query_string":{"query":"context.productname:abc/def"}} this fails. but, following works: {"query_string":{"query":"context.productname:abc\\/def"}} lets have value in variable like let productname = 'abc/def' what right way escape variable works elk query?

r - Prediction of next row of a particular column using Bayesian GLM -

i have following data frame , wanted predict next row value of column 'amount' using bayesian glm rstanarm package (or) rstan package. appreciate if me in solving issue. year lag amount yearno 2001 12 187572 1 2001 24 331364 1 2001 36 354886 1 2001 48 361970 1 2001 60 365251 1 2001 72 366729 1 2001 84 368047 1 2001 96 368775 1 2001 108 369457 1 2001 120 369709 1 2001 132 370048 1 2001 144 370109 1 2001 156 370152 1

python - How to configure tensorflow PTB model to extract likely next words -

how extract next words tensorflow ptb model. i don't want probabilities, want next words in order least likely. example, input words, x 1 , x 2 , x 3 , ..., x y . how configure model to, when given x 1 , x 2 , x 3 , ..., x y give me list of next words. don't need probabilities of words. want model output list of words in order least of coming after x 1 , x 2 , x 3 , ..., x y .

vb6 - creating winhttp array in visual basic 6 -

i want know if possible create array winhttp can winsock control. here code send out request once using proxy. dim result string dim url string dim winhttpreq object set winhttpreq = createobject("winhttp.winhttprequest.5.1") url = "http://example.com" winhttpreq.open "get", url, false winhttpreq.setrequestheader "user-agent", text2.text winhttpreq.setrequestheader "accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" winhttpreq.setrequestheader "accept-language", "en-us,en;q=0.8,en-us;q=0.5,en;q=0.3" winhttpreq.setrequestheader "accept-charset", "windows-1251,utf-8;q=0.7,*;q=0.7" winhttpreq.setrequestheader "keep-alive", "115" winhttpreq.setrequestheader "connection", "keep-alive" winhttpreq.setproxy 2, list1.text, "" winhttpreq.send list1.text ip:port how can create array can send out request ip in lis

Use parallel python to call a very simple matlab function with multiple cores, got error: can't allocate region -

i use python call matlab function (import matlab.engine). works fine in series case. however, if want call matlab function in multiple cores in parallel, weird error comes out (i used parallel python module, import pp) python(68090,0x700006f1e000) malloc: * mach_vm_map(size=3410759172352061440) failed (error code=3) * error: can't allocate region *** set breakpoint in malloc_error_break debug i wonder if have idea issue? thank in advance please find minimum example code here https://www.dropbox.com/s/5jh7x9fc14v6kmj/minimumexample.zip?dl=0 .

graphics - Bin packing with the ability to remove/free used rectangles -

helo, have been using popular library https://github.com/juj/rectanglebinpack , more maxrectsbinpack.cpp pack images atlas without having reposition anything, ever. place image once , stays there lifetime of app. or @ least used because need able remove image , free space occupying. tried erase rectangle "usedrectangles" vector , push "freedrectangles" seems going wrong , corrupting rest of images in atlas. there i'm missing here? there way achieve without having refit in atlas?

php - Mysqli query is not returning anything when attempting to filter duplicate times on the same day -

i have attempted multiple ways , @ wits end. trying check overlapping times on specific date aircraft reservation calendar. here form: <form action="add-schedule.php" method="post"> aircraft:<br> <input type="text" value="<?php echo $_get["air"]; ?>" name="aircraft" readonly><br><br> pilot in command:<br> <input type="text" value="<?php echo $user; ?>" name="user" readonly><br><br> date:<br> <input type="text" value="<?php echo date('y-m-d', strtotime($_get["dt"])); ?>" name="dt" readonly><br><br> start time:<br> <input type="time" name="tm" required><br><br> end time:<br> <inpu

javascript - How to interact with element underneath? -

Image
i come across problem can't interacte elements covered other elements recently. here below code: var data = [ [40, "blue"], [80, "red"] ]; var g = d3.select("#container").append("svg") .attr({ width: 300, height: 300, }) .style("border", "1px solid #ccc") .append("g") .attr("transform", "translate(150,150)"); g.selectall("circle").data(data) .enter() .append("circle") .attr({ r: function(d){ return d[0]; }, fill: function(d){ return d[1]; }, "fill-opacity": 0.5 }) .on("mouseenter", onmouseenter) .on("mouseleave", onmouseleave) .on("mousemove", onmousemove) .on("mouseover", onmouseover) .on("mouseout", onmouseout); function onmouseenter(d){ console.log(d[1] + ": mouse enter"); } function onmouseleave(d)

java - How can I loop this and reset the variable -

when try put loop main() method, private 'iterations' variable doesn't seem reset value everytime loop run. need private variable reset orginal value everytime loop incremented. import java.util.random; public class randombuster { //used internally random generate next numbers private static final long multiplier = 0x5deece66dl; private static final long addend = 0xbl; private static final long mask = (1l << 48) - 1; //the seed. if find seed, can predict 'random' numbers private static long seed; //the random number busting

node.js - how to move an object with id to another variable or object -

here created 2 objects in products list created cart api , moving products id d storing in cart variable. used response generator middleware display result. below code. // add items cart var cart = new productmodel({}); productrouter.post('/addtocart/:id',function(req,res){ var id = req.body.id; productmodel.find({_id: id}, function(err,mycart){ if(err){ var myresponse = responsegenerator.generate(true, "some error occured"+err, 500, null); res.send(myresponse); } else{ cart.push(mycart) //res.send(cart); var myresponse = responsegenerator.generate(true, " product added cart sucessfully", 200 , cart); res.send(myresponse); } }); }); can push mycart object identified directly cart variable. if not please give solution thank you

ios - Is it possible to segue between root view controllers while keeping a modal on top of them? -

i'd reload view controller segueing (from itself) keep modal view on of during whole process. possible swift? here's code i'm using segue between vcs. it's working fine. enum appscreens: string { case startup = "startupviewcontroller" case welcome = "welcomescreen" case profile = "profilescreen" case game = "gamescreen" } static func pagesegue(_ currentscreen: appscreens) { let controllerid = currentscreen.rawvalue let newvc: uiviewcontroller = uistoryboard(name: "main", bundle: nil).instantiateviewcontroller(withidentifier: controllerid) uiviewcontroller let appdelegate = uiapplication.shared.delegate as! appdelegate appdelegate.window?.rootviewcontroller = newvc }

php - Image file not being stored in laravel project -

hello guys need guys. creating laravel project have modified default users table store more informations of users name , user image file name . had modify ' registercontroller ' class ' create ' function has been modified , have added ' update ' method store uploaded image file. below code of ' registercontroller ' class: protected function update(array $data) { $path = $data['img']->storeas('/public','ohgod '); return $path; } protected function create(array $data) { $filename; $filename = $data['img']->getclientoriginalname(); $filesize = $data['img']->getclientsize(); $this->update($data); return user::create([ 'name' => $data['name'], 'img_name' => $filename, 'img_size' => $filesize, 'username' => $data['username'], 'dob' => $data

html - undefined option type table -

Image
i errror undefined option type :table can not resolve

web scraping - Get login result in mechanize (Python) -

i'm logging in website ( https://acesso.estadao.com.br/login/ ) using: br.select_form(id="form-cadastro") br['emaillog'] = login br['passwordlog'] = passwd br.submit() answer = br.response().read() and works good, after need know if login successful or not, how can it? tried read answer, either a: <script type="text/javascript"> window.location.hash = ''; window.location.href = "http://www.estadao.com.br/" </script> or <!doctype html> <html lang="pt-br"> <head> <meta charset="utf-8"/> <meta http-equiv="x-ua-compatible" content="ie=edge"/> <title>o portal de not&iacute;cias estado de s. paulo</title> (...) is there way of getting response code, saying login ok?

javascript - Pass objects in array into inquirer list choices -

i have simple node.js application search spotify api songs. because there songs same names different artist, want user able select track desired list using inquirer package. the methods below add data search results object, , push them array. pass array inquirer prompt, user can select item. when selected, need able of data trackdata object, whichever selection user made. if there's better way of doing please let me know. s.o. let trackfetcher = new promise((resolve, reject) => { for(let track of data.tracks.items) { var trackdata = { name: track.name, album: track.album.name, artist: track.artists[0].name, url: track.external_urls.spotify, } tracks.push(trackdata); resolve(tracks); } }); trackfetcher.then((tra

java - Store state of an object, but no serialization/externalization possible -

i aware need of serialization/deserialization. have complex object not serialized , don't have source code object, cant change implementation. i want store state of object in db, either json or binary stream. only options can think of: create proxy object fill fields using java reflection , serialize it. any other suggestions welcome. thanks in advance. suggestion appreciated.

How to Implement Tez in cloudera? -

i have read article apache tez, improves performance running pig or hive using tez,but has been not implemented in cloudera quick start virtual machine. is there way implement tez in cloudera?? source: https://tez.apache.org/

bitbucket - Git importing repositories as branches -

i have repo1 , repo2 , repo3 , , repo4 . want keep repo1 , make repo2 , repo3 , , repo4 different branches of repo1 , without losing tags or commits exist in repo2 , repo3 , , repo4 . repo1-master branch (contains tags , commits of repo1) |__branch2 (contains tags , commits of repo2) |__branch3 (contains tags , commits of repo3) |__branch4 (contains tags , commits of repo4) does each of them retain historical commits, dates, , tags? can choose specific branch push code in future, issues? it works if other repos have each 1 branch (typically master). can fetch them in repo1, , add master branch new orphan branch, have own independent history. cd repo1 git remote add repo2 ../path/to/repo2 git fetch repo2 git branch brrepo2 repo2/master git push -u origin brrepo2 git push --tags

typescript - Prod build 404 error after upgrading angular 2 to angular 4 -

upgraded application angular 2 angular 4, created build. but getting below error after deploying server. oops! error occurred server returned "404 not found". broken. please let know doing when error occurred. fix possible. sorry inconvenience caused. in local getting below error while accessing dist/index.html. error error: uncaught (in promise): securityerror: failed execute 'replacestate' on 'history': history state object url

PHP artisan "PHP Fatal error" on allowed memory size in Laravel -

it's confusing, why error shown. i'm using laravel 5.4 , after using composer update error shown. $ composer update loading composer repositories package information updating dependencies (including require-dev) nothing install or update generating autoload files > illuminate\foundation\composerscripts::postupdate > php artisan optimize php fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 495616 bytes) in e:\xampp\htdocs\botble\vendor\symfony\debug\exceptionhandler.php on line 238 php fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 4096 bytes) in e:\xampp\htdocs\botble\vendor\symfony\debug\exception\flattenexception.php on line 203 script php artisan optimize handling post-update-cmd event returned error code 255 as of answer on stack , other community, i'm test after update php.ini memory_limit 2048m . still same error shown. any suggestion issue. this memory limit issue . can try this

python - use RE to find string consisting only of Latin letters, digits and underscores and they can't start with a digit -

i want use regular expression('re') find if variable names consist of latin letters, digits , underscores , can't start digit. i tried using in [3]: name='qq-q' in [4]: re.match("[a-za-z_][0-9a-za-z_]*",name) out[4]: <_sre.sre_match object; span=(0, 2), match='qq'> in [5]: name='kri[shna0' in [6]: re.match("[a-za-z_][0-9a-za-z_]*",name) out[6]: <_sre.sre_match object; span=(0, 3), match='kri'> can 1 explain me why above expression matches '-' , '[' in above? you there! in regex, * matches 0 or more of given character, matching longest sequence. instance a* match aaabcde , match aaa . match bcde wit empty match, match nonetheless. achieve want need add $ @ end of pattern: re.match("[a-za-z_][0-9a-za-z_]*$",name) this requests pattern match input until end of line, represented $ if using re.search , need start pattern ^ . not necessary re.match since ma

android - FirebaseJobDispatcher does not schedule job and gives error that there are too many tasks scheduled for this package -

when try schedule job using firebasejobdispatcher gives error there many tasks scheduled package. have 5 jobs scheduled. the exact error follow - networkscheduler: many tasks scheduled package. not scheduling: [package.name/com.firebase.jobdispatcher.googleplayreceiver:updatecheckinfailed,u0] how should solve issue, can't reduce number of jobs jobs work independently syncing local device server , close them when sync completed. thanks

java - why contextloader is trying to load WEB-INF/applicationContext.xml if using mvc-dispatcher-servlet.xml -

Image
in gradle web project, want load mvc-dispatcher-servlet when starting tomcat deploying below exception in tomcat console: web.xml : <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping> <!-- <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> --> you can see have commented contextloaderlistener still loading applicationcontext.xml. mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.spri

Close an open XML element tag, programmatically in java -

this question has answer here: how parse invalid (bad / not well-formed) xml? 2 answers i have xml string response server open tags, like: example: <address1><street>this caused error coz street not closed</address1> <address2>this displayed normal</address2> while parsing above xml string, got, org.xml.sax.saxparseexception: element type "street" must gathered. note: can't change server files. first, not think should work invalid xml because lead unpredictable results. best update server files have valid xml content. that being said, can use jsoup html parser can manage such invalid xml. for provided example: string xml = "<address1><street>this caused error coz street not closed</address1><address2>this displayed normal</address2>"; document doc = jsoup.parse(x

Angular 2 : How to dynamcially lazy load node_modules from library package based on requested URL -

lets have different versions of library - player |-player1 |-config.json |-player1.module.ts |-player1.component.ts |-player2 |-config.json |-player2.module.ts |-player2.component.ts how can load player1 version of library if requested url xyz.com/p1 , player2 xyz.com/p2. i have multiple versions of library installed in node_modules. based on requested url need lazily load required library version. can routing each version huge chunk when versions build more 20, have route each version. looking better solution. check tutorial https://angular-2-training-book.rangle.io/handout/modules/lazy-loading-module.html basically must define routes this {path : 'p1', loadchildren: 'pathtomodule#modulename'}

android - How to create RecyclerView with multiple view type? -

from https://developer.android.com/preview/material/ui-widgets.html when creating recyclerview.adapter have specify viewholder bind adapter. public class myadapter extends recyclerview.adapter<myadapter.viewholder> { private string[] mdataset; public myadapter(string[] mydataset) { mdataset = mydataset; } public static class viewholder extends recyclerview.viewholder { public textview mtextview; public viewholder(textview v) { super(v); mtextview = v; } } @override public myadapter.viewholder oncreateviewholder(viewgroup parent, int viewtype) { view v = layoutinflater.from(parent.getcontext()).inflate(r.layout.some_layout, parent, false); //findviewbyid... viewholder vh = new viewholder(v); return vh; } @override public void onbindviewholder(viewholder holder, int position) { holder.mtextview.settext(mdataset[position]); }

api - Events no update until click to event in ICAL feed -

we using tool synchronize events ical feed(a) primary calendar(b). ical added url. if changed ical feed(a), not change on primary calendar(b), have click event ical calendar, request url below, primary calendar has been updated. https://clients4.google.com/invalidation/lcs/request https://calendar.google.comcom/calendar/ping does know action of google calendar?

ios - `xcodebuild archive` always performs a clean build -

every time run xcodebuild ...params... archive performs clean build without reusing cache previous build. while understand motivation behind it, has serious consequences on ci build times because generate ipa every push. since workspace has pods project (unlikely change between commits) , app project (changing time) i'm looking way cache pods compilation phase somehow – xcodebuild archive doesn't seem allow. is there way force using cache when archiving? there other way cache archived version of pods ?

printing - Java print, Letter format instead of A4 -

as far know, java print uses os (windows) settings (format type) when sending task printer. however, no matter how change code , despite fact settings set a4, after sending task printer accepts task letter format , printer out of paper error. although, when press restart printing button on printer prints out file correctly. have tried lot of different methods stackoverflow didn't work out. tried application on pc connected same model of printer - same problem. maybe i'm missing small or looking solution in wrong place? this piece of code: private printerjob createpdfprinterjob(pddocument pdfdocument) { printerjob printjob = printerjob.getprinterjob(); pageformat pageformat = new pageformat(); pageformat.setorientation(pageformat.portrait); paper paper = new paper(); pageformat.setpaper(paper); try { printjob.setprintable(new pdpageable(pdfdocument), pageformat); } catch(printerexception ex) { ex.printstacktrace();

java - Serenity/Selenium browser closes immediately -

i using serenity bdd 1.53 , newest chrome driver. when tests running browser closes , selenium throws error "web driver exception: unknown error: jquery not defined". i trying wait jquery load, result same time. public boolean waitforjsandjquerytoload() { webdriver driver = getdriver(); webdriverwait wait = new webdriverwait(driver, 30); // wait jquery load expectedcondition<boolean> jqueryload = new expectedcondition<boolean>() { @override public boolean apply(webdriver driver) { try { return ((long)((javascriptexecutor)driver).executescript("return jquery.active") == 0); } catch (exception e) { // no jquery present return true; } } }; // wait javascript load expectedcondition<boolean> jsload = new expectedcondition<boolean>() { @override public boolean apply(webdriver

how to get package name of application being displayed on screen in a foreground service, android? -

i want package name of application being displayed on screen @ time. using foreground service used method below, gives me mycurrent application's packagename if opens app e.g youtube,camer etc, , mobile's com.huawie.android.launcher if @ home screen. activitymanager activitymanager = (activitymanager) getsystemservice(context.activity_service); activitymanager.runningtaskinfo foregroundtaskinfo = activitymanager.getrunningtasks(1).get(0); packag= foregroundtaskinfo.topactivity.getpackagename(); log.i("pack",packag); well, below api-level 21 or loolipop, can whole package activity class, api-22 can't whole application package activity because of security reasons. as know android not going secure phone, that's why activity name restricted.

c# - Unable To Get Extensions and Updates of A Package -

Image
i using visual studio 2013 ultimate , yesterday got big trouble while using extensions , updates tools feature. tried install web essentials package in search option, didn't show follows: then downloaded manually , when tried install, showed following error message log details: there way rid of or have install other feature or something? log details : 9/14/2017 12:46:56 pm - microsoft vsix installer 9/14/2017 12:46:56 pm - ------------------------------------------- 9/14/2017 12:46:56 pm - initializing install... 9/14/2017 12:46:56 pm - extension details... 9/14/2017 12:46:56 pm - identifier : 5fb7364d-2e8c-44a4-95eb-2a382e30fec8 9/14/2017 12:46:56 pm - name : web essentials 2013.5 9/14/2017 12:46:56 pm - author : mads kristensen 9/14/2017 12:46:56 pm - version : 2.6.36 9/14/2017 12:46:56 pm - description : adds many useful features visual studio web developers. requires vs2013 update 4 or 5 9/14/2017 12:46:

ubuntu server no free space with permission issues? -

i have actuall issue ubnutu 14.x server running php 7 , mysql server. after while memory (hdd 2 x 2 tb) out of free space, can not situation, because noone has upload kind of data. we tried upload file via ftp in our var/www/... path 0 byte file has been generated. nothing more. when try lunch php script uses mysql connection error message: "fatal error: uncaught pdoexception: sqlstate[hy000] [2002] no such file or directory" if log in (via putty) see, hdd usage 1%. had guess have kind of permission issues. could please help? thanks in advance!

html - How to find the xml address of a webpage with specified url -

i need view webpage in style : http://www.forexfactory.com/ffcal_week_this.xml [original address : https://www.forexfactory.com/calendar.php?week=this][1] how can find xml address of webpage ? i want analyze web pages , need access page data in example provided

Yii highchart group X-Axis -

i want make chart in x-axis in groups. for example, group = array(1,2,3,4) group b => array(9,8,7,6) i want display below: | | x|_________________________ |1 2 3 4 | 9 8 7 6 | group | group b can me?

ios - Rich Notification in swift. Image not show in notification -

i make rich notification show image in notification whenever send simple message notification. last 2 day trying show image in notification not done. please me this. thank in advance this code. in notification service extension override func didreceive(_ request: unnotificationrequest, withcontenthandler contenthandler: @escaping (unnotificationcontent) -> void) { self.contenthandler = contenthandler bestattemptcontent = (request.content.mutablecopy() as? unmutablenotificationcontent) // custom data notification payload if let data = request.content.userinfo["data"] as? [string: string] { // grab attachment if let urlstring = data["attachment-url"], let fileurl = url(string: urlstring) { // download attachment urlsession.shared.downloadtask(with: fileurl) { (location, response, error) in if let location = location { // m

node.js - How to get Mysql DB values to a json array in node js -

how mysql db values json array in node js, can tell me steps follow achieve this as you're beginner, here steps need perform: you need add dependency mysql project (e.g. knex js ). then, can use select() promise access rows in this gist . more clear: return knex('books').select(knex.raw("data->'author' author")) .whereraw("data->'author'->>'first_name'=? ",[books[0].author.first_name]) .then(function(rows) { // here have access rows array of objects // can stringify console.log("found "+rows.length+ " books authors first_name "+ books[0].author.first_name); rows.foreach(function(row){ console.log(row); }); })

Linking PHP with Android Studio to get Firebase Tokens -

can me understand piece of code. in advance.what purpose of okhttpclient? there alternative block of code? private void registertoken(string token) { okhttpclient client = new okhttpclient(); requestbody body = new formbody.builder() .add("token",token) .build(); request request = new request.builder() .url("notify.php") .post(body) .build(); try { client.newcall(request).execute(); } catch (ioexception e) { e.printstacktrace(); } } you can use loopj library api call. simple .follow steps android. add dependency in gradle compile 'com.loopj.android:android-async-http:1.4.9' request web api string url="your url here"; requestparams requestparams = new requestparams(); requestparams.put("token", usertoken); new asynchttpclient().post(url,requestparams, new asynchttpresponsehandler() { @override

java - How to switch automatically to tab when press button -

i have created tabbed activity 2 tab (tab 1,tab 2) want when press button on tab 1,switch automatically tap 2. you not define code give 2 code both scenario of tab activity (1) using viewpager (2)tab host (deprecated) ========================================================================= (1)if use viewpager use below one===> viewpager.setcurrentitem(0); you have call parent view inside fragment. public class moviesfragment extends fragment { viewpager viewpager; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_movies, container, false); button btn = (button) rootview.findviewbyid(r.id.btn); viewpager = (viewpager) getactivity().findviewbyid(r.id.pager); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick