Posts

java - LibGDX autoscale text in Label -

in libgdx project have label displays number wich bigger. when number gets big, bigger label. how can size of text gets smaller when text bigger label, isn't big more? i never tried it, if label documentation , there setfontscale method . did try ? the width of label given yourlabel.getprefwidth() , width of text inside label given yourlabel.getglyphlayout.width . compare both, , scale down font if width of text bigger thant width of label. i guess use in render() : if(yourlabel.getglyphlayout.width > yourlabel.getprefwidth()){ yourlabel.setfontscale(yourlabel.getprefwidth()/yourlabel.getglyphlayout.width); }

iOS Phonegap Upload and Download error (cordova js version: 3.8.0) -

i working on project need 2 things: download media files upload picture taken camera in android both works awesome either jelly beans, kitkat or lollipop. in ios both didn't worked. download media files: in android had used download option of file-transfer plugin... , in path had given: var fileurl = '/sdcard/'+dynamic_file_name; so after download completes can view downloaded file going sdcard in android. but in ios tried lot like: var fileurl = cordova.file.documentsdirectory+dynamic_file_name; var fileurl = filesystem.root.tourl() + "/"+dynamic_file_name; var fileurl = cordova.file.datadirectory+dynamic_file_name; var fileurl = cordova.file.synceddatadirectory+dynamic_file_name; while using above download complete message when go videos or audio files in device don't see file downloaded (fyi, when try code in simulator, going path downloaded in app, can see file downloaded in device ios don't have such device manager see downlo...

SQL Server 2008 R2: Get table_name from view from other database -

i have 2 database namely db1 , db2 . presently working on database db1 . have view stored in database db2 name view_1 . want table names present on view database db1 . my try: i using database db1 . try 1 : select table_name information_schema.view_table_usage view_name = 'db2..view_1'; try 2 : select table_name information_schema.view_table_usage view_name = db2..'view_1'; but not getting table_name's other database view. like this select table_name db2.information_schema.view_table_usage view_name = 'view_1';

java - Decipher this regex -

i came project working on several months ago, , 1 problem figured out when need extract part of string. string used both paranthesis , quotationmarks, couldn't split normal text. example of how string might look: word_object("id"): preword:subword now wanted grab what's after ("id"):, 'preword:subword' i found regex helped me out, , took quite time find example applicable wanted. had settle example, because tried find sources on how learn incredibly complex system failed hard @ that. regex solved looks this: "word_object(\\(\"" + "id" + "\")\\): " i content seemed work, when got project , tried it, trying extract word used underscore _ and underscore following word(s) left out. example, splitting text word_object("id"): preword:subword_underscoreword using regex (using complete line now) idsplit = subtemp.split("word_object(\\(\"" + "id" + "\...

hierarchy information while using grouped category plugin in highchart -

Image
while using grouped category plugin, $('.highcharts-axis-labels text, .highcharts-axis-labels span').click(function () { console.log(this.textcontent || this.innertext); }); the above code snippet give info clicked xaxis label, there way ascertain parent of same? i parent "forecast" when click "footwear" in above chart you can use custom-events extenstion , add click event on xaxis labels. name of parent can extracted textstr value. labels: { events: { click: function () { alert(this.parent.label.textstr); } } }, example: http://jsfiddle.net/taq9v/9/

angularjs - how to import different methods from different files to another javascript file for page objects E2E testing using protractor -

how import different methods different files javascript file page objects e2e testing using protractor. dividing page-objects per each individual page , writing possible actions on page methods. so, how import methods multiple pages(files) test file. you use require import page objects specs: var mypage = require("./po/mypage.po.js"); see examples at: using page objects overcome protractor's shortcomings using page objects organize tests

Groovy ifs - how to do it better (rewritting code from Java to Groovy) -

let's assume have such code in java: if(a) { return x } if(b) { return y } return z how rewrite in groovy? we can't write because isn't working. can write this: if(a) { return x } else { if(b) return y else return z } but isn't quite elegant. ideas? it can done ternary operator: def x = 1 def y = 2 def z = 3 def = null def b = 1 assert 2 == ? x : b ? y : z = 1 b = null assert 1 == ? x : b ? y : z = null b = null assert 3 == ? x : b ? y : z