Posts

Showing posts from July, 2015

Multithreading and NSNotification in iOS -

i wrote few functions in appdelegate.m this: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { debugmethod(); self.weibostatusesdatabasecontext = [self createmainqueuemanagedobjectcontext]; return yes; } - (void)setweibostatusesdatabasecontext:(nsmanagedobjectcontext *)weibostatusesdatabasecontext { debugmethod(); _weibostatusesdatabasecontext = weibostatusesdatabasecontext; nsdictionary *userinfo = self.weibostatusesdatabasecontext ? @{weibostatusesdatabaseavailabilitycontext : self.weibostatusesdatabasecontext} : nil; [[nsnotificationcenter defaultcenter] postnotificationname:weibostatusesdatabaseavailabilitynotification object:self userinfo:userinfo]; } and wrote function in mainpagecdtvc.m coredata tableviewcontroller : - (void)awakefromnib { debugmethod(); [[nsnotificationce

Not all Paths return a value : C# -

forgive me if basics, have following function private reportoption getreportoptions(int id, datarow dr) { string reporttype = getvalue(dr, "report type"); if (reporttype == "single") { getsinglereportoptions(id, dr); } else { getmultiplereportoptions(id, dr); } } now both functions getsinglereportoptions , getmultiplereportoptions returning value of type reportoption . still gives me error not code paths return value can tell me why? how should structure function or make change in 2 helper functions? the method getreportoptions doesn't return results of either getsinglereportoptions or getmultiplereportoptions . calls methods , ignores return values. preface both method calls return method return results of methods.

javascript - jQuery .val change doesn't change input value -

i have html input link in value. <input type = 'text' value = 'http://www.link.com' id = 'link' /> i using jquery change value on event. $('#link').val('new value'); the above code changes value of text box doesn't change value in code (value = 'http://www.link.com' stays unchanged). need value = '' change well. use attr instead. $('#link').attr('value', 'new value'); demo

.net - Scalable actions with async/await -

Image
i'm quite new programming , i'm working on first self-project, it's forum i'm creating asp.net mvc 5 , i'm trying learn it. read lot here , in msdn async actions in mvc have several questions couldn't figure out. as understood, iis assigns x threads each process, 2 example. , every thread can deal 1 request. when mark action async , wrap return type task, thread assign worker handle request , report iis free handle request. if thread can create 3 workers, action can serve 6 requests. right? as understood, async method must await async method in order async, if not, method run synchronically. question is, when thread assign worker? when request comes or when awaited method being called? again understood, every async method being assigned worker, if website has 6 workers spare (from above question), amount of workers can handle requests decrease use more , more async methods? example, if have async action calls asynchronically getuser , inside getuser c

php - How to validate if user inserts http:// anywhere in form, display a error message? -

in form user can add urls of social sites. cannot add url http:// or https:// . if user adds http:// or https:// in form submit; form had not submitted , redirect error page. but want if user add http:// or https:// in form submit, display error message , not redirect on error page. here form process. (mysql deprecated transfer later) if(isset($_post['update_ac'])){ $web = mysql_real_escape_string($_post['web']); $fb = mysql_real_escape_string($_post['fb']); $tw = mysql_real_escape_string($_post['tw']); $gg = mysql_real_escape_string($_post['gg']); $fk = mysql_real_escape_string($_post['fk']); $rn = mysql_real_escape_string($_post['rn']); $yt = mysql_real_escape_string($_post['yt']); $ig = mysql_real_escape_string($_post['ig']); $it = mysql_real_escape_string($_post['it']); $ms = mysql_real_escape_string($_post['ms']); $pt = mysql_real_escape_string($_post['pt']); $sc = mysq

javascript - How can you check if an input (email) field contains a special character using JQuery -

currently, i'm using following code doesn't seem work. throw error if user fails enter "@" symbol in input field. please bear me. thanks my following code is: var emailaddressval = $("input[name='emailaddress']").val().split('@').slice(1)[0].trim(); if(emailaddressval .match(/@/) !== null) { alert('an @ symbol not entered'); } looks you're doing lot more work need to. split() call searches bad character, stop there , see if string split or not. that's not clear way of expressing intent. if you're looking specific character, don't need regex. why not if ( $("input[name='emailaddress']").val().indexof('@') > -1 ) { /* found '@' character; handle */ } else { /* not found, handle appropriate */ alert("missing required '@' character"); } indexof returns non-negative value if finds string. see https://developer.mozilla.org/e

jsp - Spring form:select issue -

i wrote simple code in jsp using form:select <form:select id="a" path="validpath"> <form:option value="x"/> <form:option value="y"/> </form:select> here showing whole box , showing these 2 items. not looking drop down box. showing options in single huge box. make more clear showing option without selecting something x y ... i not sure how can fix issue? i think should work. can refer link more information : spring mvc dropdown box example make sure have added library <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

excel - Array/Collection not inserting values into cbo on custom userform -

i have read article doug glancy creating flexible chooser form. utilizing code , previous worked code trying dynamically read list of strings, insert them collection , pass collection values chosen in custom combo box. although, not show in combo box when have correct spreadsheet open. below code wrote. doug glancy's article: http://yoursumbuddy.com/a-flexible-vba-chooser-form/ this code used in module: '========================================================================================================================== 'filename: modvulnerabilityreport 'description: module contain functions analyze list of vulnerabilities outputted vulnerability ' remediation asset manager (vram) systems @ site. utilizing built-in worksheet functions, output ' calculation of number of vulnerabilities per category displayed in message box. 'concept taken from: doug glancy 'originally written by: doug glancy, zack barresse 'modif

java - Android Spinner GetSelection -

i work android project. small code //spinadapter custom class spinadapter fromadapter = new spinadapter(getactivity(), 0, new arraylist<cities>()); // private spinner mfrom; mfrom.setadapter(fromadapter); asynchttpclient.get(url, null, new httpresponsehandler() { @override public void onoperationsuccess(string response) { type listoftestobject = new typetoken<arraylist<cities>>() { }.gettype(); arraylist<cities> list = new gson().fromjson(response, listoftestobject); fromadapter.addall(list); cities selectionid=mfrom.getselection() } @override public void onfailure(string message) { } }); var selectionid null ? why? can me? for spinner need use getselecteditem(), not getselection() you can string getselecteditem().tostring()

Jquery Replace Select Options -

this question has answer here: how change options of <select> jquery? 6 answers i looking replace current select options set of option without using loop. have block of code: <select> <option>o1</option> <option>o1</option> </select> i have variable: $newoptions = "<option>newo1</option> <option>newo1</option>"; and want swap inside of select state new options. no loop needed. <select> $newoptions </select> is there way using jquery? $('selectoptions[name='+fldname+']').replacewith(newoptions); thank you. try way: <select id='needselect'> <option>o1</option> <option>o1</option> </select> $newoptions = "<option>newo1</option> <option&g

c# - How to compare these two strings representing a file name -

i want compare 2 strings represent file name: private void button2_click(object sender, eventargs e) { string search = textbox1.text; string[] files = directory.getfiles(@"c:\cache", "*.*", searchoption.alldirectories); int flag = 0; string dir = @"c:\cache"; string[] files1; int numfiles; files1 = directory.getfiles(dir); numfiles = files.length; messagebox.show("files searched : " + numfiles); console.writeline("files searched : " + numfiles + "<br>"); foreach (string name in files1) { if (textbox1.text.substring(23,30) == files1.tostring()) // << line { messagebox.show(name); } } } i have question how that, comparing using line: if (textbox1.text.substring(23,30) == files1.tostring()) where textbox1 = "http://localhost:11806/ourwork.html" files1 = "d:\m.tech\dissertation 2\cache\ourwork.html"

python - Enabling cookies with urllib -

i parse website urllib python library. wrote import urllib web source_rep.urlopen(url_rep).read() print source_rep the website returns me message saying should enable cookie. how can python? by using cookiejar , of course! and urllib2 . import cookielib import urllib2 cookiejar= cookielib.lwpcookiejar() opener= urllib2.build_opener( urllib2.httpcookieprocessor(cookiejar) ) opener.urlopen(...) as aside: in experience, site want parse telling enable cookies indicator going unpleasant experience, , you'll asking how enable javascript in urllib2 next (which not answerable, way). if think you'll benefit higher-level approach, should evaluate mechanize , selenium .

Securing Facebook Login through Javascript and PHP SDK -

what i'm trying achieve javascript checks if user logged in or not, if so, send code (either access_token or signedrequest) php securely deal logging in. php take code javascript , using app_secret, make sure code given javascript valid. using php sdk make graph api calls appsecret_proof can turn on "require proof on calls" in fb app. where i've got to 1) have javascript initialises when page loads, , assuming particular user logged in , authenticated in case, have access $helper = new facebookjavascriptloginhelper(); class, can session , make calls in php, pass in access token directly using $session = new facebooksession('access token here'); - great! 2) i've got snippet of php check signedrequest property of js response checks against app_secret - great! $signed_request = $_post['signedrequest']; list($encoded_sig, $payload) = explode('.', $signed_request, 2); $secret = "mysecret"; // use app secret here /

Java: embeddable Object-Oriented-Database -

i looking simple-to-use embeddable open-source object-oriented database java desktop application. i working on small portable java app embedded database. thinking of using sqlite or h2 jpa. not 100% sure data scheme not change on time , working objects might save trouble using odbms right away. maven repository , gui appreciated. take at: http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html as gui can use: http://www.dbvis.com/

python - Using show() with twill spams the console with HTML -

i've been using fuction twill.commands.show() raw html page. run every 5 seconds. every time function ran, spams console mentioned webpages raw html. need use console debugging, , since console filled html constantly, doing impossible. since show() programmed print html , return string, have edit twill, way beyond skillset, , makes program incompatible on other devices. although saving , reading file on , on might work, seems impractical every 5 seconds. code: go('http://google.com/') html=show() again, twill has save_html , used save file, i'm doing every 5 seconds , slow program/computer, if it's being run on older os. thanks! twill writes stdout default. you can use twill.set_output(fp) redirecting standard output. there're several possible implementations doing this: write stringio : from stringio import stringio sio = stringio() twill.set_output(sio) html = show() # html+'\n' == sio.getvalue() or /dev/null : impor

python - Ajax, Rest, Flask, SQLAlchemy, JSON : create data -

i have problem when want add new data in file json , in sqlalchemy database. my form add new data : <form id="form" name="formquestions" style="text-align:center;" method="post"> <p> <h3>title </h3> <input type="text" id="title" required> </p> <p> <h3>answer 1 </h3> <input type="text" required> </p> <p> <h3>answer 2 </h3> <input type="text" required> </p> <p> <input id="buttonquestion" class="btn-success btn" type="submit" value=" create question " /> </p> </form> my request ajax : $(function() { $('#form').submit(function(event){ event.preventdefault(); var title = $('#title').val(); var answer1=$('#firstalternative&

Running Javascript in Android WebView - onPageFinished Loop -

i having bit of trouble getting application correctly run js on page using onpagefinished method. the code below contained within class i've created extends asynctask fetch , parse json file held elsewhere. i able fetch json file correctly, parse data , url webview obtained , set. works loads should until attempt run js onpagefinished method. //onpostexecute method runs when doinbackground method completed @suppresslint("setjavascriptenabled") @override protected void onpostexecute(boolean aboolean) { super.onpostexecute(aboolean); //casting webview findviewbyid doesnt explicity return value type. webview = (webview) findviewbyid(r.id.webview); //obtaining websettings of webview websettings webviewsettings = webview.getsettings(); //setting javascript enabled webviewsettings.setjavascriptenabled(true); webview.setwebviewclient(new webviewclient(){ @override

javascript - jQuery Spinner does not show up before the upcoming function finished loading -

i created 2 functions should show , hide spinner ( ios spinner ): var overlay; function startspin() { var opts = { lines: 13, // number of lines draw length: 11, // length of each line width: 5, // line thickness radius: 17, // radius of inner circle corners: 1, // corner roundness (0..1) rotate: 0, // rotation offset color: '#fff', // #rgb or #rrggbb speed: 1, // rounds per second trail: 60, // afterglow percentage shadow: false, // whether render shadow hwaccel: false, // whether use hardware acceleration classname: 'spinner', // css class assign spinner zindex: 2e9, // z-index (defaults 2000000000) top: 'auto', // top position relative parent in px left: 'auto' // left position relative parent

How to merge/compare several tables by complex terms in R -

i tried compare 2 tables 2 terms. code in r: cbr <- c("usd", "eur", "sek", "rur") value <- c(2, 4, 5, 9) data <- data.frame(cur = cbr, rate = value) deals1 <- c("usd", "usd", "usd", "eur", "sek", "eur", "rur", "sek") deals2 <- c("rur", "rur", "eur", "rur", "rur", "usd", "usd", "rur") day <- 1:8 dealsn <- data.frame(day = day, cur_1 = deals1, cur_2 = deals2) (i in 1:nrow(dealsn)) { (j in 1:nrow(data)) { if (dealsn$cur_1[i] == data$cur[j] & dealsn$cur_2[i] == "rur") { dealsn$data[i] <- data$rate[data$cur[j]] } else if (dealsn$cur_1[i] == data$cur[j] & dealsn$cur_2[i] != "rur") { dealsn$data[i] <- data$rate[data$cur[dealsn$cur_2[i]]] /data$rate[data$cur[j]] }

Import a django app view in another app view -

i have 2 django apps , i've called view of app1 in app2, this: #app: app1 #someview.py def a_view(request, someparam): #some code here #app: app2 #otherview.py app1.someview import a_view def another_view(request): param = 1 a_view(request, param) def view2(request): #some code it works fine. problem want call view app2 in app1. add import statement in someview.py this: #app: app1 #someview.py app2.otherview import view2 def a_view(request, someparam): #some code here the result importerror "cannot import name view2". can tell me why happen? the second import shadowing first 1 ... try import app2.otherview or from app2.views app2_views

excel - Make a cell scroll/marquee text right to left? -

i have cell m2 in excel contains large amount of text. trying figure out way of making text scroll right left continuously. i have done lot of looking on web can find codes don't make sense me , want try , make simple possible. please show me simple way of getting want. sub startmarquee() dim smarquee string dim iposition integer smarquee = "this scrolling marquee" me .tbmarquee .text = "" iposition = 1 len(smarquee) .text = .text & mid(smarquee, iposition, 1) application.wait timeserial(hour(now()), minute(now()), second(now()) + 1) next iposition end end 'beep 'application.ontime + timeserial(hour(now()), minute(now()), second(now()) + 2), "startmarquee" end sub while done inside of loop in subroutine, entire application going locked while loop executing, make extremely unhelpful. instead think of 1 run of subroutine single iteration. when sub runs want detect in message marquee @ in cell m13, , push message 1 more

php - Update picture/image in Codeigniter -

i'm trying create update image user want change photo.the when click submit on photo upload, there no photo uploaded , photo's column still no update. here contorller: function foto($id='') { $data['data'] = $this->user_model->get_foto($id); $data['form_action'] = site_url("user/update_foto/$id"); $this->load->view('user/foto_form', $data); } function update_foto($id=''){ $this->user_model->update_foto($id); } here model: function get_foto($id=0){ $id = $this->session->userdata('id'); $sql = "select id,foto user id= '$id'"; $query = $this->db->query($sql); $data = $query->row_array(); return $data; } function update_foto(){ $config['upload_path'] = './upload/'; $config['allowed_types'] = 'jpg|png|jpeg';

machine learning - Interpret the output of neural network in matlab -

i have build neural network model, 3 classes. understand best output classification process boolean 1 class , boolean zeros other classes , example best classification result class, output of classifire lead on how data belong class first element in vector [1 , 0 , 0]. output of testing data not that,instead rational numbers [2.4 ,-1 , .6] ,so how interpret result? how decide class testing data belong? have tried take absolute value , turn maximum element 1 , other zeros, correct? learner. it appears neural network bad designed. regardless structure -number of input-hidden-output- layers, when doing multiple classification problem, must ensure each of output neurones evaluating individual class, is, each them has bounded output, in case, between 0 , 1. use of defined function on output layer performing this. nevertheles, neural network work properly, must remember, every single neuron loop -from input output- operates classificator , is, define region on input

java - Could not find or load main class testABCD -

i have create 1 java application , import selenium server standalone jar class name abc in side calss 1 testing program open firefox browser, athor task... also have run configuration , run give error main class not fount import java.util.regex.pattern; import java.util.concurrent.timeunit; import org.junit.*; import static org.junit.assert.*; import static org.hamcrest.corematchers.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.support.ui.select; public class abc { private webdriver driver; private string baseurl; private boolean acceptnextalert = true; private stringbuffer verificationerrors = new stringbuffer(); @before public void setup() throws exception { driver = new firefoxdriver(); baseurl = "https://www.google.co.in/"; driver.manage().timeouts().implicitlywait(30, timeunit.seconds); } @test public void testabcd() throws exception { driver.get(baseurl + "a

Android QCMediaPlayer not present -

i have small problem. logcat gives me error "e/mediaplayer-jni﹕ qcmediaplayer mediaplayer not present" searched , found out looks device doesn't support qcmediaplayer. else can play audio files? also how can ceck if qcmediaplayer supported? thanks mine got solved using static create method of mediaplayer: mediaplayer player= mediaplayer.create(cntx, uri.parse(this.path)); for resource files: mediaplayer player = mediaplayer.create(cntx, sound_resource_id, loop);

python - Inserting data in to matplotlib subplot Figures -

i've got csv of data , trying plot of data on same row in style: fig = plt.figure() ax1 = fig.add_subplot(1,3,1) ax2 = fig.add_subplot(1,3,2) ax3 = fig.add_subplot(1,3,3) how insert below data plotting sequentially on top of each other in created figures above? mru.plot(x='time', y='r1', color='black') plt.ylabel('roll', fontsize=18) plt.xlabel('') plt.title('mru primary roll') mru.plot(x='time', y='p1', color='black') plt.ylabel('pitch', fontsize=18) plt.xlabel('') plt.title('mru primary pitch') mru.plot(x='time', y='t1', color='black') plt.ylabel('tilt', fontsize=18) plt.xlabel('') plt.title('mru primary tilt') you can specify on ax should plotted ax keyword argument in plot . example: mru.plot(x='time', y='r1', color='black', ax=ax1) note have use axes object rest of formatting of figure

sequelize.js - Sequelize, Many-To-Many On Non-ID Properties -

i have 1 model, target , has property/field called targetname . have second model, operation , field verb . both these models have primarykey field named id . i have third model, policy , defined association/join additional properties; policy contains targetname , verb fields. how specify in belongstomany() target , operation use fields above, instead of defaulting id field? know of through option specify actual model. what's in ellipsis section below? target.belongstomany(operation, {through: policy, ...}); , operation.belongstomany(target, {through: policy, ...}); also, specify 2 belongstomany() ? there no way foreign keys pointing non-primary keys in sequelize. see https://github.com/sequelize/sequelize/issues/2967

java - How to solve compile errors in custom JpaRepositoryFactory after upgrade from Spring Data JPA 1.4 to 1.8? -

basically situation when want upgrade 1.8.0.release 1.4.5.release. i've noticed far this: lockmoderepositorypostprocessor has become crudmethodmetadatapostprocessor lockmetadataprovider has become crudmethodmetadata now, have custom jpa repository factories , extend jparepositoryfactory this: class customjparepositoryfactory extends jparepositoryfactory { protected <t, id extends serializable> jparepository<?, ?> gettargetrepository{ simplejparepository<?, ?> repo; // custom code lockmoderepositorypostprocessor lockmodepostprocessor = lockmoderepositorypostprocessor.instance; repo.setlockmetadataprovider(lockmodepostprocessor.getlockmetadataprovider()); } } this possible because lockmoderepositorypostprocessor enum public. now, new crudmethodmetadatapostprocessor package protected , same trick not work. realized can this: super.gettargetrepository(metadata); and in back-end happen: repository.setrepositorymethodm

javascript - Backbone ID attribute is different than the parameter I need for the API -

i'm using backbone collections , models api. id attribute default id attribute mongo (_id) in api, use different unique key single model. slug unique. the problem when want save(), put request instead of post because assumes there model key (slug) because user able enter slug himself (with proper validations of course). is there way can 'say': "ok, idattribute _id want use slug when fetching data? well, got working doing following: var page = new pagemodel({_id: param}); // no idea why works tbh page.fetch(); have no idea why works since model _id not equal param i'm giving somehow finds correct model anyway.

c++ - Analyze concurency::task() API & why do we need this? -

i'm, trying understand syntax of concurrency::task in below code snippet. i'm unable understand code snippet syntax. how analyze this: what "getfileoperation" here. object of type storagefile class ? "then" keyword mean here ? there "{" after then(....)? i'm unable analyze syntax ? also why need concurrency::task().then().. use case ? concurrency::task<windows::storage::storagefile^> getfileoperation(installfolder->getfileasync("images\\test.png")); getfileoperation.then([](windows::storage::storagefile^ file) { if (file != nullptr) { taken msdn concurrency::task api void mainpage::defaultlaunch() { auto installfolder = windows::applicationmodel::package::current->installedlocation; concurrency::task<windows::storage::storagefile^> getfileoperation(installfolder->getfileasync("images\\test.png")); getfileoperation.then([](windows::storage::storagef

python - Link MKL to an installed Numpy in Anaconda? -

>>> numpy.__config__.show() atlas_threads_info: not available blas_opt_info: libraries = ['f77blas', 'cblas', 'atlas'] library_dirs = ['/home/admin/anaconda/lib'] define_macros = [('atlas_info', '"\\"3.8.4\\""')] language = c atlas_blas_threads_info: not available openblas_info: not available lapack_opt_info: libraries = ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs = ['/home/admin/anaconda/lib'] define_macros = [('atlas_info', '"\\"3.8.4\\""')] language = f77 openblas_lapack_info: not available atlas_info: libraries = ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs = ['/home/admin/anaconda/lib'] define_macros = [('atlas_info', '"\\"3.8.4\\""')] language = f77 lapack_mkl_info: not availab

xml - Transparent dialog in android -

i using checkboxes , displayed on dialogbox(dynamically).the next thing need make dialog box transparent.i tried many methods,but failed(wasted entire day behind this).can please give me solution nb:currently getting white colour inside dialog box(not transparent) below code..... transparent_alert.java public class transparent_alert extends activity{ string tag="transparent_alert class"; static final string key_userid = "userid"; string errormsg = "", user_id; sessionmanager session; int k=0; intrested_in_adapter m_adapter; private builder mdialog; private dialog alertdialog; list<requestencapsulation> offferlist; list<offeringencapsulation> offerlist; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); hashmap<string, string> user = session.getuserdetails(); user_id = user.get(sessionmanager.key_id); setcontentview(r.la

delphi - How to use TFramedScrollBox correctly with Touchscrolling, if there are Buttons inside? -

i have derived tframedscrollbox implement in component class constructs me on given dimension (x , y) buttons onto framedscrollbox. works fine. touchscrolling on object works fine, if property touch.pan set true . can scroll on buttons , "touching" or "tapping" buttons click event happens right after touch. derived component, component, used on application, because need be. the problem(s) the given app running in fullscreen mode on win 8 systems necessary our business. in above explained situation not possible tap buttons fast after others, because click events don't rises. , logic behind not necessary. 1 problem... if switch form none fullscreenmode touch on different buttons rises click event immediatly wished. have discovered if above mentioned property pan set false, on fullsceenmode every touch click rises event scrollbox don't scrolls touch gesture... now comes question in title... ps. if wished can send simple sample...

ruby - How can I test logger-messages with MiniTest? -

i have application , want test if correct messages logger. a short example (you may switch between log4r , logger): gem 'minitest' require 'minitest/autorun' require 'log4r' #~ require 'logger' class testlog < minitest::test def setup if defined? log4r @log = log4r::logger.new('log') @log.outputters << log4r::stdoutoutputter.new('stdout', :level => log4r::info) else @log = logger.new(stdout) @log.level = logger::info end end def test_silent assert_silent{ @log.debug("hello world") } assert_output(nil,nil){ @log.debug("hello world") } end def test_output #~ refute_silent{ @log.info("hello") }#-> nomethoderror: undefined method `refute_silent' assert_output("info log: hello world\n",''){ @log.info("hello world") } end end but get: 1) failure: testlog#test_output [minitest_log4r

javascript - Adding a function to the scope of an Angular custom directive -

i have following angular directive. // component panel app.directive('component', function () { return { restrict: 'ae', scope: { heading: '@heading', componenttype: '@componenttype' getcomponenturl: function() { var componentpath = "./shell/partials/components/" + componenttype + ".html"; return componentpath; } }, template: '\ <div id="panel" class="panel panel-primary panel-component fill scrollable">\ <div class="panel-heading">\ <div class="row">\ <div class="col-sm-6">\ <h2 class="panel-title">{{heading}}</h2>\ </div>\ <div class="col-sm-6">\ <button type="button" class="btn btn-default pull-right btn-expa

java - I want to insert a special character of SQL in JDBC -

i want translate access sql query java jdbc select * books lcase(title) lcase('*jdbc*') , lcase(title) lcase('*programming*') i use preparedstatement this string sql1="select * books lcase(title) lcase(%?%) , lcase(title) lcase(%?%)"; preparedstatement ps1=con.preparestatement(sql1); ps1.setstring(1, "jdbc"); ps1.setstring(2, "programming"); resultset rs1=ps1.executequery(); but syntax error if want insert % value used lcase , have 2 choices: add % s in code, or use concatenation in query. the first approach this: string sql1="select * books lcase(title) lcase(?) , lcase(title) lcase(?)"; preparedstatement ps1=con.preparestatement(sql1); ps1.setstring(1, "%jdbc%"); ps1.setstring(2, "%programming%"); the second approach this: string sql1="select * books lcase(title) lcase('%' & ? & '%') , lcase(title) lcase('%' & ? & '%')&quo