Posts

Showing posts from June, 2011

gnuplot - Manage X label in GNU -

i have x-label range this: 2.0237*e^10 15.055*e^10. when draw graph x-label values overlap. how can manage without changing font size? use "set xtics" define larger distance between xlabel major tics. can use "set format x " define more suitable format x-axes: for example: draws xlabel tics @ 2*e^10, 4*e^10, 6*e^10... set xtics 2e10 this display label tics in more compact form: set format x "%1.0e" you might find helpful: http://heim.ifi.uio.no/inf3330/scripting/doc/gnuplot/kawano/tics-e.html#3.1

Java - generic types -

i trying create binary tree using generic typing , have error not understand. tried 2 ways of coding , second worked. not understand why first failing. i have following common code: public class mytreea <t extends comparable<t>> { class bt_node<t extends comparable<t>> { t value; bt_node<t> left; bt_node<t> right; bt_node(t node_value) { this.value = node_value ; left = null; right = null; } } the difference in insert procedure: works: private bt_node<t> insert(bt_node<t> node, bt_node<t> newnode) { if ((node.value).compareto(newnode.value) == 0) { . . . } but fails private bt_node insert(bt_node node, t value) { if (value.compareto(node.value) == 0) { . . with: mytreea.java:28:

Can I access the colours of the R console, from R code? -

i have 4 sessions of r, each running different piece of software, between must change often. helpful if colour of console background (or text) different depending on code loaded, automatically, locate window on (cluttered) desktop , avoid typing in wrong commands wrong console in fast moving financial activities. any way within r code? menuing , changing colours manually it's tedious, that, under windows, r colour dialogue box 4 lines deep , there 500 colours. this not direct answer question, might still helpful. using multiple workspaces solve problem. if have different r sessions running, having them on different workspaces (or desktops) separates them nicely. platforms work on (os x , linux) have native support workflow, there must tools windows (a few years there @ least).

PHP Geek needs Database Design Assistance -

like developers think striving create optimal code , database schemas. however - ive got feeling, im on engineering database schema want create. i have web app that, in short space of time, hold lot of users. users in form of customers, suppliers, system users. in industry grow rapidly. in previous schemas have users separated in different tables. however, thinking of going down route of having 1 table called: people. there these tables: people, contact details, residences they related via pivottables ie: pivotcontacts pivotresidences. my question considered good/bad design.? on thinking, on engineering simple setup. the table people grow exponentially , hold alot of data - , other tables relate it. i welcome opinions. will design scale 100 thousand records , maintain moderate speed.? * start 1000 records , grow approx 100,000 in 1 year. for users can log-in, , maybe traced (last login, failed password retries) optimal have small table , maybe separa

sml - Counting how many elements in a sorted list, that are larger than a given predicate -

i'm trying create function finds how many elements bigger first element divided 2 in given sorted list. example given list [3,3,4,5,6,7,8,9,11] , first element 3 , numbers larger divided 2 7,8,9,11 function returns 4 . i have done far doesn't work. a element first of list , given in order easier. fun findlarger [] = | findlarger [] = 0 | findlarger [x] = 0 | findlarger (x::xs) = let val = ref a; in if !a < x/2 length (xs) + 1 else findlarger (a, xs) end i don't know start pointing out issues code. seems have misunderstood basics of functional programming. first off should not using references (unless know doing, @ still wrong), should use recursion. you haven't declared function take same number of arguments. in first clause, have defined 2 curried arguments, in rest of clauses have 1 argument, , in second last line of code, calling function pair argument. your first function clause don't have body. &quo

java - getting exception when retrieving data from database org.hibernate.hql.ast.QuerySyntaxException: -

Image
iam new jpa, iam trying create ejb 3.0 + jpa (hibernate) application. when iam persisting data database getting below exception. sessionbean method: @persistencecontext private entitymanager em; public void showcustdetails(){ //system.out.println(em.getproperties()); //entitymanager em = emf.createentitymanager(); list customer = em.createquery("select c customer c").getresultlist(); system.out.println("list size:::"+ customer.size()); for(object c:customer){ customer customers = (customer) c; system.out.println("name ::::" + customers.getname() + "::customer id ::"+customers.getcustomer_id()+"::email::"+customers.getemail_id()+"::address::"+customers.getaddress()+ ":::ph number::"+customers.getphnumber()); } } customer class(entity class) package retail.model.vo; import java.io.serializable; import

c# - Getting specific value from specific key of Document inside document -

i have document this { "_id": { "$oid" : "51776bca40bcc60038000001" }, "username": "domi55", "password": "test", "character": { "job": "warrior", "level": 1, "skill": { "skillid": "1001", "skillname": "blade dance", "levelrequirment": 1 } } } } how "job" value , "skillname" value in c#? i'm using mongodb , mongodb c# driver using json.net dynamic obj = jsonconvert.deserializeobject(yourdoc); console.writeline("{0} {1}", obj.character.job, obj.character.skill.skillname); or using javascriptserializer var obj = new javascriptserializer().deserialize<dynamic>(json); console.writeline("{0} {1}",obj["character&qu

sql - COUNT ifnull mysql query -

i have 2 tables in database, fleets , personnel_onboard_fleets. trying list of of fleets (which works) , count how many personnel onboard each fleet (which doesn't). however, isn't showing results if there aren't personnel onboard. select f.*, count(pof.id) onboard fleets f, personnel_onboard_fleets pof f.fleet_id = pof.fleet_id order f.status i expecting 2 results, 1 fleet 2 people on board , 1 0 people onboard. 1 result. have tried use following select f.*, ifnull(count(pof.id), 0) onboard fleets f, personnel_onboard_fleets pof f.fleet_id = pof.fleet_id order f.status i cant see wrong query, there else needs added show fleets 0 persons onboard. my original query before count shows fleets fine, know count. this driving me crazy! appreciated!! try: select f.fleet_id, count(pof.id) onboard fleets f left join personnel_onboard_fleets pof on f.fleet_id = pof.fleet_id group f.fleet_id order f.status;

internet explorer - Run silverlight application with a specific past date -

i run silverlight application inside internet explorer browser date other current system time. required in order use functionality of silverlight application available using particular date in past. i cannot change actual system time triggers automatic system restart after 15 minutes. don’t have control on since pc within corporate network. i’m not attempting circumvent security measures. there legitimate reason , current approach of working within 15 minute timeslot before system restart unacceptable. so far i’ve tried runasdate utility nir sofer worked command line not ie browser. any appreciated. alternatives if there no such tool how 1 go writting it. how intercept call system api , override custom code ?

c# - How do I upload to dropbox using dropnet? -

i using dropnet. have problem upload file dropbox. sure connection dropbox in fine. when changed method of upload create file , delete file method works fine. can not see problem why not uploading? use same api dropnet. protected void btn_upload_click(object sender, eventargs e) { if (fileupload1.hasfile) { if (session["dropnetuserlogin"] != null) { try { _client.usesandbox = true; _client.uploadfile("/", fileupload1.filename, fileupload1.filebytes); } catch (exception ex) { litoutput.text = "error in upload user login in session " + ex.message; } } else { litoutput.text = "session expired..."; } } else { litoutput.text = "you did not spec

MVC 3 Razor treating string within javascript as html -

i have javascript function within cshtml file builds table, , adds div on page using jquery. i made couple of changes recently, , seems visual studio treating below html needs parsed. (error: unterminated string literal) footer = footer + "</td></tr></tfoot>"; i'm looking understand why happening - worked previously, , there other tags in function not show errors, below. var footer = "<tfoot><tr><td colspan='7'>"; i can around using code below instead, i'd rather find cause can fix properly. footer = footer + '@html.raw("</td></tr></tfoot>")';

How to use th SUM function to return the values from sqlite DB in android? -

in application, store amount details of company in sq lite db.for example om first position of db in name column-company 1,total column - 400,second position of db in name column-company 2,total column - 800,third position of db in name column-company 1,total column - 500.how sum company 1 details return total amount. my main coding is, string str = db.company_amount("company 1"); log.v("total", ""+str); my db coding is, string company_amount(string name){ sqlitedatabase db = this.getreadabledatabase(); string s = ""; cursor cursor = db.rawquery("select sum(key_amount) table_bill_details = ?", new string[] {string.valueof(name)}); if (cursor != null) { if (cursor.movetonext()) { s = cursor.getstring(1); return cursor.getstring(1); } cursor.close(); } return s; } it shows error,i don't know how return values.can 1 know please me solve problem. my logcat error 04-25 14:54:06.701: e/a

multithreading - Is Java socket multi-thread safe? -

if have multiple java threads writing same socket instance simultaneously, affect integrity of objects read same socket? i.e., whether contents of objects messed etc. it's fine ordering of objects random. in general, there no guarantees. bits of different objects end getting interleaved on wire, rendering result indecipherable. therefore, need provide external synchronization. it interesting note single socket write @ os level not atomic. further discussion, see is safe issue blocking write() calls on same tcp socket multiple threads? , be careful sendmsg() family of functions .

cannot use class QProcess in qt on windows 7 -

i used qprocess execute exe file in qt on windows xp. works normally, while not on windows 7. think it's because of uac issue on windows 7(or windows vista). can me solve problem please? in advance. , here's code: qprocess p(0); p.start("cmd", qstringlist()<<"/c"<<"copy .\\tmp\\gameskoreclient.exe .\\gameskoreclient.exe"); you start process correctly, receive results, have wait until process finished. add line after started process: p.waitforfinished(); and close precess afterwards: p.close()

execute as - The server principal "sa" is not able to access the database "model" under the current security context -

i created stored procedure performs series of operations require special permissions, e.g. create database, restore database, etc. create stored procedure with execute self ...so runs sa. because want give sql user without permissions ability run these commands have defined. but when run stored proc, get the server principal "sa" not able access database "model" under current security context. how come sa can't access model database? ran code in stored proc on own, under sa, , ran fine. read extending database impersonation using execute as before continue. when impersonating principal using execute user statement, or within database-scoped module using execute clause, scope of impersonation restricted database default. means references objects outside scope of database return error. you need use module signing . here example.

grails - Integration test all possibilities within one test case -

i running test see if email valid - valid in not in use within application user. i want show when valid email entered, assert true hold, , when invalid email entered, assert false holds. my code follows: class usercontrollerintegrationtests extends groovytestcase{ @before void setup() { // setup logic here } @after void teardown() { // tear down logic here } @test void testvalidateemail() { def usercontroller = new usercontroller() usercontroller.params.email = "ddewdd@a.com" usercontroller.validateemail() assertequals "true", usercontroller.response.contentasstring usercontroller.params.email = "a@a.com" usercontroller.validateemail() assertequals "false", usercontroller.response.contentasstring } } my validateemail() in controller looks : def validateemail() { def valid = false if(params.email != null && params.email != "") { //count how many u

java - Sparse Map with Enum keys -

i need create map enum keys small fraction of enum constants inserted. best approach? enummap inefficient if length of underlying array equal total number of enum constants. i suggest using ordinary hashmap . computing hashes enums both easy , cheap. there should no significant memory overhead, since not duplicating enum objects, instead creating multiple references same object. reason, there should little difference between storing integer key , storing reference enum object.

Codeigniter : How to join 2 tables in databases from 2 different connections -

i made 2 database connections in database.php , 1 reading localhost machine , 1 writing "insert" online database. but ran problem when wanted join 2 tables "answers" in localhost database , "user" in online database. function get_users() { $write_db = $this->load->database('default', true); /* database conection localhost db */ $read_db = $this->load->database('read', true); /* database conection online db */ $read_db->select('*'); $read_db->from('ibitstore.user'); $write_db->join('english.answers','ibitstore.user.user_id = english.answers.user_id'); $query = $read_db->get(); if($query->num_rows() > 0) return $query->result_array(); return array(); } when use $write_db join clause $write_db->join('english.answers','ibitstore.user.user_id = english.answers.user_id'); data retrieved online

x86 64 - In GDB how do I print 0xc(%rsp)? -

i'm trying debug code project , i've come against line cmpl $0x7,0xc(%rsp) . 0xc(%rsp), , how print it? what 0xc(%rsp) the memory location 12 bytes above current stack pointer. value @ location being compared 7 . and how print it? (gdb) print $rsp+0xc

iphone - ios/core data - saving entity for a specific entity object -

i got qeustion core data , rules of relationships. i have entitie multiple users. users have optional one-to-many relationship entitie called event. on app start create user (i self) , other users , save them in cd. object of user i m , hold in nsuserdefaults. so, created event , want assign userobject entitie saved in core data. thought use user object saved in userdefaults , add event it, here: event *event = (event *)[nsentitydescription insertnewobjectforentityforname:@"event" inmanagedobjectcontext:managedobjectcontext]; //property setters event.createdby = userobjectfromnsuserdefaults; is right way? assign event specific user (in example me) ? another qeustion is: my event class (subclass of nsmanagedobject) has nsset property add , remove methods add/remove invitedusers or acceptedusers event. how use methods right? any gets cookie :=) about first question - yes, thats way make relationships in core data. assign specific object (nsmanagmentob

c# - Live log monitoring within the application generating the logs -

i have application in .net need log. want log events , exceptions. saw online log4net being heavily recommended purpose. set begin logging txt file. but not enough purposes. within application, i'd able pull monitor has live listing of logs being generated. if log4net best approach this? if not, is? i have no problem consuming log events , finding own way display data, don't know best way send logging events monitor form. you may want @ log2console , excellent logging monitor compatible log4net. can listen log4net remoting appender , present data quite nicely. if need implement own monitor within program, suggest trying out memoryappender . there's helpful info here (the question nice tutorial) as can see, has set 2 appenders - 1 logging file , 1 logging memory appender. in monitor, can handle appender using following code: hierarchy hierarchy = logmanager.getrepository() hierarchy; memoryappender mappender = hierarchy.root.getappender("memory

c++ - Cast pointer to fixed-size array in return statement -

the simplest way ask question code: struct point { int x; int y; int z; int* as_pointer() { return &x; } // works int (&as_array_ref())[3] { return &x; } // not work }; as_pointer compiles, as_array_ref not. cast seems in order can't figure out appropriate syntax. ideas? i find array types easier deal with typedef: typedef int ints[3]; then as_array_ref must written &as_array_ref() == &x . the following syntaxes possible: plain c-style cast int* ints* : ints& as_array_ref() { return *( (ints*)(&x) ); } c++ style reinterpret_cast (suggested @mike seymour - see answer). considered better practice in c++: ints& as_array_ref() { return *reinterpret_cast<ints*>(&x); } cast int& ints& shorter (for me) less intuitive: ints& as_array_ref() { return reinterpret_cast<ints&>(x); }

Error in implementing a custom view in android: -

Image
i'm trying implement custom view in application. went on page: http://developer.android.com/training/custom-views/index.html and have created following: xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/leftmenu" android:layout_width="100dp" android:layout_height="fill_parent" android:background="@drawable/left_menu_background" android:orientation="vertical" android:visibility="gone" > <imagebutton android:layout_width="fill_parent" android:layout_height="52dp" android:background="@drawable/left_menu_close_button" android:onclick="showleftmenu" /> <imagebutton android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/left_menu_separator"

css Hold animation after it finish -

for example make scale 1 2, , want make hold when gets scale 2, example while user hovers image scaled, possible? @-webkit-keyframes scale { { transform: scale(1); -ms-transform: scale(1); /* ie 9 */ -webkit-transform: scale(1); /* safari , chrome */ } { transform: scale(1.5); -ms-transform: scale(1.5); /* ie 9 */ -webkit-transform: scale(1.5); /* safari , chrome */ } } @keyframes scale { { transform: scale(1); -ms-transform: scale(1); /* ie 9 */ -webkit-transform: scale(1); /* safari , chrome */ } { transform: scale(1.5); -ms-transform: scale(1.5); /* ie 9 */ -webkit-transform: scale(1.5); /* safari , chrome */ } } div.item:hover { animation: scale 2s; -webkit-animation: scale 2s; } you can use transition property instead of keyframes animation. div.item { transform: scale(1); transition: .2s; } div.item:hover { transform: scale(1

Setting up a MultiTenantConnectionProvider using Hibernate 4.2 and Spring 3.1.1 -

i trying set hibernate multi tenancy using seperate schema aproach. after working on 2 days , browsing every source find via google starting quite frustrated. basicaly trying follow guide provided in hibernate devguide http://docs.jboss.org/hibernate/orm/4.1/devguide/en-us/html_single/#d5e4691 unfortunately not able find connectionproviderutils build connectionprovider. trying figure out 2 points: why configure(properties props) method of mssqlmultitenantconnectionprovider never called. interpreted source of , description of different other connectionprovider implementions assuming method going called initialize connectionprovider. since not able work configure(properties props) tried out other approaches of somehow obtaining hibernate properties , datasource specified in application context , hibernate.cfg.xml. (like injecting datasource directly connectionprovider) any pointers possible ways solve (methods, classes, tutorials) so here relevant parts of implementa

sql - Query returns 1 row but throws error for more -

i have weird problem. i have following query : dbms_output.put_line('prefix : ' || prefix || 'vendor id :' || vendor_id); select r.rate rate rates r r.quality = 0 , r.vendor_id = vendor_id , r.prefix = prefix , r.direction = 'out' , r.calendar_value = 0 , (sysdate-(1/24/60) >= r.effective_date_from , sysdate-(1/24/60) < nvl(r.effective_date_to, sysdate)); now rate,vendor_id , prefix 3 variables, 3 numbers. query in stored procedure, , right before query output both vars, prints prefix : 5 vendor id : 361 and query falls on ora-01422: exact fetch returns more requested number of rows the thing is, if copy/paste query separate sql query outside procedure 5 , 361 , 1 row. does know why happen? i'm on oracle 11g i'd bet have duplicates in input. consider following data: create table rates (pk number not null primary key, rate number, quality number, vendor_id number, prefix number, directio

android - creating a foreign key in sqlite database -

i need create foreign key map tables. foreign primary key of table. insert statement creting issue. sqlite database. table primary key is db.execsql("create table if not exists " + main + "(rowid integer primary key autoincrement not null,appln_date varchar,appln_no varchar,rupees varchar,tenure varchar,asset varchar);"); the table foreign key db.execsql("create table if not exists " + applicant + "(appid integer primary key autoincrement, " + "app_salutation varchar,app_fname varchar,app_mname varchar,app_lname varchar,app_door varchar,app_street varchar,app_building varchar,app_area varchar,app_post varchar,app_tehsil varchar,app_state varchar,app_landmark varchar,rowid integer references "+main+"(rowid));"); the insert statement openorcreatedatabase(); createappinfo(); string insertstring = "insert " + applicant +

python - Urllib2 POST request results in 409 conflict error -

i calling google's pubsubhubbub publisher @ http://pubsubhubbub.appspot.com via django's view. want fetch youtube uploads feeds using it. sending 'post' request using urllib2.request, , 409 conflict error. have setup callback url, , if try post same request using: python manage shell works fine. using nginx server proxy gunicorn instance @ production server. possibly wrong. in advance. >>> response.request <preparedrequest [post]> >>> response.request.headers {'content-length': u'303', 'content-type': 'application/x-www-form-urlencoded', 'accept-encoding': 'gzip, deflate, compress', 'accept': '*/*', 'user-agent': 'python-requests/1.2.0 cpython/2.6.6 linux/2.6.18-308.8.2.el5.028stab101.3'} >>> response.request.body 'hub.verify=sync&hub.topic=http%3a%2f%2fgdata.youtube.com%2ffeeds%2fapi%2fusers%2fucvcfopbmjqkq4v6bh6l1uuq%2fuploads%3fv%3d2&hu

Alternative to uri segment on codeigniter? -

im getting id form using $id=$this->uri->segment(2) i need replace else generic without getting id url im using pagination in several pages & im using $this->uri->segment() too .. ps:when want display list o programs belong category & when want display list of programs of channel belong category ,the segment change wont use segment wanna id dynamically .. best regards don't know if after, can send parameters in standard codeigniter install uri , catch them in method params. class welcome extends my_controller { public function index($a = null, $b = null, $c= null) { echo 'testing params: <br> param1: ' . $a . '<br>param2: ' . $b . '<br>param3: ' . $c; } } calling http://example.com/index.php/welcome/index/test1/test2/test3 render testing params: param1: test1 param2: test2 param3: test3 example going comment code: foreach $rows $row .. ..

c# - Combine 2 numbers in a byte -

i have 2 numbers (going 0-9) , want combine them 1 byte. number 1 take bit 0-3 , number 2 has bit 4-7. example : have number 3 , 4. 3 = 0011 , 4 0100. result should 0011 0100. how can make byte these binary values? this have : public byte combinepindigit(int digita, int digitb) { bitarray digit1 = new bitarray(convert.tobyte(digita)); bitarray digit2 = new bitarray(convert.tobyte(digitb)); bitarray combined = new bitarray(8); combined[0] = digit1[0]; combined[1] = digit1[1]; combined[2] = digit1[2]; combined[3] = digit1[3]; combined[4] = digit2[0]; combined[5] = digit2[1]; combined[6] = digit2[2]; combined[7] = digit2[3]; } with code have argumentoutofboundsexceptions forget bitarray stuff. just this: byte result = (byte)(number1 | (number2 << 4)); and them back: int number1 = result & 0xf; int number2 = (result >> 4) & 0xf; this

c# - Adding Two TrackBar to UserControl -

Image
i working trackbars, have add 2 trackbars in single usercontrol in parallel, can use them 1 "low value" , second "high value". i have asked similar question,below link: how make slidebar(trackbar) have 2 handles(needles) i attaching image below started designing, have added tooltips stuck on how override or add features take values both of trackbars separate textboxes/labels etc, , bound them not overlap each other means, min(low) won't exceed max(high)

java - HQL: select statement along with using 'case when then' giving unexpected token error -

i facing issue in writing hql query. i have mysql table named mytable column names id , column1,column2 , type. fields integer type. the select query based on value in 'type' column . if value in 'type' column 0 select query based value in column1. if value in type column 1 select query based on value in column2. i have written query using 'case when then' sql successfully. same query giving exception when using hql query sql query: select * mytable case when type=0 column1=234 when type=1 column2=564 end; hql query: from mytableobj obj case when obj.type=0 obj.column1=234 when obj.type=1 obj.column2=564 end; gives following error, 17:30:16,197 error [parser] line 1:127: unexpected token: = 17:30:16,198 error [parser] line 1:134: unexpected token: end 17:30:16,199 warn [hqlparser] processequalityexpression() : no expression process! org.hibernate.hql.ast.querysyntaxexception: unexpected token: = near line 1, column 127 [from

ios - Set rootViewController of UINavigationController by method other than initWithRootViewController -

how set rootviewcontroller of uinavigationcontroller method other initwithrootviewcontroller ? i want use initwithnavigationbarclass:toolbarclass: deliver custom toolbar navigationcontroller, don't think can use initwithrootviewcontroller . you can solve calling setviewcontrollers . like this: uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithnavigationbarclass:[mynavigationbar class] toolbarclass:[uitoolbar class]]; [navigationcontroller setviewcontrollers:@[yourrootviewcontroller] animated:no];

sql server 2008 - sql combining two columns one of which is a datetime -

i have following sql code (ms sql server 2008) select (analysisno + ' ' + '-' + ' ' + description + ' ' + '-' + ' ' + formdate) columna from old_analysis_data order formdate i following error conversion failed when converting date and/or time character string. analysisno varchar(10) description varchar(500) formdate datetime (not table, old one) any ideas, cant find answer on google. convert time string using convert before concatenation: select ( analysisno + ' ' + '-' + ' ' + description + ' ' + '-' + ' ' + convert(varchar(20), formdate, 100) ) columna old_analysis_data order formdate in case, 100 style sets datestamp format mon dd yyyy hh:miam (or pm) example see http://www.w3schools.com/sql/func_convert.asp

PHP XML serializer -

is there php libraries implement serialization of data xml-format serialize() , unserialize() (with restoring objects xml) functions of objects private , protected fields? pear xml_serializer works fine type hints option, doen't deal protected fields. hoping not considered spamming, i've been working on library deals serializing , deserialing objects , xml. https://github.com/evert/sabre-xml/ however, doesn't you're asking. every object want serialize needs implement serializexml , deserializexml method. in method can decide exactly need implement. if plan use this, happy include exact feature want php 5.4 trait. send me message (you can find info on github).

c# - Javascript Modification to Allow Alert -

i have limited javascript experience , im trying modify script below show alert of success or failure after post attempt: <script language="javascript" type="text/javascript"> $(function() { $("form").submit(function(e) { $.post($(this).attr("action"), $(this).serialize(), function(data) { $("#result").html(data); }); e.preventdefault(); }); }); </script> i know needs this: success: function(){ alert("edit successful"); }, error: function(){ alert('failure'); but cant figure out how integrate without syntax errors. script performing post above code perform allow confirmation of success or failure occur: @using (html.beginform("admin", "home", "

Last php session longer -

for few months make rpg to-do/habits/project management system ( game ). problem length of session pretty small. i checked facebook login scripts, has 1 year expiration. problem not here. http://rpgtasks.igloro.info i cant find right spot should increase length. hosting not mine, pay host. should ask them? from phpinfo here: http://rpgtasks.igloro.info/phpinfo.html we can see session.cache_expire set 180. php session? should increase it? thanks help

c++ - Qt Mouse Control of Rotaries on touch and non-touch devices -

i have implemented rotary widget in qt. when user clicks rotary, mouse cursor hidden, , dragging mouse left/down turns rotary anti-clockwise, , dragging mouse right/up turns rotary clockwise. when mouse released, mouse cursor set original position of click. implemented this: void rotarywidget::mousepressevent(qmouseevent *mouseevent) { mmousepos = qcursor::pos(); mpreviouspos = mouseevent->pos(); setcursor(qt::blankcursor); } void rotarywidget::mousereleaseevent(qmouseevent *mouseevent) { qcursor::setpos(mmousepos); unsetcursor(); } void rotarywidget::mousemoveevent(qmouseevent *mouseevent) { qpoint deltapos = mouseevent->pos() - mpreviouspos; // use deltapos move rotary mpreviouspos = mouseevent->pos(); } the benefit of when there several rotaries in row, quicker user make adjustments. there bug above code, in if cursor gets edge of screen, mouse cannot moved rotary not move. however, user cannot see cursor, problem. changed mousemo

php - How to update object properties in a AWS S3 Bucket -

i've uploaded 25k files (large media files) s3 bucket. used aws sdk2 php ( s3client::putobject ) perform uploads. now, need update metadata these files i.e change contentdisposition attachment , assign filename. is there way perform without requiring re-upload file? please help. yes, can use copyobject method , set copysource parameter equal bucket , key parameters. example: // setup $s3 connection, , define bucket , key resource. $s3->copyobject(array( 'bucket' => $bucket, 'copysource' => "$bucket/$key", 'key' => $key, 'metadata' => array( 'extraheader' => 'header value' ), 'metadatadirective' => 'replace' ));

regex - Javascript Email validation that allows a null value -

i have on submit function checks email field have formatted address. works fine. however, want field allow null value particular input optional , not required. know should simple, im missing obvious. point me in right direction... edit: providing entire form validation time. every time replace email portion breaking other pieces.... function validatesmsform() { if (smsform.pid_form.value.length < 4) { alert("please enter valid partner id"); return false; } if (smsform.area.value.length < 3) { alert("please enter valid 10-digit cell phone number"); return false; } if (smsform.prefix.value.length < 3) { alert("please enter valid 10-digit cell phone number"); return false; } if (smsform.line.value.length < 4) { alert("please enter valid 10-digit cell phone number"); return false; } <!-- email validation here if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailaddress.value)) { return (true)

android - Using actionbar before API Level 11 -

this question has answer here: what equivalent of actionbar in earlier sdk versions? [closed] 4 answers i'm trying create actionbar android application. need work in android 2.2 , 2.3 too. there way implement actionbar in android 2.3/2.2? have @ actionbarsherlock . add library android project , overwrite activity sherlockactivity , have possibilities of actionbar.

cmd - Psql script not committing when executed from Java -

i have .bat file executes psql command import sql script file. when execute .bat file windows command line, executes correctly. when call .bat file java (with processbuilder), script doesn't end. i'm not getting errors, not in inputstream, errorstream not in db (postgresql) log. arraylist<string> cmdargs2 = new arraylist<string>(); cmdargs2.add("sql2dbs.bat"); processbuilder pb2 = new processbuilder(cmdargs2); logger.info(pb2.command().tostring()); map<string, string> env = pb2.environment(); env.put("pgpassword", "user"); process p2 = pb2.start(); bufferedreader stderror2 = new bufferedreader(new inputstreamreader(p2.geterrorstream())); string s; while ((s = stderror2.readline()) != null) { logger.info(s); } bufferedreader stdin = new bufferedreader(new inputstreamreader(p2.getinputstream())); while ((s = stdin.

delphi - How to OwnerDraw TListView Bitmaps with vsIcon Style? -

there examples in stackoverflow ownerdraw subitems in tlistview vsreport style not find example on how ownerdraw bitmaps in tlistview vsicon style? my bitmaps stored in third-party list , resized 32x32. not want use imagelist because bitmaps available in third-party list. code shown below draws first icon ok, remaining items empty. should doing in other event has access trect? procedure tform1.cxlistview1customdrawitem(sender: tcustomlistview; item: tlistitem; state: tcustomdrawstate; var defaultdraw: boolean); var ibitmap: tbitmap; irect: trect; begin { create tbitmap } ibitmap := tbitmap.create; ibitmap.width := 32; ibitmap.height := 32; if item.index <> -1 begin { copy bitmap list ibitmap } aieimagelist.image[item.index].copytotbitmap(ibitmap); { resample bitmap } ibitmap.ieresample(32, 32); {fix} irect := item.displayrect(drbounds); { draw bitmap } sender.canvas.draw(irect.left, irect.top, ibitmap); end; ibitmap

c# - How my win form application can interact with signalr -

i develop asp.net & signalr based chat apps people can send message specific user. now want develop win form chat apps connect asp.net based signalr hub , fetch logged in users , display user in grid. so tell me @ feasible signalr winform & web form users can talk each other signalr hub in web. if yes, please guide me how develop such apps winform because web part ready. mitul suther has blog using signalr in wpf

gwt - A way to identify SmartGWT SelectItem in Selenium Grid 2 (WebDriver) tests -

i trying set id selectitem (to options list, more precisely) in order able identify during selenium grid 2 tests , find no way it. need find list , select (click) value on it. tried , failed intents: the usual methods purpose setid() , ensuredebugid() not available in selectitem the method setname() don't leave trace in generated html it impossible find options list on form contains selectitem. selectitem consists of separate elements: label (title) textinput (selected value) picker (button display options drop-down list) picklist (the options drop-down list) if set id form contains component in order localize through classname can't spot picklist , it's getting generated when picker clicked , generated code placed out of form bounds, can't find within form. possible find on whole document, in case of having more 1 lists there no way know list belongs selectitem. any advice welcome. thank in advance. update : clarify avoid misunderstandings:

.net - Oracle dotnet DBMS output query -

i running code in .net, using oracleclient in ,net. sql code can output number of responses using dbms_put_line function, retrieve call dbms_get_line. if output specific line of text, ie 'dbms_output.put_line('user not available : please contact system administrator');' call get_line works fine, , text. however, if call output sql error message, 'dbms_output.put_line(sqlerrm);' following error returned, 'ora-06502: pl/sql: numeric or value error: hex raw conversion error' the wierd thing, if run same code 2nd time (including close , reconnect db) call get_line returns actual error message being output. my code following: opens db connection runs sql query executenonquery creates output parameters like: dim anonymous_block = "begin dbms_output.get_line(:1, :2); end;" acmd.commandtext = anonymous_block acmd.parameters.add("1", oracletype.varchar, 32000) acmd.parameters("1").direction = parameterdirection.output ac

chef-server-ctl reconfigure fails because of RabbitMQ -

according installation page on opscode install process of chef server 11 should easy. however, in company, both me , colleague of mine have run same problem when tried install chef: running $ sudo chef-server-ctl reconfigure would throw error , stop: "error when reading /var/opt/chef-server/rabbitmq/.erlang.cookie: eacces" how can fix problem? check user/group owns erlang.cookie file indicated in error message. file should owned user chef_server , $ chown chef_server:chef_server erlang.cookie in directory.

Xml namspace parsing using JDOM -

i trying read following xml string response using jdom have no idea how parse? can please me? trying following codes parse: org.jdom.element rootnode = document.getrootelement(); list<?> list = rootnode.getchildren("quotationresponse"); for(int = 1 ; <= list.size() ; i++) { element node = (element) list.get(i); string documentdate = node.getattribute("documentdate"); string transactiontype = node.getattribute("transactiontype"); } xml: <?xml version="1.0" encoding="utf-8"?> <s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:body><vtenvelope xmlns="un:vtinc:o-series:tps:6:0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <login><username>user</username> <password>abcd</password> </login> <quotationresponse documentdate="2011-03-24" transactiontype="sale"><custome