Posts

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException | JAVA -

i want number of entries in table in java project. this code: int count = 0; statement st = mysql.con.createstatement(); resultset rs= st.executequery("select count(*) keys spieler =" +p.getname()); while (rs.next()){ count = rs.getint(1); } i getting following sqlexception : com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'keys spieler =pit910' @ line 1 what worng? thanks! keys reserved mysql keyword needs escaped (either or alter table give different name). try this preparedstatement preparedstatement = con.preparestatement("select count(*) `keys` spieler = ?"); preparedstatement.setstring(1, p.getname()); resultset rs= preparedstatement.executequery(); ...

spring - Choose between muliple transaction managers at runtime -

i have 2 clients using same spring based rest application deployed in tomcat. depending on client need choose between data sources , transaction manager. how choose @ runtime, transaction manager use? <bean id="first_datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="url" value="${first_jdbc.url}" /> <property name="driverclassname" value="${first_jdbc.driverclassname}" /> <property name="username" value="${first_jdbc.username}" /> <property name="password" value="${first_jdbc.password}" /> <property name="removeabandoned" value="true" /> <property name="initialsize" value="20" /> <property name="maxactive" value="30" /...

AngularJS showing intermediate page while saving -

while saving new invoice using angularjs app, there noticeable time taken while api checking products balances, saving data...etc wondering there way in angularjs can show intermediate (page...example: #/processing) users routed once user click save button depending on save new invoice $http result (failure or success) either route user invoice page (ex. #/new-invoice) or success saving page (#/thanks-for-ordering) ? any example highly appreciated. thanks you can use ng-if switch between input , saving state. example template: <div ng-if="issaving"><img src="spinner.gif"> saving...</div> <form ng-if="!issaving" ng-submit="savethething(thing)> <input ng-model="thing.title" type="text"/> ... </form> example controller: angular.module('app').controller('examplectrl', function ($scope, $location) { $scope.savethething = function(thing) { $scope.is...

objective c - iOS 7.1 NSString drawInRect -

i have code worked fine until built project ios 7.1. before, text correctly showed on pdf page. [strsometext drawinrect:rectfortext withattributes:[nsdictionary dictionarywithobjectsandkeys:font, nsfontattributename, mutparagraphstyle, nsparagraphstyleattributename, colorred, nsforegroundcolorattributename, nil]]; but now, in formatting dictionary being disregarded. pdf document shows black text of default font , size. thank responses. i try using nsattributedstring , find whether works. not have reason why code has stopped working, try this: // these variables examples, keep whatever variables using uifont *font = [uifont fontwithname:@"whatever_font" size:16.0f]; nsparagraphstyle *paragraphstyle = [nsparagraphstyle defaultparagraphstyle]; nsdictionary *attributes = @{nsfontattributename : font, nsparagraphstyleattributename : paragraphstyle, nsforegroundcolorattributename : [uicolor redcolor]}; nsattributedstring *attributedstring = [[nsattributed...

sql - MySQL select lowest timedate for each id -

i have table : create table if not exists `event_showtime` ( `id_show` int(11) not null auto_increment, `id_event` int(11) not null, `latitude` double not null, `longitude` double not null, `event_date_time` datetime not null, primary key (`id_show`), key `id_event` (`id_event`) ) values this, example : insert `event_showtime` (`id_show`, `id_event`, `latitude`, `longitude`, `event_date_time`) values (1, 1, 49.2016762922894, 18.7615620750428, '2014-03-31 16:13:17'), (2, 1, 49.2016762922894, 18.7615620750428, '2014-04-01 20:00:00'), (3, 2, 49.2113914818564, 18.7520992416382, '2014-03-31 15:00:00'), (4, 2, 49.0545135142313, 20.2952223676682, '2014-04-16 11:00:00'), (5, 2, 49.2113914818564, 18.7520992416382, '2014-04-23 11:00:00'), (6, 2, 49.0545135142313, 20.2952223676682, '2014-04-30 11:00:00'), (7, 2, 49.2016762922894, 18.7615620750428, '2014-04-29 12:00:00'), (8, 1, 49.2016762922894, 18.7615620750428, ...

viewport - How to change the view port in javafx? -

Image
i have created screen gui . now after program starts want show user firstbtn this: and after button clicked screen moves in direction of arrow in picture , goes secondbtn now how should move screen , change view port. you may use different scenes same stage. primaystage.setscene(yourscene1); and same when needed yourscene2 primaystage.setscene(yourscene2);

python - unit testing with mock for google apps api - Admin Directory API -

i followed tutorial here , can retrive emails domain application. now want write unit tests mock application, dont know start. i have read here unit testing mock , google api admin directory api comes own mock library. dont understand how use correctly. my application test_email_user.py contains import real application email_user.py what? i have fake google api directory responses real application, how? greetings, sam i'm not familiar google client api own mock library mention mock library : import mock class directoryhelper(): ... #real method calls api def get_users(self): user_list = [] request = self.service.users().list( customer=self.customer_id, maxresults=500, orderby='email', fields="nextpagetoken,users(id,orgunitpath,primaryemail,name(givenname,familyname),agreedtoterms,suspended)" ) while request: logging.debug('retrieving page of users directory...') rep...