Posts

Error inserting data from textbox to sql database in c# -

when try insert value textbox database, values not being updated in database. newly inserted rows temporarily available, after inserting when use select query rows, new rows available. when close solution , open again, newly insert rows gone. table in database explorer not updated. here code. string connectionstring = @"data source=.\sqlexpress;attachdbfilename=|datadirectory|\database1.mdf;integrated security=true;user instance=true"; string na = textbox1.text; int ag = int.parse(textbox2.text); string ci = textbox3.text; using (sqlconnection connection = new sqlconnection(connectionstring)) { using (sqlcommand insertcommand = connection.createcommand()) { insertcommand.commandtext = "insert address(name,age,city) values (@na,@ag,@ci)"; insertcommand.parameters.addwithvalue("@na", na); ...

java - Convert byte [] to ArrayList<Object> -

i have byte [] obtained using object arraylist can tell me how convert byte [] object arraylist? coveting arraylist this bytearrayoutputstream bos = new bytearrayoutputstream(); objectoutputstream oos = null; oos = new objectoutputstream(bos); oos.writeobject(marraylist);//marraylist array convert byte[] buff = bos.tobytearray(); thank you! now you've given information how did conversion 1 way... need: objectinputstream ois = new objectinputstream(new bytearrayinputstream(bytes)); try { @suppresswarnings("unchecked") arraylist<object> list = (arraylist<object>) ois.readobject(); ... } { ois.close(); }

ios - Any way to apply 'webkit-overflow-scrolling: touch' inline with javascript? -

have not been able property show in dom via jquery or native javascript. jquery doesn't seem support , can't find native name/syntax works. help?? with javascript, need replace dash - following capital letter, example: var el = document.getelementbyid('element id'); el.style.webkitoverflowscrolling = 'touch';

sql - Get non duplicates of column x but duplicates of column y -

i have table (call table mytable). it has data this: number / name 1 jake 2 chris 3 sally 4 billy 1 tom 5 cathy (i realize poor setup, didn't luxury of doing setup) i need query table results returned with: 1 jake 2 chris 3 sally 4 billy 5 cathy or 2 chris 3 sally 4 billy 1 tom 5 cathy it not matter name gets returned duplicated number... 1 gets returned. here not-working attempt: with ( select number mytable ), b ( select number, name mytable ) select a."number", b."name" left join b on a."number" = b."number" use group by ensure each number returned once, , use aggregate function pick 1 of values name : select number, max(name) name yourtable group number

java ee - If I use a facade class with generic methods to access the JPA API, how should I provide additional processing for specific types? -

let's i'm making simple web application using java ee specs (i've heard possible). in app, have 10 domain/data objects, , these represented jpa entities. architecturally, consider jpa api perform role of dao. of course, don't want use entitymanager directly in ui (jsf) , need manage transactions, delegate these tasks so-called service layer. more specifically, able handle these tasks in single dataservice class (often called crudservice) generic methods. see article adam bien example interface: http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao my project differs article in can't use ejbs, service classes named beans , handle transactions manually. regardless, want single interface simple crud operations on data objects because having different class each data type lead lot of duplicate and/or unnecessary code. ideally, views able use method such public <t> list<t> findall(class<t> type) { ... } to retrieve data....

oop - Inheritance vs class instance in python module import -

apologies if doesn't make sense, i'm not of experienced programmer. consider following code: import mymodule class myclass: def __init__(self): self.classinstance = mymodule.classinstance() and ...... from mymodule import classinstance class myclass(classinstance): def __init__(self): pass if wanted use 1 classinstance in myclass, ok import specific class module , have myclass inherit class ? are there best practices, or things should thinking when deciding between these 2 methods ? many thanks allow me propose different example. imagine have class vector. want class point. point can defined vector maybe has other functionalities vector doesn't have. in case derive point vector. now need line class. line not specialisation of of above classes don't want derive of them. line uses points. in case might want start line class way: class line(object): def __init__(self): self.point1 = point() ...

android - How to send push messages to multiple users using C2DM? -

so far have succeeded send messages 1 device using registration id , authtoken signed c2dm role account. have send messages multiple users . dont know how achieve this. could overcome issue. java servlet code, public void doget(httpservletrequest req, httpservletresponse resp) throws ioexception { resp.setcontenttype("text/plain"); stringbuilder data = new stringbuilder(); data.append("registration_id=" + serverconfig.deviceregistrationid_s); // collapse key grouping messages , last sent message // same key going sent phone when phone // ready message if not beginning data.append("&collapse_key=test"); // here message sending, key1 can changed whant // or if whant send more 1 can (i think, not tested // yet), testing message here. data.append("&data.key1=testing message c2dm"); // if want message wait phone not idle se...