Posts

Showing posts from April, 2012

Java: retrieving and printing out items from an arraylist using getters -

i writing program simulate system in coffee shop person takes orders of customers gives customer token number , enters system token number of customer along items s/he has ordered. recordorder function carries out operation allows order details input. order represented token id, tid, , arraylist of strings representing items in order. here have done far: import java.util.arraylist; import java.util.list; import java.util.scanner; public class ques4 { private static class order{ private int tid; private int orderid; private string itemname; public order(int tid,string itemname){ this.tid=tid; this.itemname=itemname; } public int gettid() { return tid; } public void settid(int tid) { this.tid = tid; } public string getitemname() { return itemname; } public void setitemname(string itemname) { this.itemname = itemname; } /*public string tostring(){ return

html - How to move form to center of page -

html: <div id="registercontainer"> <div class = "regform"> <h1> </h1> <div id = "back_glob"> <div id = "back_form"> <form method="post"> <label>first name</label> <input type="text" name ="fname"/> <label>last name</label> <input type="text" name ="sname"/> <br/> <label>email address</label> <input id = "email" name = "email" type = "text"/> <br/> <label>create username</label> <input name = "uname" type = "text"/> <br/> <label&g

Wordpress add custom post type to menu -

Image
on main menu shown below have posts , projects. i'd create category below projects called research. how add option menu please? since there no code provided, can't show wrong or not working. need @ info further. wordpress provides lot of information on this. stefan stated, can quick google search on custom post types , there plenty of tutorials , information. can find information on registering post type here you can download plugins make custom post types easy , fast implement. as far adding custom post type admin panel treehouse has great tutorial taking through entire process start finish here hope helps.

powershell - Filter a few computers before exporting from pipeline -

i need filter out 4 machines prior exporting csv file. have no clue how filter them out. tried if clause produced nothing. please help. $old = (get-date).adddays(-90) # modify -90 match threshold $oldcomputers = get-adcomputer -searchbase "ou=workstations,dc=corporate,dc=local" -searchscope 2 -filter { passwordlastset -le $old } -properties * $oldcomputers if ($_.name -notlike "1919dd" -or $_.name -notlike "1919smaheshware" -or $_.name -notlike "1919ietest" -or $_.name -notlike "1920bpasceritb") { export-csv c:\temp\over90daysmachines.csv -notypeinformation -force -append } for 1 thing, able use current object variable ( $_ ) need pipeline context. putting if statement after echoing variable doesn't automagically feed echoed value(s) if statement. need change this: $oldcomputers if ($_.name -notlike "1919dd" -or ...) { export-csv c:\temp\over90daysmachines.csv -notypeinformation -force -app

android - How to fix null pointer in PreferenceActivity? -

in android error caused by: java.lang.nullpointerexception: attempt invoke virtual method 'void android.preference.preference.setonpreferenceclicklistener(android.preference.preference$onpreferenceclicklistener)' on null object reference @ com.impyiablue.stoxx.usersettingactivity.oncreate(usersettingactivity.java:32) @ android.app.activity.performcreate(activity.java:5977) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) @ android.app.activitythread.performlaunchactivity(activitythread.java:2258) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2365)  @ android.app.activitythread.access$800(activitythread.java:148)  @ android.app.activitythread$h.handlemessage(activitythread.java:1283)  @ android.os.handler.dispatchmessage(handler.java:102)  @ android.os.looper.loop(looper.java:135)  @ android.app.activitythread.main(activitythread.java:5272)  @ java.lang.reflect.method.invoke(na

Highcharts - Export with background color -

i trying export chart , "white" background color. rendered background black (black color in page/code actually). don't know black color comes during download. can please. attaching "exporting" tag below exporting: { chartoptions: { // specific options exported image plotoptions: { series: { datalabels: { enabled: true } }, chart: { events: { load: function () { globalbackground = '#fff'; this.plotbackground.attr({ fill: globalbackground }); } } } }

Can perl scripts be executed from within a Gradle script? -

is possible call existing perl script within gradle task? i've tried searching can't find @ all, surprising (i found stuff calling gradle within perl not other way around). does know if , how this? sure can gstring . example. def process = "perl somescript".execute() def returnvalue = process.waitfor() println "{$returnvalue}: text execution: ${process.text}"

openstack - Glance image registration from remote server -

i trying register image server remote openstack glance installation. have processed image locally through shell script , want import in glance running on different system. thanks in advance looks need upload image glance: make sure have glance-client installed pip install python-glanceclient source openrc #an openrc file creds remote openstack installation, see [1] reference glance image-create --container-format container_format --disk-format disk_format --name image_name --file a-path-to-local-image-file --progress see "glance image-create" params description that's it. image uploaded remote glance installation on http. can list images there via glance image-list [1] http://docs.openstack.org/icehouse/install-guide/install/apt/content/ch_clients_openrc_files.html

selenium - C#: How to create a folder for a specific function? -

i using selenium automation purpose. have class screenshot , page object method call element in different class every page. calling screenshot of page in every class. here think how create folder name screenshot in folder. result.cs class result { static int = 1; public static void screenshot() { itakesscreenshot screenshotdriver = mycollection.driver itakesscreenshot; screenshot screencapture = screenshotdriver.getscreenshot(); string path = @"..\..\..\results\screenshots\"; string timestamp = datetime.now.tostring("yy-mm-dd hh-mm-ss"); { screencapture.saveasfile(@path + + timestamp + ".png", system.drawing.imaging.imageformat.png); i++; } } } loginpageobject.cs [findsby(how = how.name, using = "txtusername")] public iwebelement username { get; set;} [findsby(how = ho

php - How to make $_GET function work with Rewritten url? -

i tried using $_get['glossary'] function in wordpress functions.php hide path of specific post following domain https://sampledomain.com?glossary=extrathing here full code of this if ($_get['glossary']){ printf('<style>.author-box{display:none;}</style>'); } it worked perfect , hide author-box specific post. however when did activated permalink in wordpress changed url to https://sampledomain.com/glossary/extrathing/ the above function of $_get no more working, suggestion on please ? you can change if condition check uri if ($_get['glossary'] || $_server['request_uri'] == '/glossary/extrathing/'){ printf('<style>.author-box{display:none;}</style>'); }

javascript - Saving input data from JQuery form -

i'm trying user enter email id text-box, can store database. here's barebones html corresponding jquery code can examined in basic functionality. i'm still learning js might have picked code here , there. problem: email id isn't being displayed on screen. <form id="signup-form"> <div class="form-group"> <input type="text" class="form-control" name="email" id="email" placeholder="get informed when it's online!"/> <button id="signup-button" class="btn btn-default">count me in!</button> </div> </form> jquery: $("#signup-form").ready(function() { $("#signup-button").click(function() { alert($('#email').val()); }); }); don't know i'm doing wrong. help. use document $(document).ready(function() { $("#signup-button").click(func

java - How can I Subtract these lists faster? -

i want subtract 2 arraylists can have child not in other list. i way: removeids=(arraylist<integer>) storedids.clone(); removeids.removeall(downloadedids); downloadids=(arraylist<integer>) downloadedids.clone(); downloadids.removeall(storedids); the problem both lists contain 5000childs , takes 4 seconds on androidphone. is there fast way this? using sets faster?(i dont have duplicate values in lists) i develop android app use hashset instead of arraylist unless need keep order. removing element requires scan of full list list implementations, hashset comparison calculation of hash code , identification of target bucket.

php - Find value of specific key in multidimensional array -

from json feed receive multidimensional array below. array need values specific keys, value @ [payment_url]. i'm aware can value with $arr['transactions'][0]['payment_url']; but since documentation bit 'concise' i'm not sure if there response level. henche, function feed key name , returns value unregarded on level key is. like getvalue($arr, 'payment_url'); how do this? array ( [amount] => 2525 [client] => array ( [user_agent] => gingerphplib ) [created] => 2016-01-15t21:35:17.032535+00:00 [currency] => eur [description] => description [flags] => array ( [0] => is-test ) [id] => xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx [merchant_order_id] => 205 [modified] => 2016-01-15t21:35:17.734427+00:00 [project_id] => xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx [return_url] => http://path/to/return/url/test [status] => new [transactions] => array ( [0] => ar

New line in Meteor HTTP POST -

what correct way insert new line in meteor.http post call? here's do: var result = http.call("post", url, { params: { field: value }, headers:{ "[header field]":"[header value]" } }); i want value in case multiple strings separated new lines. have tried: value = "firstitem" + "%0a" + seconditem + "%0a" + thirditem the api using expects value different items, each on new line. when post request, api consumes string , doesn't identify items separate inputs. thoughts? a post request has it's parameters separated & if you're using application/x-www-form-urlencoded: parameter=value&also=another that being said, if use application/x-www-form-urlencoded, w3c spec states "%0d%0a" new line can try too. https://www.w3.org/markup/html-spec/html-spec_8.html#sec8.2.

Ruby on Rails paperclip imagemagick error -

i know has been asked before, none of provided solutions seems work for. keep gettin error while try upload files paperclip , imagemagick. could not run `identify` command. please install imagemagick. i installed imagemagick few times alreay with sudo apt-get install imagemagick i put these in development.rb. i'm not sure means, read in in question here: paperclip.options[:image_magick_path] = "/opt/imagemagick/bin" paperclip.options[:command_path] = "/opt/imagemagick/bin" this model: class book < activerecord::base has_attached_file :file has_attached_file :picture, :styles => { :small => "100x200"} validates_attachment :picture, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] } is there else can do? ther eis error after installation of imagemagick. dont know how can fix it: warning: following packages cannot authenticated! imagem

php - Query in a while loop fetching stale data -

i trying (and not succeeding) run while loop query gets last row in table, uses data create new row selects last row in table again (which should row created) uses data , creates new row. should repeat until while loop no longer true. the problem have while loop runs uses row selected first time round. same row inserted on , on until while loop false. my question how can query refresh when while loop starts new loop? i have tried unset() did not work , out of ideas. here while loop of code (which still in progress - still add):- while ($total_debt > 0) { $get_dp_accounts_list_query = "select account_id money_debt_planner customer_id = '".$_session['customer_id']."' group account_id"; $get_dp_accounts_list = $db->execute($get_dp_accounts_list_query); while (!$get_dp_accounts_list->eof) { $get_dp_accounts_listarray[] = array('account_id'=>$get_dp_accounts_list->fields['

Python url string match -

my problem following. have long list of urls such as: www.foo.com/davidbobmike1joe www.foo.com/mikejoe2bobkarl www.foo.com/joemikebob www.foo.com/bobjoe i need compare entries (urls) in list each other, extract keywords in subdomains of urls (in case: david, joe, bob, mike, karl) , order them frequency. i've been reading several libraries such nltk. problem here there no spaces tokenise each word independently. recommendations on how job done? limitations if refuse use dictionary you're algorithm require lot of computation. above that, impossible distinguish keyword occurs once (e.g: "karl") crappy sequence (e.g: "e2bo"). solution best effort , work if list of url's contains keywords multiple times. the basic idea i assume word sequence of characters occur of @ least 3 characters. prevents letter "o" being popular word. the basic idea following. count n letter sequences , select once occur multiple times. cut sequen

node.js - ENOTUP warning using grunt in Azure -

in simple copy task in azure werservice warning stop build process warning: enotsup: operation not supported on socket, scandir my copy task config dist: { nonull: true, files: [{ expand: true, src: [ '<%= app.dir %>/*.js', '<%= app.dir %>/dev/*.js', '<%= app.dir %>/models/*.js', '<%= app.dir %>/src/*.js', 'build/*/*', 'public/*/*', 'iisnode.yml', 'server.js', ], dest: '<%= dist.tmp %>', }] } node version : 5.1.1 how can fix problem? or suggestion appreciated currently, found maybe need remove iisnode.yml src list. issnode.yml not javascript script configuration file iisnode, , raise grunt warning , throw exception on side. haven't reproduced issue. so if convenient of provide project repo or complete gruntfile content, great helpful reproduce issue.

javascript - Underscore.js : matching string in deeply nested objects -

i need find out object in deep nested array contains string toys & games (the deepest object in nest). i trying select right object with: var arr = _.filter(data, function(obj) { return _.some(obj.ancestors, {'name': "toys & games"}); }); where data being passed in .filter is: { "browsenodeid":[ "11608080011" ], "name":[ "quadcopters & multirotors" ], "ancestors":[ { "browsenode":[ { "browsenodeid":[ "166583011" ], "name":[ "rc vehicles" ], "ancestors":[ { "browsenode":[ { "browsenodeid":[

r - Which vector posseses the nearest lower value? -

goal given 3 vectors a , b , x , vector sol stating true every time nearest lower value of a , b united comes a , false if comes form b . information data a relatively short (~80 elements) vector of integers. b relatively short (~200 elements) vector of integers. x long (1e7-1e8 maybe) vector of integers. example data these data shorter 1 set.seed(31) while(true) { = floor(runif(30, 1,1e5)) b = c(1,floor(runif(80, 1,1e5))) if (!any(c(a %in% b, b %in% a))){break} } x = floor(runif(300, 1,1e5)) non-performent solution the following should work slow x become long. sol = rep(na,length(x)) (i in 1:length(x)) { xi = x[i] ma = max(a[a<=xi]) mb = max(b[b<=xi]) if (ma>mb) {sol[i]=true} else {sol[i]=false} } note on performance the process repeated maybe 1000 times. don't have accurate estimation of number of repeats , length of x though. benchmark @marattalipov answer in comparison mine set.seed(31) while(true) {

xml - How to avoid duplicates generated from XSLT -

i have each loop on xslt file, go , process multiple conditions, if of conditions have matching scenario want exit out of loop , give first value(which has satisfied condition) output. here xml file <product> <contactdetails> <addressdetail> <street>stack</street> <housenumber>123</housenumber> </addressdetail> <addressdetail> <street>stack</street> <housenumber>123456</housenumber> </addressdetail> <addressdetail> <street>stack</street> <housenumber>456</housenumber> </addressdetail> </contactdetails> </product> and in xsl file have kinding this <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0" xmlns:fo="http://www.w3.o

excel - If entered word is found in worksheet, then excute A, if not found, then excute B -

i tried write macro if enter 3-letter month abbreviation , it's found in working sheet, executed; else (if not found), let message box pop ("what entered doesn't match anything"). below code. works when there's match, when there's no match or wrong-typed 3-letter word, there's debug message - " run time error '91': object variable or block variable not set" . the line triggers error is: if sheets("sheet1").cells.find(what:=findmonth, _ lookin:=xlformulas, lookat:=xlwhole).column <> "0" can tell what's wrong it? how can fix error? thank you. sub cdaenter() dim rwcrow integer dim mscolumn1 integer dim mscolumn2 integer dim mscolumn3 integer dim mscolumn4 integer dim pdrrow1 integer dim pdrrow2 integer dim pdrrow3 integer dim pdrrow4 integer dim mcolumn integer dim findmonth string rwcrow = sheets("sheet2").cells.find(what:="rwc").row mscolumn1 = sheets("sheet2"

Can I Force CKEditor To Make The First Line An H1? -

Image
can force ckeditor make first line h1 default? then, after hitting enter, want else "normal" default. the reason seamlessly generate title without requiring separate title field. no, it's (probably) impossible. because you'd need hack selection, block commands except h1 format , on. you'd spend lot of time result hacky , unstable, totally not worth effort. simply, not ckeditor has been made for. the fastest way implement separate field in form ( <input> ) or, if want have rich editing features (like links or colors in <h1> ), create inline editor instance out of <h1> like <h1 contenteditable="true" id="title">title</h1> ckeditor.inline( 'title', { ...config } ); and collect value using ckeditor.instances.title.getdata() . there's editor#change event, might helpful if decide synchronise inline editor hidden field in form.

0 Pad Day and Month in a Date String using JavaScript -

using javascript there way take date string 9/17/2014 , modify day , month values padded 0 if single digit in length? the catch delimiter / can anything. - or / if looked 2 fine to. also order of day, month, , year can in position. my end goal take date string , make date portion 10 characters in length can grab remaining characters exist , assume time portion of datetime string. if string though 9/17/2014 date portion 9 long , if day single digit 9/7/2014 8 long. i working on javascript function convert date string js date object. allows style delimiter , order day, month, , year parts. my goal modify allow date strings can have time after date part , parse them time pieces. if string has time parts, assume time delimiter : . the separator between date , time in string either: space 04/04/2016 12:23:12 t 04/04/2016t12:23:12 also time may or may not have ending am or pm . my issue @ moment date part not being 10 character length if auto 0 pad si

gtk - FileChooserButton behaviour -

i've been getting strange behaviour when connect selection_changed function in filechooserbutton. of so users understand selection_changed syntax. weird happening when use second time in same program. context my aim create window 2 filechooserbuttons , entry text @ end position of window. first filechooserbutton helps user pick directory , causes second filechooserbutton open @ directory user chose in first one. until point code working perfectly. entry drawn , says "here goes filename". intended behaviour change entry's text upon selection of filename in second filechooserbutton after checking whether file writable. the strategy used connect selection_changed function takes care of checking wether file writable , change of entry's text. the problem function never called. added debugging dumb code like: stdout.printf("checking whether function called") it never gets printed,thus suppose function never gets called. function in question fi

android - How can I call an URL when I use setContentView()? -

i developed simple game , want give external url web page. problem that, i'm using setcontentview in oncreate method of main activity. game content dynamic , cannot use intents instead of setcontentview. however, know, oncreate called once , way found on web call url "using intents". not working because setcontentview thing running. here codes: gameactivity.java private static gamecontent gamecontent; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); gamecontent = new gamecontent(this); setcontentview(gamecontent); } // on.c.ends my gamecontent class extends surfaceview , runnable. call draw(), pause() , resume() methods here. have class basicbutton , added gamecontent , draw it. works. here part want use: basicbutton.java @override public void update() { if (xx > (rate.getx()) && xx < (rate.getx() + rate.getplaybutton('x'))) if (yy > (rate.gety()) &&

linux - Getting number of pattern matches in VTE search -

i'm developing gtk+ 3.0 application uses vte widget, how can number of occurrences search regex or @ least current text in terminal , process that? i'm using vte 2.91 , vala. vte.terminal.get_text() visible text in terminal processing. i'm not sure that includes text that's scrolled off screen. you try vte.terminal.select_all() followed vte.terminal.copy_clipboard() , copied text off clipboard, i'm not sure work.

MySQL Order with decimals -

i've got problem mysql ordering. query: select * versions order version desc it lists of versions this: 25.0.1364.86 25.0.1364.124 23.0.1271.100 however .124 higher .86. how can fix it? a small improvement query posted @peterm (with thanks!) select * `versions` order 1*substring_index(version, '.', 1) asc, 1*substring_index(substring_index(version, '.', -3),'.', 1) asc, 1*substring_index(substring_index(version, '.', -2),'.', 1) asc, 1*substring_index(version, '.', -1) asc, version asc # sort non-numeric strings i tested more complicated values, letters, numbers, dashes , points, versions can written in format. | version | ----------- | a-b | | a-c | | ab | | b | | c | | c.a | | c.a.b | | c.b | | c.b.a | | c.b.b | | ca | | 1.2 | | 1.2.1 | | 2.1.1 | | 2.1.2 | | 3 | | 10 | | 123 |

html - CSS - Using Hover on elements inside a tag? -

i want use hover couple divs inside tag. for example here <a href="#"> <div class="nextmatch_wrap"> <div class="clan12w"> <div class="teamlogos"> <div class="team" id="teamcontainer"> <img src="#"> </div> </div> </div> <div class="clan12w"> <div class="teamlogos"> <div class="team" id="teamcontainer"> <img src="#"> </div> </div> </div> </div> if hover on tag want colored border appear on "teamcontainer" , "teamlogos" i'm not css have tried a nextmatch_wrap, :hover #teamcontainer, nextmatch_wrap, :hover .r-home-team{ border:solid 1px #25c2f5; } it works somehow hover on when mouse on anywhere in page when move mouse out of browser

vba - Two array element combination in vb -

Image
i want combine arrays in program. take example: a = {1,2,3,4,5} b = {6,7,8,9,10} this should produce array containing first element of first array elements of second array except first element, {1,7,8,9,10} . should continue possible combinations, producing these output arrays: {1,7,8,9,10} {6,2,8,9,10} {6,7,3,9,10} {6,7,8,4,10} {6,7,8,9,5}... for 2,3,4 elements of first array second array {1,2,8,9,10} {6,2,3,9,10} {6,7,3,4,10} {6,7,8,4,5} {1,7,8,9,5}... {1,7,3,9,10} {6,2,8,4,10} {6,7,3,9,5} {1,7,8,4,10}..... and vice versa second array. for first combination i've tried: for = 0 4 'first array loop j = 0 4 'second array loop if <> j arr(j) = arr2(j) else arr(j)=arr1(j) end if next next this give every combination possible: function fifth(paramarray arr() variant) variant() dim temp() variant dim long dim j long dim t long = lbound(arr) + 1 ubound(arr) if ubound

php - How to post data to my server after successfull twitter authentication -

i want implement twitter authentication on website same visitors comment on aljazeera.com . i'm using twitteraouth library in codeigniter framework , working fine can see twitter data after successfull authentication. what want add functionality users comment on post should stored on server twitter user_id.

qt - How to put files generated by CMAKE_AUTOMOC in specific folder -

i doing out of source build cmake. current folder structure: |_projectroot |_build |_src |_inc since using qt, cmakelists.txt file contains these line in order generate required ui_*.h , moc_*.h : set(cmake_automoc on) set(cmake_autorcc on) set(cmake_include_current_dir on) all ui_*.h , moc_*.h files put in projectroot\build default. is there chance can specify moc_*.h generated put under projectroot\moc , ui_*.h put under projectroot\ui . cmake has no option that.

syntax - What does the arrow ( -> ) between two types mean in Swift? -

while researching separate issue, came across question: how create generic closures in swift they have function definition this: func savewithcompletionobject(obj : anyobject, success : anyobject -> void, failure : void -> void) what -> in anyobject -> void mean? it’s function type . anyobject -> void type of function accepting anyobject , returning void .

reflection - Get function by name dynamically in Kotlin -

how can dynamically function name in kotlin ? i.e: fun myfunc11() { println("very useful function 11") } val funcname = "myfunc" + 11 val funcref = getfunction(funcname) funcref() edit: accepted answer appears correct, code hitting bug in kotlin. bug report submitted: https://youtrack.jetbrains.com/issue/kt-10690 the global functions such fun myfunc11() { ... } defined in file named i.e. global.kt compiled static methods on class named globalkt described in the documentation . to function reference name you'll need load class defines it. if know file name defines function reference you're trying find can do: fun getfunctionfromfile(filename: string, funcname: string): kfunction<*>? { val selfref = ::getfunctionfromfile val currentclass = selfref.javamethod!!.declaringclass val classdefiningfunctions = currentclass.classloader.loadclass("${filename}kt") val javamethod = classdefiningfunctions.me

list - Python in operator is not working -

when run code, nothing shows up. example call ind(1, [1, 2, 3]) , don't integer 13 . def ind(e, l): if (e in l == true): print('13') else: print('12') operator precedence. if put ( , ) around e in l work: def ind(e, l): if ((e in l) == true): print('13') else: print('12') ind(1, [1, 2, 3]) but testing true can done (and usual idiom) done without true def ind(e, l): if (e in l): print('13') else: print('12') ind(1, [1, 2, 3]) edit: bonus can use true , false keep/nullify things. example: def ind(e, l): print('13' * (e in l) or '12') ind(1, [1, 2, 3]) ind(4, [1, 2, 3]) and ouputs: 13 12 because e in l has first been evaluated true , 13 * true 13 . 2nd part of boolean expression not looked up. but when calling function 4 , following happens: `13` * (e in l) or '12` -> `13` * false or '12&

actionscript 3 - Detail lifespan of all ActionScript3 object -

i use actionscript3 develop web , mobile game. memory biggest enemy, don't know detail lifespan of objects. instance: bitmap know there "dispose" function of bitmapdata. always, dispose bitmap object using "bitmap.bitmapdata.dispose". however, wonder if reference of bitmap object becomes 0, gc free memory used object if don't call dispose function. i have many questions above (sound, texture, basetexture...). has ideas topic? the object's lifespan determined 1 single thing - if it's no longer referenced anywhere, it's considered dead (orphaned) , subject removed memory. yes, bitmapdata object removed memory without explicit dispose() call, if drop references it. about sound or texture objects - these best being reused, example, can call mysound.play() multiple times, generate separate soundchannel object lifetime duration of sound, if it's unreferenced. likewise can use same texture object have multiple instances of being

android - How 2 fragments communicate each other inside an activity -

this question has answer here: communicating between more 2 fragments 2 answers consider activity can call base activity. 2 fragments added base activity , call fragmentone , fragenttwo.how can fragmentone can communicate fragenttwo , vice versa . you can define interface communicate between fragments. go through link http://developer.android.com/training/basics/fragments/communicating.html hope helps.

android - AlertDialog not showing while cancelling AsyncTask -

i have got little problem while cancellling asynctask, in a fragment processes data. if internet session expired asynctask should cancelled , dialog shown inform user. however if cancel asynctask alertdialog not shown, noticed oncancelled() is not being called onpostexecute() is still executed. if pls assist? edit: if use while method, alertdialog shown how cancel asynctask code of try in doinbackground() still being executed? while (!iscancelled()) { // stuff } edit 2: solved! seemed asynctask call not correctly instinciated, below code works , oncancelled method called , onpostexecute declined should be. cudos anudeep bulla point me in right direction. public class tb3_abonnement extends fragment { private asynctask<void, void, void> task; ... @override // if fragment visible user, start asynctask public void setuservisiblehint(boolean isvisibletouser) { super.setuservisiblehint(isvisibletouser); if (isvisibletouser) {

android - Animate marker movements along prepared coordinates. -

i need make animated movement if airplane marker along stored coordinates in arraylist collection. i've found solution, how move marker 1 coordinate another. here code of method, moves it: private void animatemarker(final marker plane, final latlng toposition, final boolean hidemarker, int currentindex) { final handler handler = new handler(); final long start = systemclock.uptimemillis(); projection proj = gmap.getprojection(); point startpoint = proj.toscreenlocation(plane.getposition()); final latlng startlatlng = proj.fromscreenlocation(startpoint); final long duration = 2500; final interpolator interpolator = new linearinterpolator(); handler.post(new runnable() { @override public void run() { long elapsed = systemclock.uptimemillis() - start; float t = interpolator.getinterpolation((float) elapsed / duration);

java mongodb 3.0: find value in internal array of documents -

i'm using java , mongodb v.3.0.7. have list of player internal array of games scores. test insert document: public void insertplayer(string id_device) throws parseexception{ dateformat format = new simpledateformat("yyyy-mm-dd't'hh:mm:ss'z'", locale.english); db.getcollection("player").insertone( new document() .append("nikname", "guest") .append("password", "guest") .append("my_id", "") .append("id_device", id_device) .append("language", "italian") .append("games", aslist( new document() .append("gamename", "ppa") .append("ban