Posts

sql - Query Help required for newbie -

sql - Query Help required for newbie - i have created 3 tables. tblregion{regionid integer, regionname varchar(100)}, tblcountries{countryid integer, countryname varchar(100), regionid varchar(3)}, tblusrs{userid integer, username varchar(100), prefregion varchar(3), prefcountries varchar(100)} now info in each table: tblregion --------- regionid regionname: 1 asia -- 2 africa -- 3 europe -- 4 america tblcountries ------------- countryid countryname regionid: 1 china 1 -- 2 malaysia 1 -- 3 singapore 1 -- 4 afganistan 3 -- 5 uk 3 -- 6 kingdom of spain 3 -- 7 libiya 2 -- 8 kingdom of morocco 2 -- 9 4 -- 10 canada 4 -- 11 united mexican states 4 tblusrs ------- usrid usrname prefregion prefcountries: 1 mike 2 -1 -- 2 john -1 '1,5,9' -- 3 michael -1, '1' -- 4 tango -1 '8,9' from above info if user passes part 2, both userid 1 & 4 displayed. i have written query seems thing wrong. select * tblusers (prefregion = '2...

swing - Java GUI JButton to actionlistner -

swing - Java GUI JButton to actionlistner - i have made gui in netbeans. it's chat programme , have 4 commandos /join, /leave, /whisper , /leave private void commandoactionperformed(java.awt.event.actionevent evt) { joptionpane.showmessagedialog(rootpane, "the next commandos are:" + "\n" + "\n" + "/join channel name" + "\n" + "/leave channel name" + "\n" + "/whisper nick message" + "\n" + "/quit - quit program"); } and ok, want actionlister instead of showmessagedialog can force on of them , comes in jtextfield. think can them there don't know how actionlistener combined this. edit: want force commando button , windows have 4 new buttons, each 1 commando (/join, /leave, /whisper , /exit) when force 1 of these buttons commando in text field need write rest. if force "/join" button, need w...

Simplest way to Import a shared python script relative to the current script -

Simplest way to Import a shared python script relative to the current script - i trying import 1 python script another. have few mutual functions defined in 1 script , lots of other scripts want import functions. no classes, functions. the importing script needs import relative path e.g. ../../sharedscripts/python/common.py i have few functions def f1(...) defined call. i found imp module seemed right thing utilize unable figure out exact syntax work example. can suggest right code utilize or simplest approach if imp not right module? solution answers below able working... projectkey = 'thor' # load shared script relative script sys.path.append(os.path.dirname(__file__) + '/../../sharedscripts/python') import jira jira.checkjiracommitmessage(sys.argv[1], sys.argv[2], projectkey) where had empty __init__.py , jira.py in sharedscripts/python directory plain function definitions. why not adding ../../sharedscripts/python/ python pa...

Using html with style tags in php code -

Using html with style tags in php code - i have been given next template utilize in email. using phpmailer mail service out, having problem way style tags begin , end conflicting php. if go through thier template, move styles seporate style sheet or utilize classes , set styles @ top of page, dont want unless have to. below generic illustration of going wrong code. font names wrapped in "s opening , closing tags of style 's , these 's clashing opening , closing tags of php. cant seem find way round though if put, style=""font-name","another-font"" wont work, if utilize 's @ php screwed up. what happening in php mailer form contents declared $body = '<span style='font-size: 13.5pt;font-family:"georgia","serif";color:white'>some content</span></html>'; you need escape quotes. example: $body = '<div style=\'background:#000;\'><p>srs bu...

iphone - Crash when invoking popToRootViewControllerAnimated:NO, set animate to YES work no crash, strange. -

iphone - Crash when invoking popToRootViewControllerAnimated:NO, set animate to YES work no crash, strange. - my app based on uinavigationviewcontroller, there 3 viewcontroller in stack, named a, b, c, root view controller, in viewcontroller c next operation, app crash 100%. - (void) delaypopaction { [[self navigationcontroller] poptorootviewcontrolleranimated:no]; } - (void)searchtap:(id)sender{ [self performselector:@selector(delaypopaction) withobject:nil afterdelay:3.0]; } trace zombie , find crash dues c has been destroyed there still event available sent him. more strange, if alter animated parameter no yes, no crash happen, maybe dues c's life circle has been enlarged. see api doc. how no mean? don't understand clearly. animated set value yes animate transition. pass no if setting navigation controller before view displayed. any thought or suggestion appreciated, in advance. oh, view-controller implementation defect. iphone uinav...

hibernate - How we can Query object in hibernateTemplate -

hibernate - How we can Query object in hibernateTemplate - i want utilize query object in hibernatetemplate. can utilize query object hibernatetemplate deprecated spring. if 1 using other way please guide me thanks in advance dharmendra you can utilize either pure sql or can writing simplified queries like: session session = sessionfactory.getcurrentsession(); query query = session.createquery("from tablename id=:userid"); query.setstring("userid", userid); //userid of string type or can utilize userid+"" convert string list<myentitypojoname> result = query.list(); //this homecoming list of myentitypojoname objects or can write pure sql within createquery() function below: session session = sessionfactory.getcurrentsession(); query query = session.createquery("delete tablename myentitypojoname id=:userid , hid=:hospitalid"); query.setstring("userid",myuserid); query.setstring("hospitalid...

http - WCF Interoperability with other services, content type is text/html -

http - WCF Interoperability with other services, content type is text/html - i trying create wcf client operates http rest endpoint not based on microsoft technologies. wcf-foo pretty weak, don't understand doing incorrectly... i've created service contract looks this... [servicecontract] public interface ifilters { [operationcontract] [webget(uritemplate = "/api/filter.getavailable.xml?api_user={username}&api_key={password}")] string getavailablefilters(string username, string password); } which seek , run this... public string run(string username, string password) { var binding = new basichttpbinding(); binding.messageencoding = wsmessageencoding.text; binding.security.mode = basichttpsecuritymode.transport; var endpointaddress = new endpointaddress("https://sendgrid.com"); ifilters proxy = channelfactory<ifilters>.createchannel(binding, endpointaddress); var r...