Posts

java - How to add JCheckBox in JTable? -

Image
first of apologize english neglect explain problem. first want jcheckbox in jtable have. i retrieving student id , student name database in column index 0 , 1. want third column should absent/present take whether student present or absent jcheckbox value. here code jtable values : attendance.java /* * change template, choose tools | templates * , open template in editor. */ package shreesai; import java.sql.connection; import java.sql.preparedstatement; import java.sql.resultset; import java.util.vector; /** * * @author admin */ public class attendance{ connection con = connectdatabase.connecrdb(); public vector getemployee()throws exception { vector<vector<string>> employeevector = new vector<vector<string>>(); preparedstatement pre = con.preparestatement("select studentid,name student"); resultset rs = pre.executequery(); while(rs.next()) { vector<string> ...

Java file deletion fails -

i need delete files within java program , have written code. fails delete file , can't figure why. file not in use , not write protected. public static void delfile(string filetodel) { try { file file = new file("filetodel"); if (file.delete()) { system.out.println(file.getname() + " deleted!"); } else { system.out.println("delete operation failed." + filetodel); } } catch (exception e) { e.printstacktrace(); } } if want delete file, there no need loading it. java.nio.file.files.deleteifexists(filetodel); (where filetodel contains path file) returns true if file deleted, can put in if-clause.

mongodb - Database Scheme for unified profiles fetched from multiple Social Networks (Facebook and Linkedin...) -

the application i'm building allows users login using both facebook , linkedin accounts in order fetch friend these networks. each of friend can user of application. i have couple of problems solve: how should structure database schema? how unify profiles? potential solutions regarding structure: i'm using mongo (but open suggestions). though i'd create collection of users each user document looks this: user = { appid: <id>, connections: [userid] } so, each user has: a unique app generated id (could doc's id simplicity). an array of user's ids. ids of friend's profiles created in app. regarding unifying profiles: should unify users based on email or name? or both? misc i though use loginradius using singly that, , decided kill service. in other words, don't want depend on third party tool because core feature. var userschema = new schema({ name: { type: string, default: '' },...

bash - How to handle no matching files when using ${f%.gz} syntax -

i'm developing script process , move away compressed files dropped folder. the script works long gets dropped folder compressed file. however, if script executes when there no compressed files process bash function ${f%.gz} gives unexpected results. here script, example of problem case afterwards: files="$ingest_dir/*.gz" f in $files justfilename=${f##/*/} syslog -s -l n "archiving \"$justfilename\"" unzippedpath=${f%.gz} syslog -s -l n "moving \"$unzippedpath\"" unzippedname=${unzippedpath##/*/} syslog -s -l n " \"asr_dir/$unzippedname\"" syslog -s -l n "gunzip-ing $f" gunzip $f mv "$unzippedpath" "$asr_dir/$unzippedname" done again, works if there's @ least 1 .gz file in target directory. if there aren't .gz, there other files in directory (which must there other reasons) $files contains expanded $ingest_dir plus /*.gz,...

ios - How to block UIAppearance proxy for some control -

i set custom appearance of ui classes. [[uibarbuttonitem appearance] settintcolor:somecolor]; ... [[uinavigationbar appearance] setbackgroundimage:someimage forbarmetrics:uibarmetricsdefault]; so when create uibarbuttonitem's or uinavigationbar's objects in application have defined appearance. but if want object have standart appearance(not use defined proxy), need set it's properties default values manually. so quesion is: there way block using uiappearance object? thank you. edit: not 100% want use appearancewhencontainedin. [[uibarbuttonitem appearancewhencontainedin:[uinavigationbar class], nil] settintcolor:[uicolor redcolor]]; [[uibarbuttonitem appearancewhencontainedin:[uitoolbar class], nil] settintcolor:[uicolor yellowcolor]]; this way can control behavior degree. setting properties nil use default appearance: [self.navigationcontroller.navigationbar settintcolor:nil];

sql server - Project relational data to XML column - is it possible? -

i have 2 tables of following structure: people id | lastname | firstname | other columns... the second table has xml column: id | myxmlcol | other columns... myxmlcol stores following xml: <mydata> <block> <person id="1" /> ...other nodes </block> ...other blocks </mydata> the id attribute points id column of people table. what need, query myxmlcol , returns: <mydata> <block> <person id="1" lastname="jones" firstname="bob" /> ...other nodes </block> ...other blocks </mydata> is possible make such projection? i'm using sql server 2012. if there can 1 element "person" in single element "block", should suit: update t set myxmlcol.modify(' insert ( attribute lastname {sql:column("p.lastname")}, attribute firstname {sql:column("p.firstname")} ) (/mydata/bl...

how to set color to tab in android? -

i trying below code not work properly public static void settabcolor(tabhost tabhost) { for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) { tabhost.gettabwidget().getchildat(i).setbackgroundcolor(color.parsecolor("#ff0000")); //unselected } tabhost.gettabwidget().getchildat(tabhost.getcurrenttab()).setbackgroundcolor(color.parsecolor("#0000ff")); // selected } i want change default color of tab. thank in advance tabhost tabhost = gettabhost(); for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) { relativelayout tv = (relativelayout ) tabhost.gettabwidget().getchildat(i).findviewbyid(android.r.id.title); tv.setbackgroungcolor(.....); } just use this...hopes works