Posts

Showing posts from July, 2013

ruby on rails - argument error/wrong number of arguments - I have no idea what's going on here, -

i'm trying use paperclip , update listing whenever on form receive error. argumenterror in listingscontroller#update wrong number of arguments (2 1) code follows , line highlighted being @ fault begins if @listing.update(listing_params) @listing = listing.new respond_to |format| if @listing.update(listing_params) format.html { redirect_to @listing, notice: 'listing updated.' } format.json { head :no_content } else this application trace app/controllers/listings_controller.rb:45:in `block in update' app/controllers/listings_controller.rb:44:in `update' is there i'm missing, syntax-wise, or else? many thanks. edit: the code listings model (listings.rb) follows class listing < activerecord::base has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "default.jpg" end my form (_form.html.erb) follows: <%= f

loops - Vigenere Cipher in C: Incomplete Encryption -

a general explanation of vigenere cipher: the vigenere cipher method of encryption similar caesar cipher. cipher takes in word argument , interprets alphabets of word follows- 0, b 1, c 2 , on. so if input key abc , want "hi hello" encrypted, output entail h remaining same, shifting 1 place, h shifting 2 places, e again remaining same (as being shifted 0), l shifting 1 place, other l 2 , on forth. the basic idea each letter shifts corresponding letter in argument , spaces , other punctuation marks ignored. if argument shorter message (as in cases), argument loops around message. my problem: my message being encrypted first alphabet of vignere cipher. for example, ./vc bc ----> message: abcde abcde becomes bcdef bcdef . in other words, entire message being shifted value of b when should instead shifted value of bc (+1 first alphabet , +2 every other alphabet.) i don't understand why happening despite being within loop. code: # include <cs5

java - Input given in JSF page does not set that value to manged bean variable -

am newbie jsf. using jsf 2 , primeface 4.0 in application. stated in title, input value given in xhtml page, not set value managedbean. have tried possible combination. appreciated. growlmessage.xhtml <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <h:head> </h:head> <h:body> <h:form> <p:growl id="growl" showdetail="true" sticky="true" /> <p:panel id="panelid" header="growl"> <h:panelgrid columns="2" cellpadding="5"> <h:outputlabel for="msg" value="message:" /> <p:inputtext id="msg" value="#{growlview.message}" required="true" /> </h:panelgrid> <p:commandbutton value="save" actionlistener=&

Python Pandas Cleaning columns with multiple dates -

i have dataframe column looking this: event date 1/3/2013 11/01/2011-10/01/2012 11/01/2011-10/01/2012 11/01/2011-10/01/2012 10/01/2012 - 02/18/2013 2/12/2013 01/18/2013-01/23/2013 11/01/2012-01/19/2013 is there way separate dates 2 columns like df['start date'] df['end date'] where rows single dates start date default. you can use series.str.extract() here in 1 fell swoop: in [22]: df out[22]: event_date 0 1/3/2013 1 11/01/2011-10/01/2012 2 11/01/2011-10/01/2012 3 11/01/2011-10/01/2012 4 10/01/2012 - 02/18/2013 5 2/12/2013 6 01/18/2013-01/23/2013 7 11/01/2012-01/19/2013 in [23]: df.event_date.str.extract(r'(?p<all>(?p<start>\d{1,2}/\d{1,2}/\d{4})\s*-?\s*(?p<end>\d{1,2}/\d{1,2}/\d{4})?)') out[23]: start end 0 1/3/2013 1/3/2013 nan 1 11/01/2011-10/01/2012 11/01/2011 10/01/2012 2 11/01/2011

jsf - hide panel with commandbutton -

i using jsf , trying show hidden panel tried <h:commandbutton update=":outpanel" actionlistener="#{selectbean.mod1()}" image="ressources/images/update.png" style="vertical-align:middle" > modifier </h:commandbutton> <p:panel visible="#{selectbean.bol}" closable="true" toggleable="true" id="outpanel" styleclass="outpanel" widgetvar="outpanel"> <h:outputlabel value="nom " /> <h:inputtext value="#{selectbean.nom}" /> <br/> <h:outputlabel value="experience " /> <h:inputtext value="#{selectbean.exp}" /> <br/> <h:commandbutton value="modifier"/> </p:panel> my bean private boolean bol=false; public bool

javascript - Hosting multiple Node.JS applications recognizing subdomains with a proxy server -

i trying redirect subdomains specific port on ubuntu aws ec2 virtual server. tried dns , wouldn't work based on following topics, default route using node-http-proxy? , how use node.js http-proxy logging http traffic in computer? , trying create node.js proxy server logging. said mixed bit (i'm new node.js, still learning) , made following script: var httpproxy = require('http-proxy'); var port = 80; logger = function() { return function (request, response, next) { // run on each request. console.log(json.stringify(request.headers, true, 2)); next(); } } var options = { // list processed top bottom, '.*' go // 'http://localhost:3000' if host header hasn't matched router : { 'dev.domain.com': 'http://localhost:8080', 'beta.domain.com': 'http://localhost:8080', 'status.domain.com': 'http://localhost:9000', 'health.domain.com': 'http://localhost:

How to get store category url in Magento 1.8? -

how can store category url ? i know can store direct url this, <a href="{{store direct_url="contacts"}}">contact us</a> but store's categories? the categories have in store, such 'wines', 'food', etc, if this, {{store direct_url="wines"}} // returns http://mystore/wine i 404 error page. because url should this, http://mystore/wine.html any idea? try category link widget: {{widget type="catalog/category_widget_link" anchor_text="displayed text" title="title attribute text" template="catalog/category/widget/link/link_block.phtml" id_path="category/22"}} reference magento how link category id static block/page

multithreading - Using Multiple Threads in Java -

i've been trying understand how multi-threading work ran below code: /* * change template, choose tools | templates * , open template in editor. */ package mainbowl; import java.util.logging.level; import java.util.logging.logger; /** * * @author kbluue */ public class threadstudy { thread t, t1, t2; runnable r, r1, r2; public threadstudy() { init(); } public void start(){ } private void init(){ t = new thread(r); t.setname("thread"); t1 = new thread(r1); t1.setname("thread 1"); t2 = new thread(r2); t2.setname("thread 2"); r = new runnable() { @override public void run() { // throw new unsupportedoperationexception("not supported yet."); if (t != null){ printstart(t); try { thread.currentthread().wait(); } catch (exception e){ printerror(t); }

jquery ui - Two bar graphs in the same place, controlled by one slider D3.js -

i attempting create bar graph when independent sliders moved change 2 bar graph svg heights @ same time , stacked, different colors show shows 2 separate values in same graph, showing growth vs current. using jquery-ui , d3.js. moves 1 svg elements instead of both @ same time, id them both move @ same time. html <div id="slider" class="slider"> <label for="amount">age</label> <input type="text" id="amount1" style="border:0; font-weight:bold;"> </div> <div id="slider1" class="slider"> <label for="amount2">retirement age</label> <input type="text" id="amount2" style="border:0; font-weight:bold;"> </div> js //initialize sliders jquery(document).ready(function($) { $("#slider").slider({ max: 100 }); $("#slider").slider({ min: 18 }); $("#slider1").slider

Can't get Google Analytics user data to show in Rails app -

i'm attempting server-to-server connection between google analytics account , rails app. this, i'm using legato, omniauth-google-oauth2, , google-api-client gems. intention have rake task sieves out pageview data particular site. however, can't seem user data out of it. here's code: require 'google/api_client' def service_account_user(scope="https://www.googleapis.com/auth/analytics.readonly") client = google::apiclient.new( :application_name => "listmaker", :application_version => "2.0" ) key = openssl::pkey::rsa.new(figaro.env.google_private_key, "notasecret") service_account = google::apiclient::jwtasserter.new(figaro.env.google_app_email_address, scope, key) client.authorization = service_account.authorize oauth_client = oauth2::client.new("", "", { :authorize_url => 'https://accounts.google.com/o/oauth2/auth', :token_url => 'htt

Scale image on dragging using famo.us -

i new famo.us, trying scale image on dragging.my code working fine 1 drag after not working. how can make work fro every drag? settransform make scale operation fixed? define(function(require, exports, module) { var engine = require("famous/core/engine"); var surface = require("famous/core/surface"); var statemodifier = require("famous/modifiers/statemodifier"); var draggable = require("famous/modifiers/draggable"); var transform = require("famous/core/transform"); var imagesurface = require('famous/surfaces/imagesurface'); var maincontext = engine.createcontext(); var size_x = 200; var size_y = 200; var scale_x =1; var scale_y =1; var surface = new imagesurface({ size: [size_x, size_y], content: 'img/1.jpg', properties: { backgroundcolor: 'rgba(200, 200, 200, 0.5)', cursor: 'pointer' } }); var draggable = new draggable({ xr

node.js - Showing error "nvmw command not found" when setting the path of nvmw in Nodejs -

i new in nodejs. want install nvmw in system. first clone respiratory using command git clone git://github.com/hakobera/nvmw.git "%homedrive%%homepath%\.nvmw" after activating nvmw, used command set "path=%homedrive%%homepath%\.nvmw;%path%" in e drive.folder created in e drive in name of %homedrive%%homepath% , inside folder datas , nvmw folder created. but after when running command nvmw help , shows "nvmw command not found". tried changing folder name shows same error. think doing mistake in setting path. in case, command not working on windows powershell. command setting system path should run windows command prompt. in other hands, can add installed path gui. for windows powershell, see following question: setting windows powershell path variable

javascript - D3 stacked cylinder chart to full height -

Image
as per title, i'm trying figure out best way create stacked cylinder scales proportionally height. below illustration of i'm trying achieve: as can see there 3 different sections - no matter figures should fill proportionally height, in case ~234px. what best way achieve this? dataset array of objects. tia :) as far know, d3 doesn't have ways of rendering objects in 3d -- i'd @ three.js webgl if you're looking lot of 3d graphs. but, don't need d3. making cylinder turns out simple matrix3d css transforms (see http://jsfiddle.net/l2dsr0v0/1/ ), , after need little bit of js make multiple cylinders , make scaling work. transform: matrix3d(1, 0, 0, 0, 0, 0.52, -0.85, 0, 0, 0.85, 0.52, 0, 0, 0, 0, 1); if want review linear algebra transforms, http://9elements.com/html5demos/matrix3d/ place start.

c# - Passing An Bbject To A Class By Refrence -

shotmanager = new shotmanager(shottexture, graphics.graphicsdevice.viewport.bounds, ref spaceship, enemyship); im passing spaceship parameters object class "shotmanager", problem parameters of spaceship fixed , doesnt change, though when im changing example "position" of ship! here constructor of shotmanager: public shotmanager(texture2d shottexture, rectangle movementbounds, ref shipclass spaceship, enemymanager enemyship) { // todo: complete member initialization this.shottexture = shottexture; this.movementbounds = movementbounds; this.spaceship = spaceship; this.enemyship = enemyship; } here used object "spaceship" { fireshot( spaceship.position, spaceshipshotvelocity); } i keep changing position, apparently object not sent refrence, in other words initial values of spaceship sent. im beginner programmer please dont banish me.

android - Having Fragment and List fragment in 1 adapter -

good afternoon guys,i need tip experienced people, here have fragment adapter : public class mypageradapter extends fragmentstatepageradapter { private final string[] titles = { "categories", "home", "top paid" }; public mypageradapter(fragmentmanager fm) { super(fm); } @override public charsequence getpagetitle(int position) { return titles[position]; } @override public int getcount() { return titles.length; } @override public fragment getitem(int index) { switch (index) { case 0: // top rated fragment activity return new topratedfragment(); case 1: // games fragment activity return new gamesfragment(); case 2: // movies fragment activity return new noteactivity(); } return null; } i have 3 fragments @ getitem() see, , constructor fragment type, need 1

javascript - Ascending/Descending filter Strings on ng-grid -

trying out ascending , descending type of sorting in angular js strings here plunker select box has 2 options ascending , descending when ascending chosen grid should output values importance in order l-m-h stands low-medium-high , descending h-m-l i have asked these questions sorry can't concepts right sorting , filtering in angular js update i had implemented part of have sorted contents in same order stack question here have used drop down selection. , same drop down has 2 more options of ascending , descending trying find out answers. i don't know of non-hackish way of using external select such show in plunker. as sorting itself, can create , use custom sorting function: var prioritysort = function(a, b){ var priority = { l: 1, m: 2, h: 3 }; if(priority[a] > priority[b]) return 1; if(priority[a] < priority[b]) return -1; return 0; }; $scope.gridoptions = { data: 'mydata', enablesorting: true,

css - AJAX Horizontal scrolling the page -

i have build site france24.com, there navigation on left , 2 arrows on sides scrolling sides. when click on arrows or 1 of navigation items , related page (preloads) , appears without refreshing page. how that? there usable framework or sample this? regards after looking @ website, see trying do. see way this, through simple jquery method load() ( http://api.jquery.com/load/ ). behaves get(), on clicking arrow, event triggered can load piece of html code in place of 1 user looking at. if need dynamic content load instead of simple static html code, it's possible achieve filling in dynamic part html code want load before loading it. library can use achieve react js, developed fb. luck!

jquery - open a csv file and turn values into javascript array -

this question has answer here: javascript code parse csv data [duplicate] 8 answers how can open .csv file , turn values javascript array. in classical programming i'd by: opening file string splitting , close file i know how split, .split(',') , how open , close csv file in javascript or jquery? $.get(url,function(data) { var mainarray = data.split('\n'); for(var i=0;i<mainarray.length;i++) { mainarray[i] = mainarray[i].split(','); // mainarray 2 dimensional array contains csv file //mainarray[row index][column index] } } );

java - SimpleXML throws XmlPullParserException, unterminated entity ref for no reason -

i ran out of ideas on problem be.. i'm using simplexml on android, , threw following stacktrace: 06-08 13:20:56.450: e/androidruntime(2281): fatal exception: main 06-08 13:20:56.450: e/androidruntime(2281): java.lang.runtimeexception: org.xmlpull.v1.xmlpullparserexception: unterminated entity ref (position:text ????t???????????????...@21:133 in java.io.bufferedreader@b6438630) 06-08 13:20:56.450: e/androidruntime(2281): @ com.example.stuff.manager.levelmanager.<init>(levelmanager.java:32) 06-08 13:20:56.450: e/androidruntime(2281): @ com.example.stuff.fragment.mainmenufragment.onclick(mainmenufragment.java:138) 06-08 13:20:56.450: e/androidruntime(2281): @ android.view.view.performclick(view.java:2485) 06-08 13:20:56.450: e/androidruntime(2281): @ android.view.view$performclick.run(view.java:9080) 06-08 13:20:56.450: e/androidruntime(2281): @ android.os.handler.handlecallback(handler.java:587) 06-08 13:20:56.450: e/androidruntime(2281): @ androi

java - error in quiz game using swings -

i having problem in quiz game. using netbeans. in game have 2 classes 1st driver class ie quiz , second non driver class ie radioquestion. posting code both classes. having 2 errors in radioquetion class. my error message in quiz.java "cannot find symbol class: radioquestion location: class quiz.quiz" , in radioquestion "total not public in quiz.quiz; cannot accessed outside package" , "wrong not public in quiz.quiz; cannot accessed outside package" , 1 warning "implements: java.awt.event.actionlisteneractionperformed(actionevent e)". quiz.quiz class package quiz; import java.awt.cardlayout; import java.util.random; import javax.swing.jframe; import javax.swing.joptionpane; import javax.swing.jpanel; public class quiz extends jframe{ jpanel p=new jpanel(); cardlayout cards=new cardlayout(); int numqs; int wrongs=0; int total=0; //radioquestion[8] questions=new radioquestion(); string[][] answers={

c# - Post JSON HttpContent to ASP.NET Web API -

i have asp.net web api hosted , can access http requests fine, need pass couple of parameters postasync request so: var param = newtonsoft.json.jsonconvert.serializeobject(new { id=_id, code = _code }); httpcontent contentpost = new stringcontent(param, encoding.utf8, "application/json"); var response = client.postasync(string.format("api/inventory/getinventorybylocationidandcode"), contentpost).result; this call returning 404 not found result. the server side api action looks so: [httppost] public list<iteminlocationmodel> getinventorybylocationidandcode(int id, string code) { ... } and confirm route on web api looks this: config.routes.maphttproute( name: "defaultapiwithaction", routetemplate: "api/{controller}/{action}/{id}", defaults: new { id = routeparameter.optional } ); i assume i'm passing json httpcontent across incorrectly, why returning status 404? the reason yo

Cloning object based on content in PHP -

i seem going round in circles here have situation when reading objects may come across contain array. when happens wish produce new objects based upon array example sourceobject(namespace\classname) protected '_var1' => array('value1', 'value2') protected '_var2' => string 'variable 2' should become childobject1(namespace\classname) protected '_var1' => string 'value1' protected '_var2' => string 'variable2' childobject2(namespace\classname) protected '_var1' => string 'value2' protected '_var2' => string 'variable2' however due not quite getting head around clones end same content (sometimes both value1 value2 ) you create method following one: trait classsplitclone { public function splitclone($name) { if (!is_array($this->$name)) { return [$this]; } $objs = [];

imageshack - Retrieving yfrog images -

ever since yfrog stopped being yfrog , started changing imgshack or whatever name is, of pictures on account linked twitter don't show up. show blank picture of camera, this: http://twitter.yfrog.com/h0tjfqlpj my dog passed away , know have more pictures of on there ones still available. there way can retrieve them, no way @ or should email yfrog? apparently happened lot of people. best suggestion email is-support@imageshack.net (per this page ) , see if can retrieve images. luck, , many sympathies on loss.

qt - QML Form layout (GridLayout) troubles -

Image
i trying convert app ui c++ qml. @ step need login window created in qml code below: window { id: loginwindow property string username: login.text; property string password: password.text; property bool issave: savepassword.checked; flags: qt.dialog modality: qt.windowmodal width: 400 height: 160 minimumheight: 160 minimumwidth: 400 title: "login program" gridlayout { columns: 2 anchors.fill: parent anchors.margins: 10 rowspacing: 10 columnspacing: 10 label { text: "login" } textfield { id: login text: config.getparam("user") layout.fillwidth: true } label { text: "password" } textfield { id: password text: config.getparam("password") echomode: textinput.password layout.fillwi

Rename menu item in Android -

i rename menu on click of item. tried following didn't change. i tried item.settitle("landscape"); or item.settitle("portrait"); declare menu: @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.main, menu); return true; } do on click on menu item: @override public boolean onoptionsitemselected(menuitem item) { boolean result = true; switch(item.getitemid()) { case r.id.oscillation_mode: { if(getscreenorientation() == 1) { log.e("orientation","abc"+getscreenorientation()); item.settitle("landscape"); setrequestedorientation(activityinfo.screen_orientation_landscape); } else { item.settitle("portrait"); setrequestedorientation(activityinfo.screen_orientation_portrait); }

javascript - HTML5 required attribute not working in Ember.js -

i creating login form ember.js application, , take advantage of 'required' attribute on inputs easy client-side validation. however, seems validation not work when add ember action submit button. for example: <form class="form" role="form"> <div class="form-group"> <label class="sr-only" for="exampleinputemail2">email address</label> <input type="email" class="form-control" id="email" placeholder="email address" required> </div> <div class="form-group"> <label class="sr-only" for="exampleinputpassword2">password</label> <input type="password" class="form-control" id="password" placeholder="password" required> </div> <div class="checkbox"> <label> <input type="checkbox&

javascript - How to implement load previous items like infinite ajax scroll history example -

currently i'm trying use infinite ajax scroll function posts. here want make link load previous items implemented on infinite ajax scroll history example here: http://infiniteajaxscroll.com/examples/history/page3.html (see load more items above content.) my code: javascript: <script type="text/javascript"> var ias = jquery.ias({ container: '#posts', item: '.post', pagination: '#pagination', next: '.next' }); ias.extension(new iasspinnerextension({src: 'ajax-loader.gif'})); ias.extension(new iastriggerextension({offset: 2})); ias.extension(new iaspagingextension()); ias.extension(new iashistoryextension({prev: '.prev a'})); </script> html markup <div id="posts"> <div class="post">...</div> <div class="post">...</div> </div> <div id="pagination"> &l

database - Sqlite giving column more size than needed -

i have data putting in database. make field "coupondetail text(10000)" store coupon detail, consider not coupondetail 10,000 chars long. m curious know how space column take in database when coupondetail text lesser 10,000 1000 chars? sqlite not care how declare column types , ignores maximum length specified. the declared type hint ; non- integer primary key column can contain type. the size taken in database file depends on values put in. in record format , strings stored length followed string data. no empty space left there.

What's the difference between override and hidden in java? -

i searched lot. difference between them override instance method , hidden static method. , hidden in fact redefinition of method. still don't it.if redefinition means static method of parent still exists in subclass, can't see it? or why call hidden not other words? if exists, can't find way call method again. honest function level can't find why different. can 1 explain deeper level such memory? static members(methods , variables) not present in sub class(child class) object inherit them they'll present single copy in memory. static members can accessed class name of both super class , sub class not physically present in object of these classes. where when inherit non-static members, sub class object in memory contain both inherited methods methods of own. when try write similar method here, super class method overridden. on other hand static methods not participate in inheritance, similar method write present in super class, new method run every-t

php - Including View Composers in Laravel using Composer -

i have made below composer view app. i've placed in separate file @ app/composers.php . <?php // namespace app\modules\manager\composer; // use illuminate\support\facades\view view ; /* |-------------------------------------------------------------------------- | composers |-------------------------------------------------------------------------- | | */ view::composer('tshop.includes.header', function($view) { $categories = categories::getwithchilds(); $view->withcategories( $categories); }); my composer.php file "autoload": { "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/tests/testcase.php" ], "files": [ "app/composers.php" ] }, unfortunately error fatal error: class 'view' not found in c:

python - Top Down RPG in Pygame -

if have created tilemap , want these things please tell me how them? tell program dissect tilemap different portions i.e 50 * 50(pixels) let me have set of values in .txt file correspond values of individual tiles easy mapping. get python transfer tiles displayed window of set size letting in enough tiles fill window in set order according values of tiles on map this; 1|2|3|4 5|6|7|8 9|10|11|12 and type them .txt file this; 111111111111112222222221111111111 111111111111122222222222222211111 111111133333333333333111111111111 444444441111111111111144444444411 to show corresponding tiles in window.

javascript - Trigger touchmove event drag and drop -

hi need trigger touchmove event manually , pull element out of countainer on mobile device (phonegap, jquery-mobile) $(elem).bind('touchstart', function(event) { event.preventdefault(); var target = event.target; target = $(this); //this example changes css position target.css("margin-top", "50px"); }); elem.trigger('touchstart'); is there way setup event manually , trigger object event that? var event = $.event( "touchstart", { pagex:200, pagey:200 } ); i using this drag , drop, author mentioned there no way interact js , recommended: - call drag , drop listeners , give them event objects create or - trigger simulated pointer events interact sees them drag user. any idea? can't declare function outside bind() , call directly? $(elem).bind('touchstart', handler); function handler(event) { event.preventdefault(); va

compilation - Scala (SBT) compile error: separate output paths (production, tests) -

i have same compile error on intellij , eclipse scala: "error:scalac: output path c:\workspaces\scalaprogfun\forcomp\bin shared between: module 'progfun-forcomp' production, module 'progfun-forcomp' tests please configure separate output paths proceed compilation. tip: can use project artifacts combine compiled classes if needed." can me this, please? have no idea how sbt works! this error happens on project: http://spark-public.s3.amazonaws.com/progfun/assignments/forcomp.zip in intellijidea can try use file -> project structure -> modules -> project -> paths specify different paths test , output (if have more 1 module - can try specify unique paths every module)

c# - Sending unescaped JSON data to WCF via POST -

i have restfull wcf service, working fine when send escaped json data through post method. arises error bad request when send unescaped json. can tell me solution. interface code using in wcf. [servicecontract] public interface iservice1 { [operationcontract] [webinvoke(method = "post", uritemplate = "loginclouduser", responseformat = webmessageformat.json, requestformat = webmessageformat.json)] dnnloginresponse loginclouduser(string args); [operationcontract] usercredential getdatausingdatacontract(usercredential composite); // todo: add service operations here } update: using json.net serialize json. have tried removing codes , return arguments string. still gets error if json not escaped. public dnnloginresponse loginclouduser(string args) { try { jsonserializersettings jss = new jsonserializersettings(); jss.stringescapehandling = stringescapehandling.default; d

java - How to insert a value with single apostrophe in DB2 -

my requirement insert value contains apostrophe,(e.g st.mary's), db2 using java query. my table has column name datatype char(26) purpose , cannot changed. i've handled apostrophe using db2 survival guide , way: string cityname = beanclass.getcity(); if(cityname.contains("'")) { cityname.replace("'","''"); } prepstmt.setstring(1, cityname); query looks like: insert tablename(cityname) values(?); (where values being received preparedstatement(index,string) (prepstmt.setstring(int,string)) please me insert value "st.mary's" apostrophe db2. thanks loads, varsha. the escape character single quote double single quote. example, insert st.mary's need do insert table values ('st.mary''s') however, plain sql. depends how call java. if column parameter marker in prepared statement, not need that. also, if pass parameter other component