Posts

Showing posts from July, 2013

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - it's possible to call two methods in one soap request? -

i create simple wsdl , soap server methods. want ask if possible call 2 methods 1 soap request? ex. $server->_call(array=>('methodone','methodtwo', $args); or must send 2 soap request? message batching non-goal of soap . have send 2 requests.

visual c++ 2010 can't add resource file -

Image
i want add project resource file vs2010 won't let me. do? if use express edition, can't compile resources (may reason, why can't add them too).

c# - Paging through a list of objects and repopulating using JQuery,AJAX -

i have list of objects , create own custom control pages through list using jquery make ajax calls pager methods. i've had experience jquery need helping hand , don't want use update panels etc. scenario is.....user clicks next, c# method called using ajax, code gets relevant data , sends re-populates ui next item in list. if knows sites or please let me know! cheers louis look @ jquery pagination plugin paginate json data. and used asp.net mvc , linq sql similar sample , shown in question json objects

How to send CSS to the client using HTTP response headers? -

how send css file client using server headers? your question not descriptive, refering this article posted online. it not hard: rfc5988 describes link header, allows send <link> elements through http headers instead of including them in html. like example in article, usage similiar this : link: <some-document.html>;rel=prefetch ...which have same effect placing in html: <link href="some-document.html" rel="prefetch" when using language php , have write line of code similiar this: <?php header('link: <demo.css>;rel=stylesheet'); please note: only firefox , opera seem support header @ time of writing.

vim - How to move one word left in vi editor -

Image
i use shortcut w move cursor 1 word right, there shortcut move word left? use b move 1 word use w move forward 1 word and here cheat sheet might useful you source: http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html

html - ie7 menu display (works great on anything else) -

i'm going crazy trying figure out why following menu: http://www.olyvonproductions.gr/olympia2010/index.php not display on ie7 works great on else. the problem drop-down list cropped @ bottom div contained stops. works great said everywhere else apart form ie6 have not optimized yet. i'm posting here hoping might solution right away , save me few unpleasing hours... :) thank you

Getting a HASP key with C/C++ (Problem) -

i seem in need of (and some, mean lot). im trying make c program (or c++ if work, language not important) connect hasp usb. hasp usb drive has unique codes. purpose of hasp "secure" program, runs while hasp connected computer. first of all, let me trying work, not hacking one. using demo key development, now, although have master key. this hasp program features toolbox, should generate code in c ready copy paste , work. but, doesent work, or @ least, not copy paste. (for more information hasp, go http://www2.safenet-inc.com/google/srm/dk-hasp.asp?cid=goointl-ind&hbx_pk=hasp&hbx_ou=50&cmp=knc-googleadd&wcw=google&_kk=hasp&_kt=e9b07d11-6db3-4153-a46b-5dc95204b6a3&gclid=cjfxibrp-qucfrqv3wodbnwfpa ) unfortunately, not have kind of c or c++ coding experience, having several problems trying work out. programmed other part in director (similar flash). the code gives me making login (read, connection) hasp following: const hasp_feature_t

c++ - qt : QSqlQuery returns vector of QVariant -

i querying sqlite db using qsqlquery class : qsqlquery query("select country artist"); while (query.next()) { qstring country = query.value(0).tostring(); dosomething(country); } is there way vector of qvariants directly qsqllite class? : qsqlquery query("select country artist"); while (query.next()) { std::vector< qvariant > allfields; allfields.push_back( query.value(0) ); allfields.push_back( query.value(1) ); allfields.push_back( query.value(2) ); dosomething(allfields); } use boundvalues: qlist<qvariant> allfields = query.boundvalues().values(); p.s: wouldn't use std-containers in qt. qt-containers have major advantage - implicit sharing. suggest using qlist instead of std::vector

windows services - How to take users session screen shot using C# -

i want capture users screens connected machine. how can that? i want create windows service capture users screen. thanks laxmilal you can using windows terminal service (wts) api. need do: 1. use local system system service account. other accounts not work. 2. call wtsopenserver, using wtsenumeratesessions retrieve list of sessions 3. list of wts_session_info structures. each item there represents sessions. interested in sessions state wtsactive. 4. in loop call createprocessasuser each session identified in previous step. specify sessionid wts_session_info structure have session. name of process run favorite screen capture utility. did not use of those, quick search on internet turns few options.

c# - Sessions and storing objects -

if return object session (httpcontext.current.session) private member of objects type , modify it, e.g. rename attribute or add objects internal list member. changes persisted if on page request same object session...will updated values updated on previous page. in other words object persisted, or have re-save object session once change on every page. appreciated. thanks if actual object yes, modifying version maintained session , it's values saved. if not reference type, string, have reference actual session value modify (ie: session["key"] = value). however, caution against storing real objects in session. session works serializing , deserializing values on every single page load. more put session more work framework has perform before beginning execute page. because of how works should put values in session need across entire site. before considering putting in session ask myself following: is needed entire site or close it? is time load i

directory - Java FileDialog selecting directories: Mac OSX only? -

i read via system.setproperty("apple.awt.filedialogfordirectories", "true"); users can select directories via filedialog , filedialog evoces native file chooser, want in line above reads: apple.awt... , mean option work on mac osx? if(no) { great } else { can implement on other operating systems than? } thanks help! ps: know lot of people suggest use of jfilechooser, in case i'd prefer filedialog, except if that's impossible it feared. awt used native libs underneath. osx has feature directories only, windows not. youre change use dialog not based on awt, i.e. swing or swt. you can define interface platform specifc implementations. gives looking dialog on osx , works on other platforms. that's do.

php - Object to database with PDO, is it possible? -

i'm using pdo's fetch_class feature retrieve data database row object, it's pretty convenient, how can do opposite (object database row) ? without using serialization of course. without using orm, have create own save method. bye.

java - saving operators in arrays, error -

to give idea of want elaborate code following: enter 2 numbers: 10 7 choose operator: e.g. (+, - , * , /) what's 10 * 7? correct! int[] arr = new int[5]; system.out.println("enter 2 numbers: "); arr[1] = sc.nextint(); arr[2] = sc.nextint(); system.out.println("choose operator: "); arr[3] = sc.nextint(); int operator = arr[1]+arr[3]+arr[2]; system.out.print("what's "+operator); int svar = sc.nextint(); if (svar == operator) system.out.println("correct!"); else system.out.println("wrong - right answer "+operator); now i'm having problem running aspects within code. works fine compile each time program asks " choose operator " compiler responses following error : exception in thread "main" java.util.inputmismatchexception at java.util.scanner.throwfor(unknown source) at java.util.scanner.next(unknown source) at java.util.scanner.nextint(unknown source)

javascript frameworks prototype to jquery -

i have found following script apparently written using javascript framework prototype. event.observe(window, 'load', function() { event.observe( 'btnsubmit', 'click', purchasecd); connecttoserver(); }); function connecttoserver() { new ajax.updater( { success: 'cd count', failure: 'errors' }, 'server_side.php', { method: 'get', onsuccess: function(transport) { if (parseint(transport.responsetext)) connecttoserver(); } }); } function purchasecd() { new ajax.updater( { success: 'cd count', failure: 'errors' }, 'server_side.php', { method: 'get', parameters: { num: $('txtqty').getvalue() } }); } is here able convert script use jquery instead of prototype? don't know prorotype @ don't understand it.

regex - Shell equivalent to PHP's preg_replace() -

greetz folks. i'm looking way same stuff php's preg_replace() (search text matching regular expression , replace it) in shell script. so, consider following file. <a href="http://example.com/">website #1</a> <a href="http://example.net/">website #2</a> <a href="http://example.org/">website #3</a> and want this: http://example.com/ http://example.net/ http://example.org/ is there way this? thanks. you can use sed as: sed -r 's/.*href="([^"]*)".*/\1/' file see it

android - Multiple apps connect to bluetooth issue -

i have 2 applications w/ bluetooth code derived bluetooth chat sample. individually work fine. each app connects via spp separate devices. issue i'm having on phones android 2.1, after first app connects device, can press home , running other app, connection made other device other app, both apps "sorry! application xyz (process com.xyz) has stopped unexpectedly. force close" dialogs. there try/catch blocks throughout bt code, catches not executed. neither app connect (individually) until after bluetooth turned off on again. not happen when these same apps running on samsung tab android 2.2 - both apps can run , connect devices simultaneously fine , can switch between apps, no problems. is android 2.1 issue or else? whether or not, need way prevent app connecting if app using bluetooth. couldn't find in android apis allow finding out. there way coordinate/manage this? have specific insights whole issue? i think bug in samsung bluetooth stack

EclipseLink/JPA EntityListener: Check if entity is modified -

i'm using default entitylisteners (preupdate , prepersist) write create , update timestamps entities. when new child added collection (onetomany) , persist called parent record send entitylistener , timestamps updated. problem don't want update parent if new child record added collection. there way check if entity modified (inside entitylisterner)? andreas this might (not tested, think work). event descriptorevent got, object entity want check changes. unitofworkimpl uow = (unitofworkimpl) event.getsession(); classdescriptor descriptor = uow.getdescriptor(object); boolean isnew = uow.isobjectnew(object); if (isnew || descriptor.getobjectchangepolicy().shouldcompareexistingobjectforchange(object, uow, descriptor)) { objectchangeset changes = null; if (isnew) { changes = descriptor.getobjectchangepolicy().calculatechangesfornewobject(object, changeset, uow, descriptor, true); } else {

php - Exploding array and adding execution timestamp for each bit of data in the array? -

using curl_multi, have loaded 3 url's , printed array. 1) how can set timestamp on output let me know when each url run? 2) how can explode array display data , timestamp, excluding text "array ( [0] =>", "[1] =>", "[2] =>" , " )"? code <?php function multirequest($data, $options = array()) { // array of curl handles $curly = array(); // data returned $result = array(); // multi handle $mh = curl_multi_init(); // loop through $data , create curl handles // add them multi-handle foreach ($data $id => $d) { $curly[$id] = curl_init(); $url = (is_array($d) && !empty($d['url'])) ? $d['url'] : $d; curl_setopt($curly[$id], curlopt_url, $url); curl_setopt($curly[$id], curlopt_header, 0); curl_setopt($curly[$id], curlopt_returntransfer, 1); // post? if (is_array($d)) { if (!empty($d['post'])) { curl_setopt($c

c - The reason to use masking -

gcc 4.4.1 c89 i using api our previous programmer has produced. however, bit confused why masking in why. what reason or hex mask. , reason have ipev_error_mask or'ed ipev_start. why not have hex values? #define ipev_mask 0x9000 #define ipev_error_mask (ipev_mask | 0x0800) #define ipev_open (ipev_mask | 0x01) #define ipev_start (ipev_mask | 0x02) #define ipev_media_fail (ipev_error_mask | ipev_start) many suggestions, not sure part unclear you, i'll explain everything. first of all, they're bit flags. bit flags way of storing lot of boolean values inside single number. instance, typical 32-bit integer can store 32 boolean values. has dual advantages of being compact in memory, , being able pass around several values @ once. drawback is, of course, access single value have mess around bitwise operators. approach typically not used when dealing boolean values in code, used when storing values or passing

xml - Variable not taking on values in C# -

i have following problem - rec = new record(name, age, dob, sex, country ); webservicename.function[] test = new webservicename.function[1]; test[0].name = rec.name; test[i].age = rec.age; test[i].dob = dob; test[i].sex = sex; test[i].country = country; when start debugging stops on first test[0] line 'nullreferenceexception uhandled' message. when hover mouse on rec.account shows value csv file have read from, when hover on test[0] value null. reason variable array not taking on values, how can sort this? thanks time. try this: rec = new record(name, age, dob, sex, country ); webservicename.singlesummary[] test = new webservicename.singlesummary[1]; webservicename.singlesummary result = new webservicename.singlesummary(); result.account = rec.name; result.actualy = rec.age; result.commitment = dob; result.costcentre = sex; result.internalcostcentre = country; test[0] = result;

ssms - sql server management studio code completion -

i've noticed whenever add tables / stored procs / functions / whatever sql server database, takes while code completion pick part of database. this annoying since code completion , syntax highlighting become totally broken in workflow scenario create table , start writing queries or whatever deal new object. does know how code completion / syntax highlighting engine update it's view of in database rid of these spurious invalid object name errors? i understand it's late answer question maybe someone. you can refresh intellisense cache ctrl+shift+r , , wait 5-10 seconds.

jquery slow when using children() with rows -

recently asked question on regarding changing row background color on click , hover using jquery. below link it, , implemented solution marked answer. problem when having lot of rows, hover click takes lot of time. using ie8 latest version of jquery. below link question jquery row hover , click events here code implemented: http://jsfiddle.net/epurh/ if hover , click, working , fast less rows, if there lot of rows/columns, gets slow , throws error if want stop script. when compare same in firefox, fast. have problem in ie8. can 1 suggest workaround this? in click handler, add class <tr> clicked when comes time remove class on .children() , can target specific row. $(".simplehighlight").click(function() { $(this).addclass('wasclicked').children().addclass('clicked'); // sibling <tr> class "wasclicked" // , remove class, , "clicked" class children $(this).siblin

sqlite - Persist login/Authentication info on Android? -

what best way persist users info in android app? have login screen uses web service authenticate user , return basic user info. i don't care saving username/password, need things couple of integer id fields (patientid , personid) , first , last name. i don't want user have login every time load app. suggested use sql lite store info, best way or there more light weight solution? use sharedpreferences refer link also

What's the benefit of Scala (singleton) object vs. typical class level artifacts -

i understand 1 of main benefits using object is, real objects instead of system wide functionality. objects system wide accessible. beside of being more "pure" additional benefit scala "objects" offer. i bet there number can't figure out which. objects independent entities, e.g. can used method arguments, target implicit conversions, , case objects in pattern matching... objects can inherit classes or traits an object has own type objects can restrict access of members, companion class: . object x { private[this] val z=1 } class x { import x._ //won't compile println(z) }

String manipulation in C#. Inserting "+" between words -

this far have got. thinking stuff string array, format , recast string. //input search term console.writeline("what search query?:"); string searchterm = console.readline(); //stuff search term array split out string separator = " "; //assumes search terms separated spaces string[] searchtermarray = searchterm.split(separator.tochararray()); //construct search term string searchtermformat = ""; (int = 0; < searchtermarray.length; i++) { searchtermformat += searchtermarray[i] + "+"; //console.writeline(searchtermformat); } desired output word1+word2+word3 where number of words not fixed. you're looking string.join("+", searchtermarray) you're trying write searchterm.replace(' ', '+') you should writing uri.escapedatastring(searchterm)

c# - How to manage multiple calls to Membership.GetUser() efficiently -

i have multiple calls membership.getuser() , can't seem find built in cope (without hitting database multiple times). i first looked static variables before realising not suitable. know can use sessions need hash/encrypt userid make safe, fine didn't want without checking if there built in way within .net membership provider is there built in way of remembering value userid , safely storing current user? membership.getuser() indirect call class membershipprovider's method: public abstract membershipuser getuser(string username, bool userisonline); so, can write class derives membershipprovider you're using (for example sqlmembershipprovider or activedirectorymembershipprovider, or custom one) , override method using clever cache mechanism. then need change web.config declare new membershipprovider class: <membership defaultprovider="myprovider"> <providers> <clear/> <add name="myprovider&qu

c# - Could you please suggest better design? -

following scenario. i have called domain can have multiple states (statekey-statevalue pair) in it. the same statekey can present in multiple domains different statevalue. e.g. statekey named 'economiccapital' may present in domains 'england', 'america' values 'london', 'washington' respectively. classes corresponding these in common library can consumed @ client or service side required. i have winform application in can select specific domain. in string, wherever encounter statekey, want replace statevalue selected domain. i can think of following designs: establish composition relationship. domain can composed of states. when want statevalue of statekey, can object of required domain , can extract statekey states collection composed in it. but there can large number of instances statekey used, not think approach quite snce requires finding domain object collection of domains , iterating through state collection find parti

Kohana 3 OpenID -

i'm in need implement openid authentication in kohana 3 application. searching , found http://code.google.com/p/kohanamodules/wiki/openid#whb 2.x versions of kohana , can't used in 3.x. there implementations? read article ( demo app ). , here controller source.

jquery - Redirect on success and show error on failure -

i have implemented controller create new users. when creates user redirects index() . what want get redirected when ok, stay in current page , see error when failed. i'm using jquery ajax mvc . my controller looks this: [authorize] public actionresult createuser(string username) { try { //here logic create user } catch (exception ex) { string error = string.format("error creating user: {0}", ex.message); response.statuscode = 500; response.write(error); } return redirecttoaction("index"); } the form submit intercepted jquery, , call made ajax: $("#new-user-form").submit(function() { var form = $(this); $.ajax({ type: "get", url: form.attr('action'), data: form.serialize(), success: function(data, textstatus, xhr) { //at point redirect }, error: function(xhr, textstatus, errorthrown) {

iOS - Reload UIView when tab icon clicked? -

i have application uses uitabbarcontroller, , inside each tab have navigation controllers. make 1 of views reload after action happens in view, when user goes view - it's updated. possible? thanks bunch! the simplest way accomplish put loading code viewwillappear: instead of viewdidload . while viewdidload may called once, when view initialized, viewwillappear: called time view controller presented, whether in tab bar, in navigation controller, etc., gives nice hook implement loading , layout functionality.

Automatic code testing in c upon execution -

each source file has function: unsigned char test(){ //return true if tests succceed false otherwise } everytime sourcefile gets recompiled want test function of file run on execution of executable , if tests return false halt. however, want code test code hasnt been run since build. i thinking use makefile system problem since makefiles recompile changed code want. therefore, thinking of adding command line arguments. saw example in used echo , date add time last modified. code write time last modified save file on successful execution of test code compare next time. is there better way? 1 doesnt rely on make? @ least there way without relying on spefic unix commands? lastly, if isnt possible, command line addition file like. yes, make file.t target dependant on file.c. file.t generated based on successful completion of test. it'll easier if call test function "main" , wrap in #ifdef's this: #ifdef test int main() { if (test_someth

xaml - WP7 Get visible items in listbox -

i have listbox in wp7 application , retrieve list of visible items in listbox. actually, trying retrieve object visible when application tombstoned, can resume , write listbox.scrollintoview(lastvisibleitem); if matters, listbox bound collection of custom objects datatemplate customizing way looks. thanks in advance. it's possible work out how far list has been scrolled using technique detailed in this answer . you calculate item(s) displayed based on size of list , height of items displayed. if different items can diffferent sizes becomes more difficult need consider height of each individual item. you need remember part of item may displayed.

Lock a Text File in Perl -

possible duplicate: how lock file in perl? does know how lock text file in perl 1 thing can write until unlocked? need other setting read/write attributes. thanks. take @ flock .

queue - Jquery - fadeIn - jerky fadein -

i've made simple image switcher fades different logos in , out. example , full source code @ http://bit.ly/ewrsgp . fadeout image, queue src attribute change, fade in. seems work smoothly while after 20 seconds or starts fade image in before changing src, changes instantly , looks ugly. doing right? the code runs change is: // fadeout old image, change new , fadeback in. // call function changeimage again. $(imtochange).fadeout(600).queue(function (n) { jquery(this).attr('src', newimagesrc); n(); }).fadein(1000, function () { settimeout(function () { //recall image change function changeimage(indextochange); }, o.delay); }); thanks in advance. i saw flickers, not many. noticed happened on particular logo, think first time saw it, not next time, makes me think once it's loaded, it's fine. thoughts: does happen if images local (and hence load quickly)? have tried preloading images ? if preloading works, think p

Getting list of network devices inside the Linux kernel -

i've been looking through net/core/dev.c , other files try find out how list of network devices configured , it's proving little difficult find. the end goal able network device statistics using dev_get_stats in dev.c, need know current interfaces can grab net_device struct pass in. i'm having inside kernel i'm writing module adds in new /proc/ entry relates statistics current network devices can gather must done inside kernel. if point me how interfaces appreciated. this ought trick: #include <linux/netdevice.h> struct net_device *dev; read_lock(&dev_base_lock); dev = first_net_device(&init_net); while (dev) { printk(kern_info "found [%s]\n", dev->name); dev = next_net_device(dev); } read_unlock(&dev_base_lock);

multithreading - Looking for some Java good practice advice regarding distributed applications and message passing -

some background information. distributed application multiples nodes. 'communication' thread sends , receives messages sent between these nodes. cannot changed. a 'dostuff' thread asks 'communication' thread send message node. needs wait response other node. 'communication' thread receive response message. needs deliver message correct 'dostuff' thread. i unsure sort of information needs stored @ node or within message ensure correct thread receives response message. looking advice upon how achieve this. reading :) you want attach sort of message id outgoing message included in response. sequential number or uuid job. communicator thread can keep track (a map?) of "dostuff" thread waiting given response , pass back. you keep track of when request sent if response isn't received communicator thread can notify dostuff thread response wasn't received.

What exactly are parameters in javascript (or any programming language for that matter) -

i have piece of code i've written , read in order work correctly must use parameters did , works perfectly, cant figure out life of me parameters , how work. read through ton of articles on web couldn't figure out how parameters work. how 1 parameter know grab instructions another. whole idea frustrating. kind of side question. can getelementby class instead of id or there similar getelementbyid() classes? in advance. below code in script.js file: function setvalue(field) { if(''!=field.defaultvalue) { if(field.value==field.defaultvalue) { field.value=''; } else if(''==field.value) { field.value=field.defaultvalue; } } } and called script run code below: <textarea id="info" class="textarea" name="comment" cols="40" rows="10" onfocus="setvalue(this)"

visual studio 2008 - Radio groups in MFC -

how can group several mfc radio boxes single group? is possible bind variable (preferably integer indicating checked radio or boolean array) such group. binding mean using ddx_* . the radio buttons must adjacent in tab order. tab order editable visual studio's dialog editor (find 'tab order' menu item, ctrl-d shortcut in vs 2005). have arrange radio buttons clicking them in order. first radio button in tab group have set group property true. should select control follows group of radio buttons , set group property true too. way radio buttons form group , behave expected (check see how keyboard arrows work when of radio buttons has focus). you can bind set of radio buttons after configuring them above via ddx_radio macro. see: http://msdn.microsoft.com/en-us/library/fchz3yh5(v=vs.80).aspx

c# - How do I return a specific SOAP response from an ASP.Net site? -

an external development partner has service post soap request 1 of our services. format of request fixed (by them). we required respond soap message of fixed format (fixed them again). i have created generic handler in asp.net receives request (which parse manually , process). however, want response looks this: http/1.1 200 ok date: thu, 01 apr 2010 09:30:25 gmt server: jetty/5.1.4 (windows xp/5.1 x86 java/1.5.0_15 content-type: multipart/related; boundary=soaptestserver; type="text/xml"; start="<theenvelope>" soapaction: "" content-length: 796 connection: close --soaptestserver content-id: <theenvelope> content-transfer-encoding: 8bit content-type: text/xml; charset=utf-8 content-length: 442 <?xml version="1.0" encoding="utf-8"?><soap-env:envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/xmlschema" xmlns:xsi="http://www.w3.or

How do I modify my simple Python code, to take into account HTTP headers? -

def urlrequest(url, params, method="post"): r = urllib2.urlopen(url, data=urllib.urlencode(params)) return r in method, send post request url. if want headers well? want send dictionary of additional headers (in addition standard headers). def urlpost(url, params, method="post", headers = {}): req = urllib2.request(url) k, v in headers.items(): req.add_header(k, v) r = urllib2.urlopen(req, data=urllib.urlencode(params)) return r

java - Apache AXIS2 sending large DIME attachments -

i working on webservice send large pdf files server client using dime. using apache axis2 implementation webservice support. have been service work issue arises when attempt send attachments larger 1mb exception. guess have chunksize attachment before sending have no idea can control , thinking maybe another. below code client uploading files public class pdfdriver { /** * @param args * @throws ioexception */ public static void main(string[] args) throws ioexception { // todo auto-generated method stub testaddgroup(); } public static void testaddgroup() throws ioexception { try { pdfmail_servicelocator locator = new pdfmail_servicelocator(); locator.setpdfmailsoapendpointaddress("http://localhost:80/services/pdfmailsoap"); pdfmail_porttype stub = locator.getpdfmailsoap(); pdfmailsoapstub server = null; server = (pdfmailsoapstub) stub; //test uploading pdf server._setproperty(call.atta

Devise after_create in overrided RegistrationsController, Rails 3 -

i need call after_create :something inside overrided devise class registrationscontroller. this: class registrationscontroller < devise::registrationscontroller after_create :something end but does't work: undefined method `after_create' registrationscontroller:class what's wrong? after_create activerecord hook, not controller hook. maybe you're looking after_filter ?

c# - Send Username and Password to .net Web Service using Spring .NET -

i developing .net application using web services, , application consuming them using spring.net webserviceproxyfactory. i need send web service username , password of user logged in application, consuming web service. reading forum post (like http://forum.springframework.net/showthread.php?t=4818 ) seem refer example used in spring documentation ( http://www.springframework.net/doc-latest/reference/html/webservices.html ), example of how using soap headers authentication using webserviceexporter , webserviceproxyfactory, link file broken. do know way can send user credentials soap header using spring.net? or data (for example, token id web service use later user credentials). thanks. here might you http://www.codeproject.com/kb/webservices/soapheaderauthentication.aspx

javascript - Jquery: Is there some way to make val() return an empty string instead of 'undefined' for an empty list? -

with jquery, there way make val() return empty string instead of 'undefined' when called against empty list of elements? e.g., have code: var x = $('#my-textbox-id').not('.watermark').val(); the idea want value of textbox, want empty string if showing watermark (i don't want watermark value!). the selector works, don't want 'undefined' - want empty string ''. you can write (...).val() || "" . only use text fields; replace false or number 0 "" .

asp.net - When `HttpGet` handling `Create` action method just returns `View()`, why doesn't the javascript validation get triggered on the browser? -

when httpget handling create action method returns view() , causes form fields uninitialized. why javascript validation not triggered when users views blank form? i don't know inner workings, i'll give guess ;-) first of all, has nothing whether or not [httpget] or [httppost] -- that's way works. your average [httpget] methods this: [httpget] public actionresult index() { // data database return view(data); } there aren't parameters in method, because want user hit controller when type in url (i.e. home/index ). your usual [httppost] method might this: [httppost] public actionresult create(mymodel mymodel) { if (modelstate.isvalid) { // stuff } else { return view(mymodel); } } i believe validation attributes aren't triggered until bind form values model , hit create(...) controller. if [httpget] happened take in model parameter, validation triggered @ point well. when return view

C# - using List<T>.Find() with custom objects -

i'm trying use list<t> custom class of mine, , being able use methods contains() , find() , etc., on list. thought i'd have overload operator == apparently, 1 way of doing use delegate method find() ... note: right now, i've overloaded equals() method contains() method work, still couldn't find() function work. what best way of getting both work? i'm using latest c# /.net framework version mono, on linux. edit: here's code using system; namespace guerredesclans { public class reponse : iequatable<reponse> { public reponse () { m_statement = string.empty; m_pointage = 0; } public reponse (string statement, int pointage) { m_pointage = pointage; m_statement = statement; } /* * attributs privés */ private string m_statement; private int m_pointage; /* * properties */ public string statement { { return m_statement; } s

prolog - Instantiate type variable in Haskell -

edit: solved. unware enabling language extension in source file did not enable language extension in ghci. solution :set flexiblecontexts in ghci. i discovered type declarations in classes , instances in haskell horn clauses. encoded arithmetic operations the art of prolog , chapter 3, haskell. instance: fac(0,s(0)). fac(s(n),f) :- fac(n,x), mult(s(n),x,f). class fac x y | x -> y instance fac z (s z) instance (fac n x, mult (s n) x f) => fac (s n) f pow(s(x),0,0) :- nat(x). pow(0,s(x),s(0)) :- nat(x). pow(s(n),x,y) :- pow(n,x,z), mult(z,x,y). class pow x y z | x y -> z instance (n n) => pow (s n) z z instance (n n) => pow z (s n) (s z) instance (pow n x z, mult z x y) => pow (s n) x y in prolog, values instantiated (logic) variable in proof. however, don't understand how instantiate type variables in haskell. is, don't understand haskell equivalent of prolog query ?-f(x1,x2,...,xn) is. assume that :t undefined :: (f x1 x2 ... xn) => x

How to list network interfaces, its configuration IP,netmask and gateway in Python/Windows -

i wanna develop small application monitor arp , scan arp list in local network. currently, need retrieve list of network interfaces , configuration. most of time work linux, don't know win32 api, there anyway in python way ? i'm using python 2.6 pyqt , scapy (has pywin32 aswell, if provide detail way win32, try) i found pcapy.findalldevs(), cannot retrive configuration. don't care name, configuration(ip,netmask) ok. not sure info want, ipconfig /all sounds want: import subprocess subprocess.call('ipconfig /all')

structuremap - What's the simplest way to intercept a method call for added functionality? -

suppose have repository returns list of post s. repository interface has getall() method suggests. now in keeping theory shouldn't putting domain logic in repository, want intercept calls concrete getall() method such can add following logic getall() result: return getall().orderbydescending(p => p.posted).tolist(); the reason want intercept because (1) don't want have client remember call extension method ( orderbydescending or useless wrapper of that), want called every time , (2) don't want have concrete implementations have remember order getall() result - want logic in single place external repository. what's easiest way this? i'm using structuremap if can intercept might low cost option. don't think sm intercepts method calls, creation of object instance? do need go proxy or mixin pattern? need go all-in castle dynamic proxy ? or there another method should consider or perhaps combination? i'm interested in concrete suggest

cocoa - iOs like NSScroller -

i looking ios nsscroller - track appear when scrolling - inertia support - same , feel. do know if exists? thanks , regards, not i'm aware of. have subclass nsscrollview in addition nsscroller. subclassing nsscroller allow produce , feel of scrollbar visible during scrolling. the inertial scrolling have built nsscrollview itself, although know mac's using trackpad , have option turn on inertial scrolling in system preferences.

tsql - Finding complete SQL text running behind locked processes in SQL Server -

how can identify sql locking table @ time of transition, want see , analyze full sql text. dbcc inputbuffer (pid); not displaying complete sql text. if know spid, can use this: select text sys.dm_exec_requests cross apply ::fn_get_sql(sql_handle) session_id=@spid here's msdn reference fn_get_sql

text - How to write this kind of documentation easily? -

i love pure ascii text documentation, one: http://www.catonmat.net/download/sed.stream.editor.cheat.sheet.txt but don't know how write easily. there lots of tables in it. can explain please? thanks. try emacs table mode: http://www.emacswiki.org/emacs/tablemode (http://table.sourceforge.net)

Bing Maps APIs and Microsoft.Phone.Controls.Maps ambiguous Reference -

i facing weird issue. dont know whether issue or not. appreciated. i developing map application. had working code. trying integrate project. when add service reference bing route , geocode service following issues. the references.cs file automatically generated contains new project public partial class requestbase : object, system.componentmodel.inotifypropertychanged { private tourguideapp.bing.route.credentials credentialsfield; while previous working project public partial class requestbase : object, system.componentmodel.inotifypropertychanged { private microsoft.phone.controls.maps.credentials credentialsfield; the same happening location field have new field location in bing route service not present in earlier project [system.diagnostics.debuggerstepthroughattribute()] [system.codedom.compiler.generatedcodeattribute("system.runtime.serialization", "4.0.0.0")] [system.runtime.serialization.datacontractattribute(name="locatio

javascript - Select first word of every line (CSS/JS/Whatever) -

i'm trying select each first word, wrap in specific span. lorem ipsum dolor sit amet, consectetur adipiscing elit. cras sagittis nunc non nisi venenatis auctor. aliquam consectetur pretium sapien, eget congue purus egestas nec. maecenas sed purus ut turpis varius dictum. praesent nunc ipsum, id mattis odio. donec rhoncus posuere bibendum. fusce nulla elit , laoreet non posuere. if text, script should select lorem, aliquam, varius , elit thanks in advance you can this, using javascript wrap every word in paragraph in own span, , walking through spans finding out actual position on page is, , applying style changes spans y position greater preceding span. (best beginning-to-end, though, earlier ones may affect wrapping of latter ones.) it's going lot of work browser, , you'll have repeat each time window resized, effect have worth cost. something (used jquery you've listed jquery tag on question , makes code lot simpler):

php - Remove row from database if image not on server -

i have mysql database table in following format: id: 1 date: 2010-12-19 image: 5d61240f-7aca-d34b-19-12-10-15-36.jpg caption: merry xmas i want create php script checks through each row in table , checks image present in gallery folder on server. if image not in gallery folder want delete row database. pointers on how go doing appreciated. thanks! try <?php define ("gallery_root", "/path/to/gallery/" ); $mysqli = new mysqli ($host, $username, $password, $db); $result = $mysqli -> query (" select id, image table "); if ( $result ){ while ($row = $result->fetch_assoc()) { if ( !is_file (gallery_root . $row['image'] ) ){ $mysqli -> query (" delete table id = '" . $row['id'] . "'

c# - Will an inner transaction scope roll back if the outer transaction scope doesn't complete? -

i have 2 transaction scopes, 1 within another. love know if inner transaction scope rolled after has been committed , outer 1 not complete. since nested, inner transaction roll back. this not whole story, , depends on how create nested transaction, default, roll back. this article goes depth transactionscope , should answer of questions. being distributed or not irrelevant.

javascript - Are there any drawbacks to using head.js? -

things aware of: screen flicker if scripts alter styles / content (not issue me load scripts @ end of page , have workarounds already) inability detect script load failure (not too concerned either develop required work or without javascript. might affect workarounds item 1 happy risk) it looks option me hoping references (feel free positive things!) before invest time in incorporating next project. currently develop mid-to-large sized sites with, generally, moderate amount of javascript (although growing rapidly). use jquery library bulk of our javascript. anyone have experience? or bad! :) p.s. interested this head.js nope. long put code dependent on loading files inside head.ready {} not face problems code.

javascript - Using eval in Firefox preferences -

i' change value of dom element according user-defined specification. let's want multiply 100. specification should defined in ff preferences. the path of least resistance seems to take value of element , 'action: "*100"' in preferences , use eval value. however, eval evil , believe not safe (someone replace '*100' function etc.). so, can think of way avoid using eval , still read format preferences somehow?

objective c - casting to (id<protocol>) to guarantee a property is there -

if have number of classes like @property (nonatomic, retain) nsstring* mystring; and want access property in object 1 of these classes (but don't know type id), "request member 'mystring' in not structure or union" error. so if each of these classes conforms : @protocol myprotocol <nsobject> @required @property (nonatomic, retain) nsstring* mystring; @end then cast property: (id<myprotocol>)anobject.mystring why doesn't work? still same error. in case prefer messages-sending notation on dot-notation, shows clearly, when cast happen: these lines equal: [(id<myprotocol>)anobject mystring] ((id<myprotocol>)anobject).mystring and these are: (id<myprotocol>)[anobject mystring] (id<myprotocol>)anobject.mystring

How to add an on click event in server side for an Image control in C#/ASP.NET -

i have added image toolbox in vs2008, , noticed there isn't onclick event in server side. how add 1 on? image control display image on web page. there no onlick event in image control. asp:imagebutton control handles mouse clicks on images .

Implementing Disjoint Sets (Union Find) in C++ -

i trying implement disjoint sets use in kruskal's algorithm, having trouble understanding how should done , in particular, how manage forest of trees. after reading wikipedia description of disjoint sets , after reading description in introduction algorithms (cormen et al) have come following: class disjointset { public: class node { public: int data; int rank; node* parent; node() : data(0), rank(0), parent(this) { } // constructor makeset }; node* find(node*); node* merge(node*, node*); // union }; disjointset::node* disjointset::find(disjointset::node* n) { if (n != n->parent) { n->parent = find(n->parent); } return n->parent; } disjointset::node* disjointset::merge(disjointset::node* x,

URL Rewrite in .htaccess? -

i want use url rewriting in link , apply website it's not work why? , can if want using url rewriting?? the link http://www.example.com/showpage/php?page_id = 98 , want http://www.example.com/showpage/98 i test in local not work , test online in domain not work. if tools must run in domain <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^showpage/$ showpage.php?page_id=$1 </ifmodule> $1 not defined pattern. try this: rewriterule ^showpage/(.*)$ showpage.php?page_id=$1

mysql lookup table schema -

what's more detailed command seeing table properties show tables ? in particular, need know storage engines being used in database i've inherited. you query information_schema tables directly. select `table_name`, `engine` `information_schema`.`tables` `table_schema` = 'your_db' order `table_name` asc

iphone - in App purchase showing "Environment Sandbox" even after status changed to "ready for sale" -

my iphone application , in app purchase status become "ready sale" yesterday. when running in app purchase , getting "[environment sandbox]" in "do want buy .... push notifications" .how can change in app purchase test environment ? your app getting "resigned" different certificate when gets processed appstore won't use sandbox after user downloads appstore.

command line interface - PHP cli session warnings -

is there possibility disable session warnings being displayed when php cli script run? without modyfing php.ini of course. need have clean output of script. script not run apache or root. in php.ini there session.auto_start enabled. i've got following errors: php warning: unknown: open(/var/lib/php/session/sess_p6tpcdkpupelvho22qrkm699g4, o_rdwr) failed: permission denied (13) in unknown on line 0 php warning: unknown: open(/var/lib/php/session/sess_p6tpcdkpupelvho22qrkm699g4, o_rdwr) failed: permission denied (13) in unknown on line 0 thanks in advance! quite simple, don't try open session in cli mode. won't work multiple reasons. so, 2 things (depending on how "dirty" of hack wanted): if (!isset($argc)) { //not cli session_start(); } or, set session path writable (like /tmp ) if via cli: if (isset($argc)) { session_save_path('/tmp'); } but i'd suggest not suppressing errors ( error_reporting(0) ) because mak

stl - HowTo sort std::map? -

here map: typedef std::map<int/*security id*/, positionmonth> portfoliomonth; where positionmonth structure, ex.: struct positionmonth { nav::shares shares_; nav::amount market_value_; positionmonth(void) {} positionmonth(const nav::amount& market_value , const nav::shares& shares) : market_value_(market_value) , shares_(shares) {} }; question : how sort std::map second value key param (by market_value_ , let int)? examples or links? ps. boost methods not interested! pps. i'm unable initialise std::map compare functor! thanks help! my solution (or how did myself): template<class t> struct lesssecondccy : std::binary_function<t,t,bool> { inline bool operator ()(const t& _left, const t& _right) { return _left.second.market_value_.curre

jquery - Store ajax responses in queue -

i have created application in php , jquery of display locations on google map. there few images in divs after clicking on there 3 ajax requests called in following order 1: display video youtube 2: display description database. 3: display locations on map. after clicking on images in div, result displayed in following order. 1: display description database. (it displayed within 1 sec) 2: display locations on map. (it displayed within 2 sec) 3: display video youtube. (it displayed within 2 sec 3 sec) as map , youtube video not located on local server, taking time display. there way display above 3 output when data receive servers?

Android: google maps deactivate overlays -

i'm new android development , have question regarding overlays in googlemaps api. what i'm trying achieve class adds 1 , 1 marker @ position tap, want overlay active when button "add marker" pressed. i've solved problem in 2 different ways , i'm not satisfied either 1 of them. my solutions follows: first attempt: bool turns true when "add button" pressed, able put marker on map , boolean value turns false. this feels quite ugly , overlay active , listens every tap on display, maybe is't dumb believe. second attempt: temporary creates overlay creates marker , removes self. this solution can't find efficient... creating new overlay before creating new marker. is there way activate overlay when "add button" pressed? maybe there other way this? is there way activate overlay when "add button" pressed? don't add overlays list until add button pressed.

Overriding the Defaults in a struct (c#) -

is possible set or override default state structure? as example have an enum something{a,b,c,d,e}; and structure links 2 values enum struct somethingdata { type; int value; double multipler; somethingdata(something enumval, int intval, double dblval) {...} } but can specify default state is somethingdata(something.c,0,1); struct constructors similar class constructors, except following differences: structs cannot contain explicit parameterless constructors. struct members automatically initialized default values. struct cannot have initializer in form: base (argument-list). http://msdn.microsoft.com/en-us/library/aa288208(v=vs.71).aspx so, short answer, no can't override default constructor (every struct has parameterless constructor , can't hide or override it)...