Posts

Showing posts from February, 2014

java - Organizing array of unknown number of constants in all possible ways -

this question has answer here: permutations/combinatorics library java? [closed] 2 answers permutation of array 8 answers what best way of looping through array, ending organizing in possible ways can organized in? suppose have array: {a, b, c, d} what organize so: {b, a, c, d} {b, d, c, a} and forth, looping around creating 1 array analyze per looping. thank you,

Why are markers not shown on PrimeFaces GMap? -

i use following code initialize mapmodel , add test marker . @postconstruct public void init() { advancedmodel = new defaultmapmodel(); advancedmodel.addoverlay(new marker(new latlng(36.890257, 30.707417), "test")); } it used gmap model following xhtml. <p:gmap id="gmap" center="36.890257,30.707417" zoom="12" type="roadmap" model="#{mapbean.advancedmodel}" style="width:100%; height:400px;" /> when open page in browser map shows not marked. suggestions? the problem on using spring framework. class had annotated @named instead of @managedbean

python - To create loop that lets my regression formula include one variable each tome -

i've been working on stepwise regression. i'll find loop lets regression formula include 1 variable each time, i'm having trouble loop. code follows: def forward_selected(data, response): remaining = set(data.columns) remaining.remove(response) selected = [] current_aic, best_new_aic = 0.0, 0.0 while remaining , current_aic == best_new_aic: aics_with_candidates = [] candidate in remaining: formula = "{} ~ {} + 1".format(response,' + '.join(selected + [candidate])) aic = smf.ols(formula, data).fit().aic aics_with_candidates.append((aic, candidate)) aics_with_candidates.sort(reverse=true) best_new_score, best_candidate = aics_with_candidates.pop() if current_aic < best_new_aic: remaining.remove(best_candidate) selected.append(best_candidate) current_aic = best_new_aic formula = "{} ~ {} + 1".format(res...

android - variable textview not working -

i have code , cant variable string here private void location() { layoutinflater layoutinflater = layoutinflater.from(this); view promptview = layoutinflater.inflate(r.layout.alquila, null); textview tv = (textview) promptview.findviewbyid(r.id.gen); random r = new random(); int = r.nextint(101); tv.settext(i +""); final string passwd = tv.gettext().tostring(); final alertdialog alertd = new alertdialog.builder(this).create(); button btnadd1 = (button) promptview.findviewbyid(r.id.button3); btnadd1.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { new sendpostrequest().execute(); toast.maketext(login.this, passwd, toast.length_long).show(); // btnadd1 has been clicked alertd.dismiss(); } }); alertd.setview(promptview); alertd.show(); } and need variable string "passwd" to... public class sendpostrequest extend...

java any class for temperature? -

i trying write code checking temperature every hour. there class java.util.calendar; gets months , hours , seconds there class getting temperature? help. there libraries available such jscience , there's no class temperature measurements included in jdk. in case this, need @ conversion between fahrenheit , celsius, suggest write own, or use double.

ios - My ImageView's content mode stop working after I draw something on the image -

thanks time. the image fine before tap image, , image compacted after tap it. here code: i not using storyboard, create code, here imageview. , added constraints code well. let imageeditingview: uiimageview = { let imageview = uiimageview() imageview.contentmode = .scaleaspectfill imageview.clipstobounds = true return imageview }() override func touchesbegan(_ touches: set<uitouch>, event: uievent?) { if touches.first != nil { lastpoint = (touches.first?.location(in: imageeditingview))! } } override func touchesmoved(_ touches: set<uitouch>, event: uievent?) { if touches.first != nil { let currentpoint = touches.first?.location(in: imageeditingview) drawlines(frompoint: lastpoint, topoint: currentpoint!) lastpoint = currentpoint! drawlines(frompoint: lastpoint, topoint: lastpoint) } } func drawlines(frompoint: cgpoint, topoint: cgpoint) { uigraphicsbeginimagecontext(imageeditingv...

c# - Default combobox first item mixed with database results -

public static void fill_combo(string table, combobox cmb, string columns) { ds = new dataset(); try { conn.open(); da = new sqldataadapter($"select {columns} [{table}]", conn); da.fill(ds, table); cmb.datasource = ds.tables[table]; cmb.valuemember = ds.tables[table].columns[0].tostring(); cmb.displaymember = ds.tables[table].columns[1].tostring(); cmb.selecteditem = null; cmb.text = "select..."; } catch (exception ex) { messagebox.show(ex.message, "error"); } { if (conn != null) { conn.close(); } } } hey guys. code above i'm trying results database , bind them combobox, want first item random "select..." isn't in database. in advance. option 1 - can insert datarow containin...

javascript - Set height to all divs with a specific class using pure js -

hi i'm trying don't think should hard in javascript can't work. have number of div s class nav-img , have width of 20%. want div s have same aspect ratio, no matter size of window. height should width/1.35. here tried : var vnavimg = document.getelementsbyclassname("nav-img"); var vnavwidth = window.getcomputedstyle(vnavimg).width; window.onload = setheight; function setheight() { vnavimg.style.height = vnavwidth/1.35+"px"; } so close, method getelementsbyclassname() return array of objects have given class argument, should loop through them , assign new height : var vnavimg = document.getelementsbyclassname("nav-img"); for(var i=0;i<vnavimg.length;i++){ vnavimg[i].style.height = vnavwidth/1.35+"px"; } or using function setheight() : var vnavimg = document.getelementsbyclassname("nav-img"); for(var i=0;i<vnavimg.length;i++){ setheight(vnavimg[i]); } function setheight(div) { ...

Returning a List to a Function -

import random def genlist1(): list1 = [x x in range(100)] count = 0 count in list1: print(random.randint(2,25), end = " ") return def main(): print(genlist1()) main() the above code- prints 100 random digits between 2 , 25, returns "none" function. how can return list of 100 random digits function in following code. import random def genlist1(): list1 = [x x in range(100)] count = 0 count in list1: random.randint(2,25) return list1 def genlist2(): list1 = genlist1() list2 = [x**2 x in list1 if x % 2 == 0] return list2 def genlist3(): list2 = genlist2() list3 = [0.5*x x in list2] return list3 def gensum1_2(): list2 = genlist2() list3 = genlist3() sum1 = 0 number1 = 0 number1 in list2: sum1 = sum1 + number1 sum2 = 0 number2 = 0 number2 in list3: sum2 = sum2 + number2 return sum1, sum2 def main(): print("here l...

laravel - How to implement 'getPermissions' for Contracts\HasPermissions? -

i'm following documentation of laravel-doctrine on acl http://www.laraveldoctrine.org/docs/1.2/acl/ , got trouble doing it. i creted class roles this: <?php namespace app\entities; use doctrine\orm\mapping orm; use laraveldoctrine\acl\contracts\role rolecontract; use laraveldoctrine\acl\contracts\haspermissions haspermissioncontract; use laraveldoctrine\acl\permissions\haspermissions; /** * @orm\entity * @orm\table(name="role") */ class role implements rolecontract, haspermissioncontract { use haspermissions; /** * @acl\haspermissions */ public $permissions; /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\column(type="string") */ protected $name; /** * @return int */ public function getid() { return $this->id; } /** * @return string ...

python - Find max value and the corresponding column/index name in entire dataframe -

i want select maximum value in dataframe, , find out index , column name of value. there way it? say, in example below, want first find max value ( 31 ), , return index , column name of value (20, r20d) a = pd.dataframe({'r05d':[1,2,3],'r10d':[7,4,3],'r20d':[31,2,4]},index=[20,25,30]) thanks! turn dataframe multipleindex series , ask index of max element argmax or idxmax function: coord = a.stack().argmax() coord (20, 'r20d') to value, use coordinates against loc : df.loc[coord] 31

javascript - How to make background photo change automatically after 5 seconds in asp.net + bootstrap -

how can background pic of page change after 5 seconds? thinking use carousel twitter bootstrap. every example i've seen far change image when press next button. what best it? should focus asp.net , css file make this? , code behind on c#, or add javascript or jquery? you can use bootstrap carousel data-interval="5000" set time 5000 in milli seconds equals 5 seconds . smaple code: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="5000"> <!-- indicators --> <ol class="carousel-indicators...

c# - ViewModel data is all null when passed to my controller? -

this question has answer here: asp.net mvc: why view passing null models controller? 2 answers i'm trying follow best practices add data validation ui. want add data validation viewmodel , if data valid, submit form controller. however, data controller receives null values. idea i'm doing wrong? whole mvvc architecture confusing me. had working when submitting form using model can't data validation on model? controller: [httppost] [validateantiforgerytoken] public async task<actionresult> createresource(addresourceviewmodel model) { if (modelstate.isvalid) { await (//does something); } return view(); } modelview: public class addresourceviewmodel { public string user { get; set; } public string resourcename { get; set; } public ...

c++ - For Loop Not displaying the lowest but the first in the array -

guys, i'm new arrays, i'm making program takes 2 parallel arrays finds both lowest , highest values based on value take highest string array value related integer arrays , outputs related lowest , related highest results on screen. this have far. #include<iostream> #include<string> #include<climits> //prototypes: using namespace std; void getjars(string[], int[], int); int gettotal(string[], int[], int); int getlowest(string[], int[], int); int main() { string salsa[] = { "mild", "medium", "sweet", "hot", "zesty" }; const int num = 5; int lowest = 0; int total = 0; int jars[num]; getjars(salsa, jars, num); total = gettotal(salsa, jars, num); cout << endl << "total of jars sold month: " << total << endl; lowest = getlowest(salsa, jars, num); cout << endl << lowest << endl; return 0; } void getjars(s...

c# - Unable to ChangeType from string to int? -

this question has answer here: how use convert.changetype() when conversiontype nullable int 3 answers in depths of our application there attempt perform conversion string nullable int convert.changetype(value, casttype) . in case values follows: value: "00010" casttype: nullable<system.int16> the issue receiving following error invalid cast 'system.string' 'system.nullable`1[[system.int16} i had (obviously incorrectly) believed similar cast or convert.toint16() i've verified it's not same testing following 2 lines of code. int16 t = convert.toint16("00010"); object w = convert.changetype("00010", typeof(short?)); as might suspect, first succeeds whereas second fails error message above. is possible use changetype in fashion making adjustment or should @ refactor? you'll need write th...

linux - ps start_time as timestamp -

i'm using ps command monitor processes. however, like have time output unix timestamp. the command using: ps -eo class,s,user,pid,pcpu,stat,start_time,cputime,args --sort=class | \ awk '$1 != "rr" && $1 != "ff" {print $0; next } 0' thanks! use etimes option (elapsed time since process started, in seconds) , awk 's systime() function returns current timestamp in seconds. suppose 7th column etimes , awk expression should this: nr == 1 ? "timestamp" : systime() - $7 example: ps -eo class,s,user,pid,pcpu,stat,etimes,cputime,args --sort=class | awk \ '$1 != "rr" && $1 != "ff" {print $0, nr == 1 ? "timestamp" : systime() - $7 }' sample output cls s user pid %cpu stat elapsed time command timestamp ts s root 1 0.0 ss 1717 00:00:01 init [3] 1479001705 ts s root 2 0.0 s 1717 00:00:00 [kthreadd] 1479001705 ts s root ...

tkinter - python-how to make an object 'suicide'? -

when created object in tkinter, how can make object destroy embedded command in object? code this; i'm coding game collects coins want make coins disappear after collecting them. from tkinter import* import time import random import math color=['gray','skyblue','orange','green','yellow','blue'] score=[0,0,0,0,0,0] class player: //player class. wasd keys class coin: def __init__(self,canvas,player,i): self.color=color[i] self.canvas=canvas self.player=player self.id=canvas.create_rectangle(10,10,20,15,fill=self.color,state='normal',width=0) self.canvas_width=self.canvas.winfo_width() self.canvas_height=self.canvas.winfo_height() self.x=random.randint(0,self.canvas_width-50) self.y=random.randint(0,self.canvas_height-50) self.canvas.move(self.id,self.x,self.y) self.i=i self.getc=false def draw(self): self.canvas...

c++ - Does using index brackets for a pointer dereference it? -

does using index brackets pointer dereference it? , why printing 0th index of pointer twice end printing 2 different things? #include <cstdlib> #include <iostream> #include <cstring> using namespace std; int *p; void fn() { int num[1]; num[0]=99; p = num; } int main() { fn(); cout << p[0] << " " << p[0]; } does using index brackets pointer dereference it? correct, pointer arithmetic equivalent array index. p[index] same *(p+index) . why printing 0th index of pointer twice end printing 2 different things? because using p point local variable ( num ) scope ends when fn() function ends. observed undefined behavior . returning pointer local variable bad practice , must avoided. btw, see scope effect, if move definition of num array outside fn() function, see consistent cout behavior. alternatively, @marc.2377 suggested, avoid global variables (which bad practice), can allocate vari...

powershell - How might I update this code to run a second time but only on a zip archive already unzipped? -

here code using: # don't include "\" @ end of $newsource - stop script # matching first-level subfolders $ignore = "somename" $files = gci $newsource -recurse | { $_.extension -match "zip||prd" -and $_.fullname -notlike $ignore } foreach ($file in $files) { $newsource = $file.fullname # join-path standard powershell cmdlet $destination = join-path (split-path -parent $file.fullname) $file.basename write-host -fore green $destination $destination = "-o" + $destination # start-process needs path exe , arguments passed # separately. can add -wait have process complete before # moving next start-process -filepath "c:\program files\7-zip\7z.exe" -argumentlist "x -y $newsource $destination" -wait } however, once finished need go through new directories , unzip .prd files created after unzipping .zip archives. need here tries aren't working , unzip , overwrite unzipped .prd , ....

convert a data frame into tensor in R -

i have data frame, contain thousands of firms year 1998 2007(each firm not have equal length of time duration). , want convert tensor index: firm, year, variables. how achieve ? i don't know how extract small part of data set put here discuss problem, 1 know how it? structure(list(year = c(1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998), firmid = c("qb3732337", "113810712", "618851819", "619457768", "hu5176905", "618024813", "617883552", "105679742", "230141773", "609442909", "hu6355534", ...

java - Android - NullPointerException in Fragment after callback -

this first time work fragments , don't understand how manage them. in case have 2 fragments show dinamically in framelayout id fragment_place. issue fragmenttransaction(addtobackstack / popbackstack). in fragment2 show popupmenu when press menubutton on mobile , works expected first time, after go previous fragment , return fragment2 if press menubutton following error java.lang.nullpointerexception @ android.support.v7.view.menu.menubuilder.<init>(menubuilder.java:216) @ android.support.v7.widget.popupmenu.<init>(popupmenu.java:103) @ android.support.v7.widget.popupmenu.<init>(popupmenu.java:78) @ android.support.v7.widget.popupmenu.<init>(popupmenu.java:63) @ package.fragment2.showpopup(fragment2.java:93) below code mainactivity , fragment2, driving me crazy, appreciated. public class mainactivity extends appcompatactivity implements fragment1.onevent { fragment1 frag; fragment2 frag2; @override protected void oncreate(bundle savedinstancesta...

javascript - jquery UI.js prevents to load dynamically loaded select menu -

i tried load dynamically loaded select menu page using ajax/php. jquery ui plugging prevents load dynamically loaded data. can't see nothing when change first select menu. my code this. <script> $(document).ready(function($) { var list_target_id = 'list-target'; //first select list id var list_select_id = 'list-select'; //second select list id var initial_target_html = '<option value="">-select-</option>'; //initial prompt target select $('#'+list_target_id).html(initial_target_html); //give target select prompt option $('#'+list_select_id).change(function(e) { //grab chosen value on first select list change var selectvalue = $(this).val(); //display 'loading' status in target select list $('#'+list_target_id).html('<option value="">loading...</option>'); if (selectvalue == "") { //display initial prompt in tar...

Alternate to class objects in python -

i have code like class abc: def __init__(self): self.a = 0 self.b = 0 self.c = 0 i making array of objects of class below: objs = np.array([ abc() x in range(10)]) is there data structure similar classes can hold values a,b,c in class abc. make array of data structure done above in objs object. kindly if guide. if you're using python 3.3+, can use types.simplenamespace : >>> import types >>> types.simplenamespace(a=0, b=0, c=0) namespace(a=0, b=0, c=0) >>> obj = types.simplenamespace(a=0, b=0, c=0) >>> obj.a 0 >>> obj.b 0 >>> obj.c 0 in lower version, use collections.namedtuple make custom type. >>> collections import namedtuple >>> >>> abc = namedtuple('abc', 'a b c') >>> abc(a=0, b=0, c=0) abc(a=0, b=0, c=0) but not allow attribute setting unlike types.simplenamespace : >>> obj = abc(a=0, b=0, c=0) >...

c - Why does my switch statement print a case and default? -

#include <stdio.h> int main(void) { char ch; int end=0; printf("\npick letter through f. (f ends program)"); { scanf("%c", &ch); switch (ch) { case 'a': printf("a. another: "); break; case 'b': printf("b. another: "); break; case 'c': printf("c: "); break; case 'd': printf("d. another: "); break; case 'e': printf("e. another: "); break; case 'f': printf("f. goodbye. "); end=1; break; default: printf("that wasn't through f. "); break; } } while (end == 0); return 0; } so if enter say: a. another: wasn't through f. if enter g say: that wasn't through f. wasn't through f. if enter f expected f. goodbye. and pr...

c# - Localhost Redirected you too many times DotNetNuke -

i have dotnetnuke application trying setup on localhost. the application working fine until tried change database connection. after reverting changes made in conenctionstrings, getting error whenever try run it. error the localhost page isn’t working localhost redirected many times. try clearing cookies. err_too_many_redirects well, obiously tried clearing cookies , tried on multiple browsers getting same result. page not working. what can possible reason ? without seeing source code best answer can give this, in code if forcing redirect iteself, forces redirect itself, etc. it same doing this, void dosomething() { // infinite loop, activate! dosomething(); } if provide source code or link in question give more detailed solution, question stands best can do.

MySql insert trigger outputs NULL -

i want have insert trigger achieve incremental inserts. have 1 column "row_hash" record md5 of each row(here use md5 of column name , category ). if new record has same hash value, trigger should skip insert, otherwise allows insert. drop trigger if exists test_trigger; delimiter $$ create trigger test_trigger before insert on test_table each row begin if (select count(*) test_table row_hash = md5(concat_ws('', new.name, new.category))) < 1 insert test_table(_id, name, category, row_hash) values (new._id, new.name, new.category, md5(concat_ws('', new.name, new.category))); end if; end$$ here test table: create table test_table(_id varchar(10) primary key, name varchar(10), category varchar(2), row_hash char(32)); when insert 1 record, outputs null on row_hash column. insert test_table(_id, name, category) values('12344', 'dafas', 'a'); '12344','dafas','a',null can tell me did...

java - How to make a JList with JLabel / JButton pairs for list items? -

Image
i want make jlist in java list of jlabel , jbutton . in each row of list, there label , button. if click button, corresponding text of label displayed of joptionpane . what want best described following image: how can this?

javascript - Select, Preview, Remove multiple images before uploading -

i don't know jquery , javascript know possible it. can preview , remove selected image before click on submit button upload (example: facebook on status upload images). want when user selects single or multiple images when clicked on <input type="file" name="images[]" multiple="multiple"> want preview images 'x' button on top right corner of images on clicked closes preview , removes actual image selected list prevent uploading. heard need take array of selected images remove them selected list said not in jquery , javascript. i have code below gives preview of selected images , removes preview when clicked on 'x'. removing preview , not actual image list. i want remove actual image list main problem facing. code till now: $(document).ready(function(){ $("#file-5").on('change',function() { var filelist = this.files; for(var = 0; < filelist.length; i++){ var t = window.url ||...

hadoop - Err :"The type Reducer Context.Value Iterator is not visible" in override run() method in reducer -

i wanted add header in reducer class.so overrided run method in reducer , added header described below . but getting error: "cannot perform instanceof check against parameterized type reducecontext.valueiterator. use form reducecontext.valueiterator instead since further generic type information erased @ runtime type reducecontext.valueiterator not visible." any appreciated.thanks in advance. @ override public void run(context context) throws ioexception, interruptedexception { setup(context); column = new text("college") ; values = new text("firstname" + "\t" + "lastname") ; context.write(column, values); try { while (context.nextkey()) { reduce(context.getcurrentkey(), context.getvalues(), context); // if store used, reset iterator<intwritable> iter = context.getvalues().iterator(); if(iter instanceof reducecontext.va...

python - Most succinct/low-hassle trick for identity comparison with None? -

this question frivolous consider quality-of-life/python trivia issue. i find myself writing x not none often. there clever semantically equivalent way of writing more succinctly? or example of "only 1 way" maxim in action? pep 20, the zen of python there should one--and preferably one--obvious way it. if knows magic, great. and if have tried , failed figure out, let counted. no, there no more succinct way make comparison using is operator.

css - hover over photo wont add transparent div -

i'm trying add transparent text overlay on top of image. i've decided using css add transparent div easiest, can't figure out why code isn't working. changed opacity of image when hovering on , set div containing text visibility:hidden . used hover effect make visibility:visible . can't work though. please help. here's fiddle: https://jsfiddle.net/3lx1pyl9/ here's html: <div id="chickcontainer"> <img src="http://animal-dream.com/data_images/chicken/chicken7.jpg"><div class="overlay">chicks</div> <img class="chicks" src="https://smittenkitchendotcom.files.wordpress.com/2016/09/piri-piri-chicken.jpg?w=750"> <img class="chicks" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcrzrjv4ilzyh0eqyvg9-oidaw1t24xa_vmvrx4qy-woymigpcx6"> </div> and css: #chickcontainer img{ position:relative; width:30...

Python 3 Comparison String from Kaggle Dataset CSV-data: Error 'string index out of range python' -

i´m doing project university in need evaluate dataset kaggle: enter image description here my problem pretty simple, couldn´t figure out researching: how can make comparision if salary higher or lower 50k in python? problem in line of 'if-clause'. shows me error: indexerror: string index out of range thank helping me out! import csv open('c:/users/jkhjkh/google drive/big data/adult.csv') csvfile: readcsv = csv.reader(csvfile, delimiter=',') y = 0 z = 0 ages = [] maritalstatuss = [] races = [] sexes = [] hoursperweeks = [] incomes = [] row in readcsv: # 4th row extracts age = row[0] # '54' maritalstatus = row[5] # 'divorced' race = row[8] # 'white' sex = row[9] # 'female' hoursperweek = row[12] # '40' income = row[14] # '<=50k' ages.append(age) maritalstatuss.append(maritalstatus) races.append(race) sexes...

tfs - Moving from TFSVC to GIT - Repository with partial History? -

we move tfsvc git. our current repository more 5 years old , contains ~78000 commits. far able have complete clone huge (~10gb). repository kept base our new git repo , read copy research on old source. because of size, clean repo bfg , down ~1gb still way large. use release branches , need move new system dev trunk , last couple of release branches. older branches , commits can looked in 10gb repository. is possible cut off commits (aka history) of new repository date stamp? want keep last 6 months of commits , latest release branches. basically comes down question: how housekeep git repo after years when grown? lets every years want keep last year. how achieve this? i tried shallow clone not keep branches. as mentioned in " is possible shallow git clone based on datetime? ", possible git 2.11 ( which released soon: 22 nov. 2016 , , there previews already ) git clone --shallow-since=<date> (see git clone man page , , its test . feature impleme...

java - Printing output on textfield -

can me? question how can print output inside textfield? system.out.print("enter sentence"); word = input.nextline(); word= word.touppercase(); string[] t = word.split(" "); (string e : t) if(e.startswith("a")){ jframe f= new jframe ("output"); jlabel lbl = new jlabel (e); f.add(lbl); f.setsize(300,200); f.setvisible(true); f.setdefaultcloseoperation(jframe.exit_on_close); f.setlocationrelativeto(null); the code posted make crazy things: creating , showing new frame every time find string starting "a". should create frame just once , example can prepare output before creating frame concatenating desidered elements of 't' array. create frame adding jtextfield desired text. might prefer have output printed in different lines textarea. if use textarea can use append method (look example below). remember setvisible(true) should last instruction wh...