Posts

Showing posts from May, 2012

android - Handling imageButton clicks inside a custom listview -

i have listview custom adapter. custom row in listview containts 2 imagebuttons need handle when click on it. doesn't work want, because when start app , click on imagebutton nothing happens, if first click on row , on imagebutton, click being handled. tried few solutions helped other users here so, nobody had exact same problem me gets handled after row click. favoriteactivity public class favoriteactivity extends activity { private list<favorite> favoriteitem = new arraylist<favorite>(); viewholder holder = new viewholder(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.favorite); populatefavoritelist(); populatelistview(); registerclickcallback(); } private void populatefavoritelist() { favoriteitem.add(new favorite(r.drawable.icon_camera, "item 1")); favoriteitem.add(new favorite(r.drawa...

matlab - Error: Subscript indices must either be real positive integers or logicals -

this question has answer here: subscript indices must either real positive integers or logicals, generic solution 3 answers i have 1 194-by-1 matrix. when try find size, message: subscript indices must either real positive integers or logicals. all values positive , logical, problem? is possible accidentally override size function? >> size should give output built-in (c:\ x x x \toolbox\matlab\elmat\size) if like size variable then override function. to ammend you'll have clear variable >> clear size now can use function >> size( )

c++ - detect if the arrow button from QScrollBar is pressed -

is there signal can emit if arrow button of qscrollbar pressed? far know there sliderpressed() signal. want, if exists, solution valuechanged() signal. all signals qscrollbar emits (inherited qabstractslider ) related o slider/value changed: void actiontriggered ( int action ) void rangechanged ( int min, int max ) void slidermoved ( int value ) void sliderpressed () void sliderreleased () void valuechanged ( int value )

c# - Stubborn WinForm loses focus and doesn't regain it -

i have form splitview container. left side devex gridview , right side regular view. drag-drop text gridview view @ right hand side. simulate drag-drop use mousedown event of gridview combined dodragdrop , dragover methods of view on right hand side. everything works fine, problem after drag , drop data gridview, first need click (anywhere on screen) before can click anywhere else on entire form. tried, focus , activate , topmost methods both views reason don't seem work; forcing me click once before able click somewhere else on entire form. i know pretty vague quetion ideas how can solve ?

sql - Strategy to alter database synonym during normal production operation -

currently have scenario involves switching synonym definition after completion of scheduled job. job create table identifier of even or odd correspond hour being or odd. doing this: odd_job: create foo_odd ... replace foo_syn foo_odd and even_job: create foo_even ... replace foo_syn foo_even what happening during normal production foo_syn in locked state. looking production capable way of swapping synonym definitions. the question how can swap synonym definition in production level system minimum user interruption in oracle 10g? from comments does foo_syn have dependent objects? no foo_syn nothing more pointer table generate. there no procedures need recompiled switch. that sounds strange thing do. can explain bit switch for/how used? sure. have application interfaces database, sql executed java (business logic queries) has reference foo_syn . because of dynamic nature of data guarantee hourly swap give new results import...

css - html element background makes link un-clickable -

i have 3 link <a> elements background half link isn't clickable because background overlaps text. know solution? here example of i've done <html> <head> <style> li { list-style-type:none; list-style:none; position:relative; height:100px; } #middle { width:350px; background:url("images/middle.png"); left:405px; height:250px; padding-top:50px; background-size:100%; } #left { left:275px; width:240px; height:150px; padding:150px 60px 0 0; background:url("images/left.png"); background-size:100%; } #right { left:580px; width:235px; height:150px; padding:150px 0 0 70px; background:url("images/right.png"); background-size:100%; } #test { height:325px; } .item { position:absolute; font-size:33px; float:left; margin:15px; font-family: georgia, times, "times new roman...

I need to get the last two value after dot using javascript split -

i getting results demo.in,demo.co.in,demo.tv,demo.org.in need split extension separately using javascript split function var vsp = i.split("."); this code result demo,in demo,co,in but need extension separately working fiddle (demo version) var values = [ "demo.in", "demo.co.in", "demo.tv","demo.org" ]; var results = []; // iterate through values (var = 0, len = values.length; < len; i++) { // split parts on every dot. var parts = values[i].split("."); // remove first part (before first dot). parts = parts.slice(1, parts.length); // join results results.push(parts.join(".")); }; console.dir(results); // done // nicely display values op: (var = 0, len = results.length; < len; i++) { document.body.innerhtml += (i + 1) + ": " + results[i] + "<br ...

php - When can Dependency Injection Containers become too big, and what can I do about it? -

we know why dependency injection awesome because makes code less coupled, easier test, , nicer read! , decide use dependency injection container pimple php assist dependency inversion principle in solid . so when creating dic using pimple, passing through controller, , having new objects created in closures instantiated when developer calls $container['object'] , great! but happens when have very large set of classes in application ? 1000+, , want these available in container? development-wise, going nightmare placing these within 1 file. best way separate them, or alternative suggestion preferable? on separation side, how about: creating container including several files classes grouped depending on application adding container incrementally until end of file includes on flip side, know symfony2 uses xml/yaml dic configuration, doesn't go talk architectural side of things when application contains many classes. what can developer when have such l...

c# - Error while updating in database using dataset -

while running below code getting error dynamic sql generation updatecommand not supported against selectcommand not return key column information. tried doing many things nothing working. below code string queryup = "select node_a_objectid,node_z_objectid nddilinks"; string myconnectionstring = @"provider=microsoft.jet.oledb.4.0; data source=d:\tiptondb.mdb"; dataset dtup = new dataset(); using (oledbconnection myconnection = new oledbconnection()) { myconnection.connectionstring = myconnectionstring; oledbcommand cmd = new oledbcommand(); cmd.connection = myconnection; myconnection.open(); oledbdataadapter adp = new oledbdataadapter(queryup, myconnection); adp.fillschema(dtup, schematype.source, "nddilinks"); adp.fill(dtup, "nddilinks"); dtup.tables[0].ro...

javascript - jquery event not working after append -

http://jsfiddle.net/ysnht/2/ jquery event on not working after append. need value of textarea after click save button. $('.span8') .on('click', '.btn', function() { var input = $("#textarea").val(); alert(input); }); $('body').on('click','#createnote',function() { $('.span8').empty(); $('.span8').append('<button type="button" class="btn" style="float: right; margin-right: 8px;background-color:#dddddd;font-family:roboto slab;color: black" id="save" data-loading-text="saving...">save</button><div class="hero-unit"><input type="text" style="width: 100%" id="title" placeholder="title"/>'+ '<textarea contenteditable="true" id="textarea" class="textarea...

jsp - How to use s:set as param to s:push making static method call in Struts 2 -

i tried : <s:set name="ordersymbol" value="eurusd" var="ordersymbol"/> <s:push value="@dao.positions@positionso(%{#ordersymbol})"> <s:set name="ordersymbol" value="eurusd" var="ordersymbol"/> <s:push value="@dao.positions@positionso(#ordersymbol)"> <s:set name="ordersymbol" value="eurusd" var="ordersymbol"/> <s:push value="@dao.positions@positionso(ordersymbol)"> <s:set name="ordersymbol" value="eurusd" var="ordersymbol"/> <s:push value="@dao.positions@positionso(%{ordersymbol})"> neither of above 4 worked, method null parameter. although if try <s:push value="@dao.positions@positionso('eurusd')"> it works fine. i realize it's old question... but: the reason in doesn't work "value object." correc...

node.js - How do I remove the need to convert _id (as a string) to new ObjectID(string) in nodejs / mongodb native library? -

each time have perform query involving _id, have new objectid( _idasstring) in order work. realize mongo tests object, not value itself, adding lot of overhead , may miss converting in places. the _id goes client objectid( string ) turned string , when comes client, have remake objectid( string ). mention "string" actual value generated mongo, 123a1b12dc... if there good/complete library such internal functionality, love try out. there node.js object mappers provide functionality. take @ mongolia. https://github.com/masylum/mongolia#mappings-and-type-casting

jsp - Open PDF on another tab after click on button in html -

i want open pdf on tab/window after click on button. tried set onclick="winodw.location.href" still open in same page/window. following code. <input type="button" value="report" onclick="location.href='showpdf?&name=${name}'"> any inputs use target="_blank" open in new tab

wpf - My Custom Event does not produce anything -

i'm trying create custom routedevent in order trigger animation whenever text property of textblock changes. class inherits textblock class , shadow text property. i'm using button in order change text property in other value. code not produce errors doesn't anything. i'm sure problem textchanged event because when replace let's mouseenter event, works ok. public class mycustomtextblock inherits textblock public shared readonly textchangedevent routedevent = eventmanager.registerroutedevent("textchanged", _ routingstrategy.bubble, gettype(routedeventargs), gettype(mycustomtextblock)) public custom event textchanged routedeventhandler addhandler(byval value routedeventhandler) me.addhandler(textchangedevent, value) end addhandler removehandler(byval value routedeventhandler) me.removehandler(textchangedevent, value) end removehandler raiseevent(byval sender object, byval e system.windows....

php - count and echo the number of non empty folders/directories -

i want search search through several directories/folders , count , echo number of ones have non-empty subfolders/subdirectories. know how count number of files single subdirectory below. however, not find on counting global number of directories have files. $dir = '../location/' . $nameofadirectory .'/subdir/'; $count = count(glob($dir . "*")); echo $count;

ASP.NET WebApi Controllers in the external dll using MEF -

i have simple apicontroller in separate project: <export("custom", gettype(apicontroller)), partcreationpolicy(creationpolicy.nonshared)> public class customcontroller inherits apicontroller public function getsomething() httpresponsemessage dim result new something() { .code = "code", .somefield = "something", .somefield2 = 5 } return request.createresponse(system.net.httpstatuscode.ok, result) end function end class after googlinng while i've managed point controller gets resolved using custom implementations of ihttpcontrollerselector , ihttpcontrolleractivator. getting error: "no action found on controller 'custom' matches name 'getsomething'" . means have implement ihttpactionselector , else afterwards... sounds complicated , illogical, i'm not trying custom handling. hints i'm going wrong? to have webapi contro...

asp.net - Using same session for different domains in chrome -

i have 2 web applications , 1 web service application in asp.net (all of host in same server have different domain) (example : 213.74.99.50:9090 1 st app, 213.74.99.50:9091 second , 213.74.99.50:9093 fro web services) i want use same sessions applications. login @ first web app second app login data webservices. i using stateserver mode, same keys machinekeys, make app name same in global.asax there no problem internet explorer. everythings works fine. can use same sessions @ applications. but when try in chrome or firefox have use "access-control-allow-origin=*" but not working webservices. web applications use same sessions between them. bur web services cannot use same sessions in chrome , firefox. this code: store session first application; protected void button1_click(object sender, eventargs e) { session["deneme"] = textbox1.text; label1.text = session.sessionid; } read session second application protec...

c - Getting request for member not a structure or union error -

i trying implement stack. have following stack struct: struct stacknode { char data; struct stacknode *nextptr; }; typedef struct stacknode stacknode; typedef stacknode *stacknodeptr; when try use pop method, number of error messages. pop method is: char pop(stacknodeptr *topptr ) { if (isempty(topptr)) { printf("can't pop element stack: stack empty.\n"); return 'n'; // arbitrary char end if, adjust later. } char c = topptr->data; //save data returned // temporary structnodeptr save data stacknodeptr temp; // temporary stacknodeptr temp = malloc(sizeof(stacknodeptr)); temp->data = topptr->data; //line 52, first error temp->nextptr = topptr->nextptr; //replace values in topptr, section have yet debug, faulty. topptr->data = temp->nextptr->data; //line 56, third error topptr->nextptr = temp->nextptr; free(temp); return (c); } i following error messages: 52:2...

asp.net - LoginView Not Updating After User Login -

i'm using asp.net membership in order manage website users. without using specific 'login controls'. actually, applying membership class methods in order create user account , user login. on other hand, there loginview control in site.master responsible 'welcome username' task. problem that, loginview control isn't updated after creating new account or login. have use specific login controls? ----also, have set login button commandname 'login'! ----should set create user button? i appreciate help... the following code login: if (!membership.validateuser(httputility.htmlencode(txtusername.text), httputility.htmlencode(txtpass.text))) { lblresult.text = "invalid user name , password."; lblresult.visible = true; } else { response.redirect("~/default.aspx"); } and here registration code: membershipcreatestatus statususer; try { ...

if statement - Javascript if clause not working properly -

i have following javascript/jquery: $('#list').keypress(function (e) { if (e.which == 13) { var lines = $('#list').val().split('\n'); mylast = lines[lines.length - 1]; mylen = mylast.length; if ((mylen != 8) || (mylen != 4)) { lines = lines.slice(lines.length-1); $('#list').val(lines.join("\n")); alert(mylen); return false; } return true; } }); but jumps code block after if if length 4 or 8.... where error? i want remove last line of textarea if it's not of given length. it should not be: if ((mylen != 8) || (mylen != 4)) { it should be: if ((mylen != 8) && (mylen != 4)) { your way if 8 , not 4 getting through or if 4 not 8. need check not either

java - Errors using the Comparator interface -

i trying write simple application priority queues. getting following errors --" error: leastpriority not abstract , not override abstract method compare(integer,integer) in comparator" , "error: incompatible types comparator cmp = new leastpriority(); " can point out problem code. my code : class leastpriority implements comparator<integer> { public int compare(reservation x, reservation y){ if(x.getpriority() > y.getpriority()){ return -1; } if(x.getpriority() < y.getpriority()){ return +1; } return 0; } } public class prioqueue{ public static void main(string args[]){ comparator<reservation> cmp = new leastpriority(); priorityqueue<reservation> queue = new priorityqueue<reservation>(10,cmp); queue.add(new reservation(1,"andy",10)); queue.add(new reservation(1,"peter",1)); queue.add(new...

commandbinding - WPF Application Menu disabled when the focus is on a Textbox and wont work until app restart -

i having problem appmenus in sample wpf application. window2.xaml: <window x:class="samplewpfapp.window2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:samplewpfapp" name="rootwindow" title="window2" height="600" width="800"> <window.inputbindings> <keybinding gesture="ctrl+n" command="applicationcommands.new" commandtarget="{binding elementname=topmenu}" /> <keybinding gesture="ctrl+f1" command="{x:static local:topmenu.showhelp}" commandtarget="{binding elementname=topmenu}" /> </window.inputbindings> <dockpanel> <local:topmenu dockpanel.dock="top" x:name="topmenu" /> <contentcontrol> <local:home x:name="maincontent...

c++ - use a pointer in operation with non pointer -

i'm quite new c++ , don't understand pointers yet. this ok, have 2 non pointer object: vec2d a(0, 0), b(10, 10); vec2d c = a-b; but if 1 pointer? vec2d::minus(vec2d b) { vec2d = vec2d(this->x(), this->y()); return that-b; } so question: how can use pointer this - operation b? and also, don't understand how many object constructed in methods , how can optimize memory consumption passing reference.. if got question correctly.. "this pointer, how can operate on , other pointers using methods require non-pointer?" you use dereference operator * example: vec2d = *this; to answer second question: an object created pass parameter of minus an object created vec2d(this->x(), this->y()) (but erased away temp optimizing compiler) an object created on stack ( that ) depending on how implemented them, , on how compiler is, may create object in copy constructor/operator= an object (or more) may created operator- in t...

c# - Get HttpOnly cookies using HttpWebRequest -

i'm trying log in site programmatically using .net's httpwebrequest post method (code's written in c#). sent request login page, saved response cookies cookiecontainer, , made second httpwebrequest login details (email="myemail"&pass="mypassword") encoded , streamed request. as didn't manage log in, checked cookies attached login request using fiddler, , discovered cookies flagged httponly. is, these cookies don't appear in response headers of previous requests (needless don't appear in script (html or js)). i've done little research , imported wininet.dll library code explained here . here's code: class cookiereader { static int internet_cookie_httponly = 0x000020000; [dllimport("wininet.dll", setlasterror = true)] static extern bool internetgetcookieex(string url, string cookiename, stringbuilder cookiedata, ref int size, int flags, intptr preserved); public static string gethttponly(string...

php - Return a large array from a function -

i have class app manages database fetches. instead of working result set ( pdostatement ) in class , echoing out html there, i'd return result set page using fetchall() return $stmt->fetchall(pdo::fetch_assoc); edit: don't want return $stmt because knowledge not have multiple existing pdostatement objects existing single connection. avoid risk i'd manage these objects within class. please correct me if i'm mistaken. assuming array won't on 100k rows, maybe 10k-50k, there performance reasons (or @ all) why should not doing this? know it's pretty basic, preferred way of handling this? will make difference of impact on memory if rather working right in class method? think okay, wanted hear so. if memory concerns exist calling fetch not friend, regardless of doing... better off calling $stmt->fetch in loop. since php passes arrays reference processing within function vs deferring out should have same memory , performance profile. ...

java - Oracle snippet does not give back results -

here have following bit of code taken this oracle java tutorial: // defaults read try (seekablebytechannel sbc = files.newbytechannel(file)) { bytebuffer buf = bytebuffer.allocate(10); // read bytes proper encoding platform. if // skip step, might see looks // chinese characters when expect latin-style characters. string encoding = system.getproperty("file.encoding"); while (sbc.read(buf) > 0) { buf.rewind(); system.out.print(charset.forname(encoding).decode(buf)); buf.flip();//line x } } catch (ioexception x) { system.out.println("caught exception: " + x); so not output out of it. have tried put flags in while loop check whether or not gets into, , gets into. changed encoding in charset.defaultcharset().decode(buf) , result : no output. of course there text in file passed newbytechannel(file); any idea? lot in advance. ** edit: ** solved, file trying access had been accidentally corrupt...

amazon ec2 - Allowed Host Setting for Django on EC2 -

i deployed amazon ec2 bitnami djnago stack , i'm having trouble allowed_hosts setting in settings.py file. not sure hostname use or find it. have tried internal ip, external ip, localhost, domain name. thing gets 500 error pages stop, is: allowed_hosts = ['*'] but, security issue. missing? set - allowed_hosts = [ '.yourdomain.com' ] where yourdomain.com domain name you're using access it. the documentation says - values in list can qualified names (e.g. 'www.example.com'), in case matched against request’s host header (case-insensitive, not including port). value beginning period can used subdomain wildcard: '.example.com' match example.com, www.example.com, , other subdomain of example.com. when set www.yourdomain.com , there must have been request subdomain, other www . caused trouble. cannot because don't have information.

java - Parse request line of http header -

is there inbuilt in java.net parse request line on http request? for example: connect google.com:443 http/1.1 in case want parse host , port . you can use gethost() or getport() or getdefaultport() methods of java.net.url class. for further information can check here

linux - Will multiple connection increase internet speed? -

if have cable connection , wireless connection @ same time, increase download/upload speed? use kubuntu linux. so want use both cable , wireless @ same time act one, big, faster connection? that's called bonding or trunking , you're looking this: https://help.ubuntu.com/community/ubuntubonding of course, requires both cable , wireless use separate connections isp, otherwise it's not going make difference. in practice, best bet use cable connection alone , faster connection isp. it's lot less hassle.

excel - Convert a string with a carat to a number (and evaluate) -

i have column of imported numbers in format 123.4 decimal here should signify "to power" of i.e. ^ i want display in column evaluated value. 123.4 display 228886641 . i used substitute command replace decimal ^ , giving me 123^4 , looks not number. if use value command on output substitute (the text string 123^4 ) though #value! error. how 123.4 228886641 ? use =int(a1)^mid(a1,search(".",a1)+1,1) or risk power being either .4 or 40 in example.

android - Changing the background color and shape of the zoom buttons, AChartEngine -

Image
i have sin function in graph, , user able select points on it. however, when pointstyle in renderer point, background of zoom color white/transparent (not sure since background white). however, when add pointstyle.circle (for when user selects point on function) background of zoom buttons change gray. when remove point, changes white/transparent. is there way force background color of zoom buttons? also, there way change container shape of zoom buttons. round corners sharp corners. perhaps override? you cannot change zoom buttons , feel. however, can create custom zoom buttons , hide default ones.

ruby on rails - Is there a way to set set config.action_controller.asset_host in development -

in production.rb set asset_host cloudfront so: config.action_controller.asset_host = 'http://xxxxxxxx.cloudfront.net' now i'm finding in circumstances (specifically, outputting javascript embedded site) need set asset_host in development environment too, default null won't cut it. ideally want set: config.action_controller.asset_host = 'http://localhost:3000' but port can't guaranteed, , i'm reluctant hard-code it. there way set asset_host current domain , port? thanks! you can make use of environment variables or rails initializer parameters config.action_controller.asset_host = env[asset_host].empty? ? 'http://' + rails::server.new.options[:host] + ':' + rails::server.new.options[:port] : env[asset_host] this way if set environment variable use address otherwise use default.

PHP Array last element being lost from using another array as dictionary -

Image
i have 3 arrays. 1 contains given title information user stored in $attributenames. second has data user stored in $anesdata. (so first 2 related) , third dictionary can out information want using index stored in $medicalinstancedictionary. this first one: array ( [0] => patient mrn [1] => patient last name [2] => patient first name [3] => patient middle name [4] => patient ssn [5] => patient sex [6] => invoice [7] => transaction [8] => date of procedure [9] => posting date [10] => location [11] => charge amt [12] => provider [13] => fsc1 [14] => fsc2 [15] => patient dob [16] => attending surgeon [17] => attending surgeon [18] => cpt codes [19] => asa classfication [20] => anesthesia crna [21] => anesthesia resident [22] => surgery start time [23] => surgery end time [24] => svc unit [25] => facilit...

html5 - Showing a different web page depending on city -

i trying figure out how create web site show different homepage depending on city viewing in. in if in vancouver show mywebsite.com/vancouver etc. have been looking @ html5 geo locations , know how find location need figure out how use location show specific content. apologize if has come in pervious discussions couldn't find answer looking for. thanks as far know, feat of html5 under user acceptance. can find more info here: http://www.w3schools.com/html/html5_geolocation.asp

java - Replacing JList through Combobox selection -

i'm creating word search game combobox has different game itemsand jlist shows words found in word list. when user clicks on item in combobox, list should show words associated item. right now, work when select first item, if try change word list selecting second item, adds words without deleting original words. want replace words, not add them on. clear list model in action listener reason isn't working. setanimallist, setspacelist, , setcomplist methods called subclass set values of wordlist2. arraylist<word> wordlist2 = new arraylist<word>(12); string[] gamestrings = {"space", "animals", "computers"}; jlist words; jcombobox menu; defaultlistmodel listmodel; listmodel = new defaultlistmodel(); words = new jlist(listmodel); menu = new jcombobox(gamestrings); menu.addactionlistener(this); public void actionperformed(actionevent e) { string selected = (string)menu.getselecteditem(...

iis - WCF Service and Concurrency -

i have driver need access via web site not thread-safe. since many people can on site @ given time figured create wcf service handle calls. of calls asynchronous calls add items work queue. synchronous calls list of items still unprocessed or items have been processed. since driver isn't thread safe, service must take in potentially many requests @ once , either add items work queue, return work queue, or return work-completed queue. single-threaded operation in service needs read work queue, processes job using non-thread-safe driver, and, when complete, update work-completed queue. while conceptually have clear in mind do, specifics of implementation confuse me little. think should host service in iis since have respond web requests , otherwise act other web site, i'm not sure how guarantee access of driver remain single-threaded without blocking web requests. need second service, perhaps windows service, process access driver , use iis-hosted wcf service next queue i...

javascript - Form posting in MVC4 using AJAX - partialview and ModelState.IsValid and modalbox -

i'm using asp.net mvc4 create application , i'm facing issue regarding ajax , partial views. right now, have view rendering : a partial view (called _createuser ) modalbox containing form create user in application (rendered via @{html.renderpartial("_createuser");} ) a partial action (called listusers ) action renders users registered in application (rendered via @{html.renderaction("users");} in html table when user clicks button, modal box contained in _createuser displayed via jquery user can type informations new user. when clicks on button in modal box, form submitted via ajax action in controller checks modelstate.isvalid . and i'm stuck because don't know correct way of handling success/error partial view using jquery because if model correct , registration correct, want refresh list of users. model not valid, want refresh modal box errors raised modelstate . my action : [httppost] [validateantiforgerytoken] public action...

xml - Best Practice for saving a DataGridView after the contents of a cell have been deleted -

i have datagridview has text box column user can modify. running issue when user deletes text out of 1 of cells , tries save it, though obj ref error when tried access cell text deleted from. the way got around when user done editing cell put handler on the "cellendedit" event. in method check see if cell isnothing set value empty string. i wondering if best practice sort of thing. you can set datasourcenullvalue property string.empty cell. when user deletes contents of cell, empty string automatically set in database. not have handle cellendedit event. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.datasourcenullvalue.aspx

c# - Switching from an asmx to a svc web service -

we upgraded web services asmx wcf, need change call web service in application, contract name , method names , signatures same. there easy way go calling asmx web service svc web service (wcf)? internal xmldocument servicecall() { webresponse reponseweb = null; string strreponse = string.empty; httpwebrequest webrequest = this.createwebquery(); xmldocument soapenvelopexml = this.creerenveloppesoap(); using (stream stream = webrequest.getrequeststream()) { soapenvelopexml.save(stream); } xmldocument xmlsoaprequest = new xmldocument(); try { reponseweb = webrequest.getresponse(); } catch (system.exception ex) { throw ex; } stream str = reponseweb.getresponsestream(); streamreader sr = new streamreader(str); xmlsoaprequest.load(sr); return xmlsoaprequest; } private httpwebrequest...

c++ - QWidget doesn't close when main window is closed -

i'm trying make main window (qwidget) open new qwidget when button clicked when close main window, qwidget opened doesn't close. main.cpp qapplication a(argc, argv); mainwindow w; w.show(); return a.exec(); mainwindow.cpp (parent) mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); } out.cpp (child) out::out(qwidget *parent) : qwidget(parent), ui(new ui::out) { ui->setupui(this); } i suspect you're looking qt::wa_quitonclose : makes qt quit application when last widget attribute set has accepted closeevent(). behavior can modified qapplication::quitonlastwindowclosed property. default attribute set widgets of type qt::window. in case, should call: mywidget->setattribute( qt::wa_quitonclose, false );

linux - Shell script to loop command line switches and arguments -

i'm trying write bash script check command line switchess , use next argument switches argument. example: sh myprogram.sh -s switcharg -p programarg start within script i'm trying loop way: if [ "$#" -gt 2 ] { i=1 arg in "$@" if [ "$arg" == "-s" ] || [ "$arg" == "-s" ] { i=$((i++)) myarg=$i # gets used later in script continue } elif [ "$arg" == "-p" ] || [ "$arg" == "-p" ] { i=$((i++)) myarg2=$i # gets used later in script continue } else { echo "illegal option: $arg" } done stuff } fi how can detect switch , use next arg argument of switch regardless of amount of switches? you can use "shift" remove first parameter.. instance: arg1=$1; shift arg2=$1

json - Shopify - SSL API CALLS do not work from http:// -

i try ajax-magic on landing-page of shopify-shop using shopify ajax api. calling shopify ajax api have use ssl, doing this: $.getjson("https://api-key:password@mydomain.myshopify.com/admin/products.json?collection_id=9947999";, function(data) {... that means i'm coming http ( http://mydomain.net ) using https ( https://api-key:password@mydomain.myshopify.com ) in ajax-call, not work. any ideas? hi tobi, this bad idea. should not revealing api-key & password, doing here. let malicious mess aspects of shop. one option might work set script on server control hit shop using jsonp. you can find info on api offer ajax here: http://wiki.shopify.com/ajax_api

java - how to return value in anonymous pl sql using eclipselink -

i need guidance on how retrieve value of variable in plsql anonymous using eclipselink. below leave sample query. know use functions , stored procedures, there restrictions on database. datareadquery query = new datareadquery(); sqlcall sqlcall = new sqlcall(); stringbuilder plsql = new stringbuilder(); plsql.append("declare "); plsql.append("\n"); plsql.append("out_variable "); plsql.append("foo.bar"); plsql.append("."); plsql.append("number_field"); plsql.append("%type;"); plsql.append("\n"); plsql.append("begin "); plsql.append("\n"); plsql.append("update "); plsql.append("number_field"); plsql.append(" set number_field = (number_field+1)"); plsql.append(" "); plsql.append(" key_field = "); plsql.append(key); plsql.append(" "); plsql.append(" returning "); plsql.append(" number_field "); plsql.appe...

How can I strip a subdomain if it is "www" in a Rails 3.2 application? -

i have rails 3.2 application driven subdomains: company1.myapp.com companyn.myapp.com some people trying this: www.companyn.myapp.com which yields error. how can strip out leading subdomain if it's www? i have in app controller: def redirect_to_subdomain_page subdomain = request.subdomain subdomain = "xyz" if subdomain.blank? or subdomain=="www" render "#{subdomain}_#{params[:action]}" end but if go www.companyn.myapp.com want redirect them companyn.myapp.com . want redirect them actual url changes. request.subdomains should return array of subdomains like: def redirect_to_subdomain_page subdomains = request.subdomains if subdomains.length <= 1 subdomain = subdomains.first subdomain = "xyz" if subdomain.blank? or subdomain=="www" render "#{subdomain}_#{params[:action]}" else redirect_to "http://companyn.myapp.com/#{request.fullpath}" end end

css - how to make my unsorted list fit into the div? -

Image
you can see problem here: here can see css-file: ` / logo's / #logo { width: 15%; float: left; margin: auto; } #logo li{ list-style-type: none; }` on picture can see happens unsorted list. and html part: ` <ul id="logo"> <li><img src="ar.png" alt="alfa romeo logo" /></li> <li><img src="lg.png" alt="lamborghini logo" /></li> <li><img src="ferrari.png" alt="ferrari logo" /></li> <li><img src="ms.png" alt="maserati logo" /></li> </ul> <div id="tekst"> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. ut eu mollis velit. vestibulum porttitor eros @ ve...

ruby - Setting filepaths inside your .rb file when converted into an exe with ocra -

i've had lot of trouble getting 1 wxruby scripts use image file included in exe ocra. if didn't have original image file in same directory exe, exe wouldn't find image. shape = file.join('warning3.png' ) i wanted script find image included in exe. in ocra documentation mentions dir.chdir file.dirname($0) didn't meant when mentioned. if need use image file in script can make sure works merely having dir.chdir(file.dirname($0)) line before try use of images. for example in app i'm using image file , couldn't exe work if wasn't in same dir file below works anywhere far. dir.chdir(file.dirname($0)) shape = file.join('warning3.png' ) i think sets script's current directory exe's directory inside it? if i'm wrong please let me know!

javascript - Pagination with AngularJS or JS on object string or array -

i'm struggling implement pagination on developer's existing code. i've tried implementing of solutions explained in previous post: pagination on list using ng-repeat the code takes two-dimensional array, parses through converting object of strings, , displays on page. each object key used column. not sure how utilize angular's builtin limit filter setup. i think ideal solution. i'm open js solution well. (i've started out js solution below towards bottom of post.) var data = [["c1","blah","yup","halted","bacon", "blue"], ["c2","blank","everything","nothing test"], ["c3","test","vista","xp, 7 "], ["c4","true"], ["c5","do","something else long text", "and more"] ] $rootscope.resultsobject = parseresu...

css - Combine browser selectors with LESS -

is possible combine -webkit, -moz, -o, , -ms selectors 1 less? i tried doing .transition(@t @d) { transition:@t @d; -webkit-transition:@t @d; -moz-transition:@t @d; } but broke css file. i want able type .transition(whattotransition duration) and have apply selectors. you try putting comma between arguments. .transition(@t, @d) { -moz-transition: @t @d @e; -webkit-transition: @t @d @e; transition: @t @d @e; } and add argument ease , default values arguments, this: .transition(@t: all, @d: 1s, @e: linear) { -moz-transition: @t @d @e; -webkit-transition: @t @d @e; -o-transition: @t @d @e; -ms-transition: @t @d @e; transition: @t @d @e; } i hope want. , reorder vendor prefixed properties, put non-prefixed property @ end, , example add o ms , shown above. so example. less: .test { .transition(all, 0.5s, ease-in); } will return css: .test { -webkit-transition: 0.5s ease-in; -moz-transition: 0.5...

sql - TSQL returning the first record -

i have sql server 2008 table following data (small sample) id date value 20448d6f-4099-408d-85fe-11ec6690cdb8 2010-06-01 1 20448d6f-4099-408d-85fe-11ec6690cdb8 2010-06-02 2 20448d6f-4099-408d-85fe-11ec6690cdb8 2010-06-03 3 20448d6f-4099-408d-85fe-11ec6690cdb8 2010-06-04 4 20448d6f-4099-408d-85fe-11ec6690cdb8 2010-06-05 null ef595de6-ff57-4625-8254-287f49843445 2010-06-02 2 ef595de6-ff57-4625-8254-287f49843445 2010-06-03 3 ef595de6-ff57-4625-8254-287f49843445 2010-06-04 4 ef595de6-ff57-4625-8254-287f49843445 2010-06-05 null c6f459ef-1493-4864-81c2-e5b55283ef0c 2010-06-04 45 c6f459ef-1493-4864-81c2-e5b55283ef0c 2010-06-05 null i running query select * [test].[dbo].[testtable] id in ( select id [test].[dbo].[testtable] date='2010-06-05' , value null ) , date = dateadd(d, -4, '2010-06-05') which returns id ...