Posts

Showing posts from April, 2012

About the use of IncludeAction in struts -

i trying use include action class in struts, not able do....the steps did follows step 1 : first created presentation page, is welcome.jsp <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <html> <head> <title>include example</title> </head> <body> <div align="center"> <bean:include id="bid" forward="logins" /> </div> </body> </html> step2: created servlet class, passed msg in client page showservlet.java package com.ashish.struts.servlet; import java.io.ioexception; import javax.servlet.requestdispatcher; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import com.ashish.struts.loginform; public class showservlet extends httpservlet { private static ...

c++ - Serialize derived classes with boost -

i have 3 classes defined as: class base { public: int myvar1; int myvar2; ... }; class base2 : base { public: base2(...) : base(...) { } }; template<typename t> class derived { public: derived(...) : base2(...) { } }; i need serialize base class including derived classes boost send via sockets. how can it? edit 1 std::auto_ptr<base2>(new derived(...))

Single-file, persistent, sorted key-value store for Java (alternative to Berkeley DB) -

berkeley db (je) licensing may deal killer. have java application going small set of customers desktop application, price cannot support individual instance licensing. is there recommended java alternative berkeley db? commercial or otherwise (good key-value store implementations can non-trivial, prefer defer maintenance elsewhere). need more hash store i'll need iterate through subsequent key subsets , basic hash stores o(m*n) search , expect store ~50-60gib on desktop machine. added benefit can recommend keeps backing store in single file ? you should try jdbm2 , want: disk backed hashmaps/treemaps can iterate through keys. apache 2 license in addition: fast, small footprint transactional standalone jar have 145 kb. simple usage scales 1e9 records uses java serialization, no orm mapping update the project has evolved mapdb http://www.mapdb.org

Binding a Textbox to a property in WPF -

i have textbox in user control i'm trying update main application when set textbox.text property doesnt display new value (even though textbos.text contains correct data). trying bind text box property around dont know how, here code - mainwindow.xaml.cs outputpanel.text = outputtext; outputpanel.xaml <textbox x:name="textbox" acceptsreturn="true" scrollviewer.verticalscrollbarvisibility="visible" text="{binding <!--?????--> }"/> <!-- want bind text propert in outputpanel.xmal.cs --> outputpanel.xaml.cs namespace controls { public partial class outputpanel : usercontrol { private string text; public textbox textbox { {return textbox;} } public string text { { return text; } set { text = value; } } public outputpanel() { initializecomponent(); text = "te...

Drupal Views - Custom / Modded SQL -

i having issue "profile checkboxes" module stores custom profile fields comma separated. the issue if create view filter value. sql result ends being this: ...and (profile_values_profile_interests.value in ('business , investment'))... which not return data since value stored this: "business , investment, case law, labor law, tax law" i need adjust sql making sure field contains selected value is there can adjust this? for 'quick hack' solution, try implementing hook_views_query_alter(&$view, &$query) in custom module, check $view->name (and $view->current_display) ensure dealing right view/display, , manipulate $query needed. edit: looks underlying problem has been addressed module maintainer in meantime - see john's answer ...

Scaling in Windows Azure for IO Performance -

windows azure advertises 3 types of io performance levels: extra small : low small: moderate medium , above: high so, if have io bound application (rather cpu or memory bound) , need @ least 6 cpus process work load - better io performance 12-15 smalls, 6 smalls, or 3 mediums? i'm sure varies based on applications - there easy way go testing this? there numbers give better picture of how of io performance increase move large instance roles? it seems io performance smaller roles equivalent larger ones, ones throttled down first if overall load becomes great. sound right? windows azure compute sizes offer approx. 100mbps per core. small instances lower, @ 5mbps. see this blog post more details. if you're io-bound, 6-small setup going offer far greater bandwidth 12 extra-smalls. when talk processing workload, working off queue? if so, multiple worker roles, each being small instance, each work 100mbps pipe. you'd have benchmarking determine if 3 med...

c# - UploadFile control - get data -

how data (read file) chosen in fileupload control without fileupload.saveas method on server? possible write @ once object? using fileupload.filecontent gives stream work with. see msdn . for example: void writefilelength() { if (fileupload.hasfile) { var filestream = fileupload.filecontent; var messageformat = "the file {0} bytes in length" response.write(string.format(messageformat, filestream.length)); } }

objective c - Xcode NSString in textfield -

i'm new xcode , objective-c have succeeded in creating btton , when user clicks button number displayed in textfield, can't seem find way put text in there. -(ibaction) button1pressed: (id) sender { [field1 setintvalue:36]; } -(ibaction) button1pressed: (id) sender { [field1 setstringvalue:@"some text"]; } method inherited nscontrol , documentation here: http://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/nscontrol_class/reference/reference.html#//apple_ref/occ/instm/nscontrol/setstringvalue :

php - Firebug: "invalid regular expression flag h" after running YUI Compressor -

after run yui compressor, i'm getting error: invalid regular expression flag h [break on error] ction(event){$(this).removeclass('lumi...cs_glb.php</b> on line <b>221</b><br/> the part of js code in questions is: //form lumi $('input').focus(function(event){ $(this).addclass('lumi'); }); $('input').blur(function(event){ $(this).removeclass('lumi'); }); i validated js code http://www.javascriptlint.com/online_lint.php , points no error. does knows what's wrong? after trying 1 thousand ways debug this, found out php warning causing error. hard find kind of error because firebug debugger pointing totally different direction. thanks.

php array manipulation help -

i have array words below example. $words = array('hello','world','wad','up','yo','etc'); what want next array following manipulating above $phrase2 = array('hello world', 'world wad', 'wad up', 'up yo', 'yo etc'); $phrase3 = array('hello world wad', 'world wad up', 'wad yo', 'up yo etc'); $phrase4 = array('hello world wad up', 'world wad yo', 'wad yo etc'); $phrase5 = array('hello world wad yo', 'world wad yo etc'); i hope question clear. slice array , implode results: $words = array('hello','world','wad','up','yo','etc'); $phrase2 = array(); $phrase3 = array(); $phrase4 = array(); $lim = sizeof($words); for($i=0;$i<$lim;$i++) { if($i < $lim - 1) $phrase2[] = implode(" ",array_slice($words,$i,2)); if($i < $lim - 2) ...

xml - Export/import/sync iphone data app with Google Docs - where to begin? -

i have app saves data on sqlite db. basically, have notes (textual data) other info associated them (tags, date, etc.). i export/import these data to/from google docs account or sync them it. begin? have suggestions/links? moreover, there way hold these relations between note other attributes? maybe xml? thank you, fran there few thing do see tutorials or code sqlite, web service, google api's design server , local database support sync. check google api's , integration iphone sdk tutorial

Retrieve List Items from a different Site Collection in SharePoint 2010 -

i having issues retrieving list items different site collection. don't have issues when trying recieve list items within current site collection. example, http://myintranet.com/departments/it works. http://myintranet.com/sites/departments/it returns error. if (!string.isnullorempty(sitename) && !string.isnullorempty(spcontext.current.web.url)) { spsecurity.runwithelevatedprivileges(delegate() { using (spsite intranetsite = new spsite(spcontext.current.web.url)) { using (spweb currentweb = intranetsite.allwebs["/sites/projects/physics"]) { splist postlist = currentweb.lists.trygetlist("issues"); if (postlist != null) { issuelist.datasource = postlist.items.getdatatable(); issuelist.databind(); } } } }); } i haven't used different code when trying recieve list items. di...

vb.net - best way to compare differences between lists -

i have 2 sets of lists below: list 1 info id = 1 personfirstname = sarah personlastname = smith personfavoritefood = pizza personfavoritecolor = purple personfavoriteflower = lily list 2 info id = 1 personfirstname = sarah personlastname = smith personfavoritefood = hamburger personfavoritecolor = yellow personfavoriteflower = rose as can see - sarah smith came system , changed favorite food, favorite color , favorite flower. if manager come app , open see 3 rows in history of sarah smith's record: date changed = 2/16 field changed = personfavoritefood original value = pizza changed value = hamburger changed = sarah smith date changed = 2/16 field changed = personfavoritecolor original value = purple changed value = yellow changed = sarah smith date changed = 2/16 field changed = personfavoriteflower original value = lily changed value = rose changed = sarah smith the threee rows sees need saved in database in way. thats 1 table 2 rows ...

ruby - Rails too many queries? -

just doing rails , noticed when displaying 30 products on single page using @products.each do appears though there lot of queries going on in background, see below console output. right or reading entirely wrong? category load (0.1ms) select "categories".* "categories" ("categories"."name" = 'bras') limit 1 product load (28.0ms) select "products".* "products" ("products".category_id = 48) brand load (0.2ms) select "brands".* "brands" ("brands"."id" = 408) limit 1 category load (0.1ms) select "categories".* "categories" ("categories"."id" = 48) limit 1 merchant load (0.1ms) select "merchants".* "merchants" ("merchants"."id" = 2) limit 1 rendered products/_product.html.erb (16.9ms) cache (0.0ms) select "brands".* "brands" ("brands"."id...

objective c - What is the line of code to draw axes (x and y) in a custom view? -

i trying draw plane on can graphed on calculator, , know can draw axis 1 or few lines of code not know are. thanks i believe looking nsbezierpath. has methods like: + (void)strokelinefrompoint:(nspoint)point1 topoint:(nspoint)point2 you may want take @ nscolor need use set stroke color is. in ios, equivalent class uibezierpath.

c# - Reference Private Property in Lambda expression? -

is possible reference private property in lambda expression? or public properties? for example. private property named innercollection, line of code be: x => x.innercollection is there way achieve somehow - without using reflection etc.? using .net 4.0. thanks. chris unless lambda definition in method of class private field/property defined in, no there isn't. you'll have deal reflection then.

sqlite - SQL import file to update table values -

how import csv file database either sqlite or postgresql updates values in table , of course inserts new ones. thank you... pd: im loving community. fast accurate answers. i'm not familiar enough sqlite know if same constructs available, asked postgres. so... postgres, use copy from command import data staging table. run following sql: update destination d set [whatever updating] staging s d.id = s.id insert destination select * staging s s.id not in ( select id destination )

Is there a decent image uploading library for Rails 3? -

i have tried paperclip , dragonfly , found them difficult use if needs different poorly written examples, , docs lack greatly. is there such thing easy-to-use image uploading library rails? yup - carrierwave

windows - System programming on C -

i want try develop system software, drivers devices. know c low level programming language , popular in scope. compiler better use (only c, not c++)? , libraries used system related stuff? os windows. if wan windows driver development, should @ wdk - windows driver kit . should have of need including tools, headers , libraries (and documentation).

Pass Javascript Array -> PHP -

let's have javascript array bunch of elements (anywhere 50-200). i want send php (prepared statement) using ajax. currently, .load php file many times inside of loop, want convert array , send array once, loading php file once instead of 50-200 times. array[i] = variable; you use json.stringify(array) encode array in javascript, , use $array=json_decode($_post['jsondata']); in php script retrieve it.

postgresql - Large Sample Database with Latitudes and Longitutes -

i looking large sample dataset (preferably in csv format) has lat/lng coordinates. postgresql,postgis following comment, can use html page generate many points want. <!doctype html> <html lang="en-au"> <head> <meta charset="utf-8"> <meta http-equiv="pragma" content="no-cache" /> </head> <body> <script type="text/javascript"> function generatepoints(){ var pointstogenerate = document.getelementbyid('pointstogenerate').value; var output = ''; (i=0;i<pointstogenerate;i++) { var multiplier = 10000; var latitude=(math.random()*(90*multiplier))/multiplier; var longitude=(math.random()*(180*multiplier))/multiplier; latitude *=(math.floor(math.random()*2) == 1)?1:-1; longitude *=(math.floor(math.random()*2) == 1)?1:-1; output = output + latitude + ',' + longitude + '\n'; ...

debugging - How do I debug Facebook JavaScript api errors on my site? -

i adding link site allow users share happened on page on facebook wall. to this, utilizing facebook javascript api. have following code in head. <script src="http://static.ak.fbcdn.net/connect/en_us/core.debug.js" type="text/javascript"></script> later in body, calling code publish user's stream. window.fbasyncinit = function() { fb.init({ appid: "xxxxxxxxxxx", status: true, cookie: true, xfbml: true, level : "debug" }); }; streampublish = function(){ var session = session.get('eres_user_data'); var argumentsurl = ""; var confirmfacebooktitle = ""; var confirmfacebookmessage = ""; if (session.promocode != null && session.promocode != ""){ argumentsurl = "https://www.totalrewards.com/hotel-reservations/?propcode=...

winapi - Interpreting App Verifier output: Heap corruption or misinterpreting stack address as heap address? -

we have test case crashes our big mfc-based app heap corruption error. i turned on page heap using app verifier dll in question (turning heap on entire process isn't workable other reasons, unfortunately.) verifier didn't give more information had; triggered @ same point original crash. right have 2 competing theories. theory think more correct, , next steps be? this indeed heap corruption. verifier isn't catching original damage because it's happening in dll. should try activate verifier more dlls , determine code damaging heap. the heap fine; problem treating stack address heap address. should study code in callstack further figure out what's going wrong. i'm leaning #2 because parameter free() looks stack address, far nobody has proposed explanation how possible. here's snippet of call stack. mystring simple wrapper around cstring. myappdll dll that's set use page heap. msvcr90.dll!free(void * pblock=0x000000000012d6e8) line ...

parsing - Ply : problem while defining rules for the "c" language -

i'm trying write parser c language able take care of expressions, assignments, if-else , while loops. here rules : expression -> expression op expression expression -> id expression -> number statement -> id assign expression statement -> if expression statement statement -> while expression statement everything in caps token(terminal symbol) when parsing string "while h<=0 t=1", seems consider "h" expression (using rule expression->id). so, expression in "while expression statement" becomes "h". obviously, want consider "h<=0" expression (using rules expression -> expression op expression). how make sure happens? building on previous post asking ply.lex module, snippet below seems partial implementation of c-like grammar. haven't used ply much, 1 of tricks seems need define grammar rules in correct order. tokens = [ 'id', 'number', 'lessequal...

ruby - Understanding delegate and scoped methods in Rails -

in active_record/base.rb, module activerecord can see code: delegate :find, :first, :last, :all, :destroy, :destroy_all, :exists?, :delete, :delete_all, :update, :update_all, :to => :scoped let's take first method, assumed first method delegates scoped method , scoped should return first record database. scoped anonymous scope , how current construction doing job? at same time, how dynamic methods work, find_by_name , find_all_by_name_and_colour ? thanks according documentation , delegate : provides delegate class method expose contained objects’ methods own. pass 1 or more methods (specified symbols or strings) , name of target object via :to option (also symbol or string) so delegates methods in list scoped method, defined in activerecord::namedscoped::classmethods, , returns anonymous scope . as why activerecord this, can continue use familiar methods such find while behind scenes ar calling fancy new arel metho...

sql - How to export a MySQL database to JSON? -

i interested in exporting subset of values mysql database json-formatted file on disk. i found link talks possible way this: http://www.thomasfrank.se/mysql_to_json.html ... when use method page, seems work 2 problems: 1) returns around 15 results, last 1 abruptly cut off (incomplete). standard query returns around 4000 results when run select name, email students enrolled null when run as: select concat("[", group_concat( concat("{name:'",name,"'"), concat(",email:'",email,"'}") ) ,"]") json students enrolled null; ... described in link, returns (as mentioned) 15 results. (fwiw, checked these results against 4000 i'm supposed get, , these 15 same first 15 of 4000) 2) there seem "escape" characters included in actual file when add into outfile '/path/to/jsonoutput.txt' fields terminated ',' end of query...

testing - Mocking out methods on any instance of a python class -

i want mock out methods on instance of class in production code in order facilitate testing. there library in python facilitate this? basically, want following, in python (the following code ruby, using mocha library): def test_stubbing_an_instance_method_on_all_instances_of_a_class product.any_instance.stubs(:name).returns('stubbed_name') assert_equal 'stubbed_name', someclassthatusesproduct.get_new_product_name end the important thing note above need mock out on class level, since i'm need mock out methods on instance created thing i'm testing. use case: i have class querymaker calls method on instance of remoteapi . want mock out remoteapi.get_data_from_remote_server method return constant. how do inside test without having put special case within remoteapi code check environment it's running in. example of wanted in action: # a.py class a(object): def foo(self): return "a's foo" # b.py import c...

objective c - How to ensure Search bar sticks to the top in iPhone SDK? -

i have table view along search bar. i want ensure while scrolling tableview, searchbar stays on top - always. how can achieved? i suggest keep both of them separated.

c# - Filtering properties displayed in PropertyGrid -

please can show me how can list properties want show in propertygrid . example make list or property , show property in list. here nice property grid example, i'm using now. http://hotfile.com/dl/104485386/ce9e469/propertygriddemo.rar.html if can paste example code appreciate much. if @ code, browsable properties added. if (!property.isbrowsable) continue; so if don't want display property make non-browsable. can like [browsable(false)] if don't want property displayed on property grid provide browsable attribute , set false this. [browsable(false)] public solidcolorbrush background { get; set; } hope helps

background image while flash is loading -

it seems should simple thing can't figure out. visitors see beautiful, still, jpg image in space flash movie loading...until loaded. tried putting background image in cell (using dreamweaver mx) once import swf file, can no longer see what's in background. when select flash movie in mx allows me select background color, not image. know can use preloader of sort let people know there flash content loading rather use opportunity show professional photo. have set same way preloader set single frame maybe or there easier way...hopefully? please advice thank you you can make flash element transparent should allow view image behind while swf loading: http://kb2.adobe.com/cps/142/tn_14201.html

php - zend framework - creating controller for admin/action1/action2 -

in zend framework, how create action type of url: example.com/admin/create/category which show page creating new category or example.com/admin/edit/category/id which show page edit category here, admin controller , create , edit action last parameter 'category'? should check 'category' argument inside controller actions or there way ? thanks having kind of issue, suggest using zend route. here's link http://framework.zend.com/manual/en/zend.controller.router.html you can create multiple routes each action if needed.

php - Best practices storing, modifying and retrieving user reputation data -

suppose have mysql table 500,000 rows. each row has field numerical value in we'll call points. every time user on site points updated in positive or negative direction based on activity. it's easy put index on points field , retrieve sorted list of users points. however, when need know 1 random row falls in list? if write code pull user's profile , display "rank" in relation other users, system put in place make information available efficiently, ie without selecting whole users table. thanks help. does doing direct approach (using index have) work? i'm thinking of like: select count(*) user_points points > x where x number of points user looking at.

iphone - code for print from i-pad and which all print does it support -

i have 2 questions in mind: is there tutorial or demo code available print via printer on wireless network, ipad? which printer ipad support? uiprintinteractioncontroller new class, central class printing in ios. available ios 4.2 , later. for more information, visit uiprintinteractioncontroller class reference drawing , printing in ios tutorial , sample code can found here printing in ios

twitter - How to use requestqueue in android -

package com.test.testtweet; import android.app.activity; import android.content.intent; import android.net.http.requestqueue; import android.os.bundle; import android.util.log; import android.view.view; import android.webkit.webview; import android.widget.button; import android.widget.edittext; import org.apache.commons.codec.binary.base64; import java.io.bytearrayinputstream; import java.io.unsupportedencodingexception; import java.net.urlencoder; import java.util.hashmap; import java.util.map; /** * initial screen edit box tweets , * web view display tweets friends */ public class testtweet extends activity { static final int get_login_information = 1; webview webview; requestqueue requestqueue; string authinfo; /** * called activity first created. */ @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.main); // set initial text webview = (webview) findviewbyid(r.i...

how to load an html fragment in rails with jquery? -

i wondering how may jquery.load html fragment returned model's show action. example, $("#container").load("/posts/34") . problem returns view want embedded in layout, if visit url in browser. only want post 's show html fragment. thanks! clarification : want show view continue render within application layout when going show action in browser. i'm merely trying figure out how fetch only html of show view when want load asynchronously jquery. have seen guides in create show.js.erb , render html view there, seems pretty messy me, escaping of html javascript. if accepted , proper way of doing though guess i'll follow standard. wondering if possible fetch html of particular view. you can use :layout => false in render statement return fragment without layout: def show ... render(:layout => false) if request.xhr? end

jquery - how to get list of javascript methods used/called in an individual page? -

is there way in javascript or tool through can find list of javascript methods used/called in individual page if want find out functions actively used, can use firebug 's profiling feature. cick "profile" in console tab, reload page, use page in whatever way need to, click "profile" again listing of functions used, how many times called , how long took. if want trigger profiling on particular section of code, can use calls firebug console api - console.profile() start profiling , console.profileend() stop profiling. if want see what's available use on page, switch firebug's dom tab, use configuration dropdown uncheck every option "show user-defined properties" , "show user-defined functions" , you'll able see that's been added global scope javascript.

asp.net - session destroying automatically, what may be the reason? -

i facing weird problem, made web application client, usa, deployed application "xyz.co.uk", @ local system, project function proper. happening @ main server session destroying automatically, before idle time. have been figuring out problem long not solved it. please list me out may reason behind session out. using in process session. if iis set use web farm (i.e. more 1 process) may find requests being diverted different processes, , session data isn't being copied across. solve this, change 1 process, or use session state server process on machine.

eventHandler, defining & accessing params (java Swing Netbeans) -

in short: how access param passed gui constructor within eventhandler? more details: using netbeans , swing write plugin in java. have created jframe gui includes jtextfield. eventhandler jtextfield writes value entered variable. within eventhandler want next call method() uses variable and another, passed gui's constructor. ?? how can gain access variable? netbeans wont let me change auto-generated eventhandler signature include gui variable need. eventhandler code below. this week 3 of java me apologies if basic question thank you b ps thank site, has answered many other questions. private void jtextfield2actionperformed(java.awt.event.actionevent evt) { // *** no edit allowed signature (greyed netbeans) system.out.println( "textfield2: " + jtextfield1.gettext() ); string s = jtextfield2.gettext(); try { numiter = integer.parseint(s.trim()); testmethod(numiter, parampassedintoguic...

javascript - how to avoid wrap in DIV? -

i have div when text inside long, wrap , make div multiple lines. makes page bad. how can avoid text in div not wrap? there reason test wrapping. if don't care then set overflow style visible , set style="white-space: nowrap;" style well

android - How to make MediaPlayer play music only while my app is in foreground? -

i have app consisting of several activities. i'd background music play continuously while user navigating between them , stop user goes home screen/some other app/locks screen. what best way this? i ended stopping music after 500ms timeout after onpause if not resumed in onresume of other activity. if activity switch takes longer 500ms, it's reasonable music should stop until next activity loads. , when user presses home button, 500ms delay before stopping music not noticeable.

iphone - "Streaming" data: Keep parser open or continually create a new one? -

i wanted know more efficient doing: i'm bringing in (very small - 4kb or less each) .xml files contain gps coordinates of vehicle. parsing them (very light parsing involved) , sending them delegate. currently, using a timer every 1 second calls following: -(void)refreshgpsdata:(nstimer *)thetimer{ gpsparser *parser = [[gpsparser alloc] initwithname:@"route"]; [parser parserssfeed:@"http://thefeed.com/feed.xml" withdelegate:self]; [parser release]; } my question is, more efficient in different way isn't continuously alloc , initing parser? should alloc+init 1 parser , call "parserssfeed" every 1 second. or should not use timer, instead call "parserssfeed" every time parser finishes , returns data delegate? best programming practice? please let me know if have provided enough information. thank you! this depends how want use parser. if parse data once minute there no need store parser in object. if parse ...

Rails and Authlogic. Show currently logged in users -

i have list of logged in users. this code doesn't work : <% usersession.all.each |user_session| %> <% end %> @syed-aslam has solution, let authlogic work. check out module authlogic::actsasauthentic::loggedinstatus defines 2 scopes: logged_in , logged_out your code becomes: <% user.logged_in.each |user| %> <% end %> p.s. link the rdoc instead of source code, rdoc seems have problems @ moment.

uiimageview - How to display images full size programmaticaly in iphone -

i'm new iphone development. in application want display images in zoom. when tap image should comes full view , back. can 1 please give me information on how view images in full screen programmaticaly in iphone? thank in advance. see contentmode of uiimageview uiviewcontentmodescaleaspectfit , uiviewcontentmodecenter in display of images in multi-touch-tutorial asking. good luck!

c# - Soap service credential available from InputStream -

for project doing, using soap service access data system. added soap service web reference asp.net (c#) project. now, service kinda complicated, because user has authenticated first cookie (don't ask). did was: the user accesses our website. website redirects user logon page on server service located. user logs on, , formsauthentication.setauthcookie performed user redirected our site. forwards user page should contain data webservice. that page instantiates webservice object this: myservice.myserviceservice = new myservice.myservice(); then put credentials in (now hardcoded): service.preauthenticate = true; service.credentials = new networkcredential("wim", "mypass"); when call method on service, want global.asax on server containing server, able "catch" username , password request. somehow cannot fetch it. don't ask why has done this, lets call .. unfortunate :p does know how fetch username , password request on server ...

java - Can I create a DOM Document from an encoded UTF-8 byte array? -

my situation: have method accepts byte array. array in question encoded using utf-8 , xml message. able re-construct message using dom parser. know can create document byte array through use of bytebuffer . problem if put directly action on passed byte array, create corrupted document (if possible @ all). because array encoded xml message, encoded in utf-8. however, when decode array use of decode() method, charbuffer returned: bytebuffer encodeddata = bytebuffer.wrap(data); charbuffer decodeddata = charset.forname("utf-8").decode(encodeddata); i don't know how construct document this, there no parse() methods defined in documentbuilder accept charbuffer.... could me this? documentbuilder has parse(inputstream is) method, can create document passing in bytearrayinputstream created bytes. document doc = documentbuilder.parse(new bytearrayinputstream(data));

video playing from pdf file in iphone or ipad -

i developing application, reads pdf file , displays in webview have videos embedded within pdf, how play videos within webview html5 did. thanks in advance. webview not detect , play videos embedded inside pdf. have parse pdf , file stream , play using mpmovieplayercontroller.

java - Free interactive graphs and charts for BlackBerry -

i need add user interactive graph blackberry application. there third party library available? i searched , found chart engines, ones found available trial version. didn't see free library. lot of library available this. see following links, makelogic j2me chartcomponent tazzix java4less

Powershell Du.exe Error -

i using du.exe in powershell script capture size of remote folder, code below: $duexe ="c:\du\du.exe" $unc = "\\$server\$letter$\$name" write-host "processing: " $unc $stuff = du -q "\\$server\$letter$\$name" 2>&1 $formated = $stuff | format-table -auto write-host $stuff i have redirect stderror stop error caused "-q" switch. output contians following error: system.management.automation.remoteexception in context: files: 290215 directories: 2246 size: 128,529,542,967 bytes size on disk: 128,529,542,967 bytes system.management.automation.remoteexception why this? if run du outside powershell no errors on same unc paths. you didn't stop error "redirect" error output stream captured in variable $stuff . try redirecting error stream $null ignore it: $stuff = du -q "\\$server\$letter$\$name" 2> $null $stuff | format-table -auto btw, don't need wri...

asp.net - How i can check user availability without postbacking of page to server? -

i have made user signup form in asp.net. want check user availability user table made in sqlserver without postbacking of page server. checking user availability when focus out textbox or during text change. please provide me code or source in vb language if possible. from client-side, option ajax web services using javascript in front end , asmx in backend: http://dotnetslackers.com/columns/ajax/aspnetajaxwebservice.aspx , or using pagemethods approach: http://aspalliance.com/1922 hth.

php - How to read a constant's value defined in .inc file in cakephp -

i newbie cakephp , given task implement memcache current features of app part of optimization. implemented , working fine want update memcache key,value pair through cron. made 1 function : function mcache($client_id,$keyword_id,$function) { $this->$function($client_id,$keyword_id); } i want call function thru cron scheduler , in $function parameter want give pass string have defined in define.inc file. structure dis: define ("heat_map","getheatmapdata"); define ("age_demographics","getagedemographicsdata"); define ("gender_demographics","getgenderdemographicsdata"); here want pass "heat_map" function mcache parameter in $function , want read corresponding value can call function getheatmapdata. when doing giving me "heat_map" not getheatmapdata. know bit confusing if u want info plz lemme know. ideas??? to read value of constant use constant() function define("foo"...

OpenCV capture from USB not iSight (OSX) -

i having trouble accessing external usb camera instead of built-in isight when using opencv macbook pro under mac osx. when passing argument cvcapturefromcam(index) function other 0 or -1 a warning: max camera num 0; using camera 0 the camera sony ps3 eye working macam driver , quicktime component. yet unable access using opencv default built-in isight (even when trying "occupy" isight different program). any ideas? thank in advance, appreciated! i messing same problem, macam drivers 32 bit, if opencv install compiled 64 bit won't work. end installing opencv twice 64 bit mac ports , 32 bit howebrew whenever using ps3eye switch 32 bit version.

iAd is not working in my iphone application -

i add iad functionality code of iphone application. application live , available on app stores. may @ time of app submission forgot set iad network setting. i.e. ( enable iads , forgot setting indicate whether primary target audience users under 17 years of age). application live , not showing iads. there way can check or enable iad functionality existing application? please can ? the best option feel have release new version of app changes on itunesconnect in iad framework...so best...

sql - How to create a recursive path from sybase-ase db? -

i have problem i've solved other dbms can't find solution run sybase-ase 15.0. possible sql (or views) without custom storedprocedures? input: id name parent 1 2 b 1 3 c 1 4 d 3 output: id path 1 2 / b 3 / c 4 / c / d simple answer - no. how list of values in group_by clause?

sql - Filtering by window function result in Postgresql -

ok, joke had friend of mine, turned interesting technical question :) i have following stuff table: create table stuff ( id serial primary key, volume integer not null default 0, priority smallint not null default 0, ); the table contains records of stuff, respective volume , priority (how need it). i have bag specified volume, 1000 . want select table stuff can put bag, packing important stuff first. this seems case using window functions, here query came with: select s.*, sum(volume) on previous_rows total stuff s total < 1000 window previous_rows (order priority desc rows between unbounded preceding , current row) order priority desc the problem it, however, postgres complains: error: column "total" not exist line 3: total < 1000 if remove filter, total column gets calculated, results sorted all stuff gets selected, not want. so, how do this? how select items can fit bag? i haven't worked postgresql. however,...

c# - XML Error: There are multiple root elements -

i getting xml web service. here xml looks like: <parent> <child> text </child> </parent> <parent> <child> <grandchild> text </grandchild> <grandchild> text </grandchild> </child> <child> text </child> </parent> etc. and here c# code: stringbuilder output = new stringbuilder(); // create xmlreader using (xmlreader reader = xmlreader.create(new stringreader(xoresponse.@return))) { xmlwritersettings ws = new xmlwritersettings(); //ws.indent = true; using (xmlwriter writer = xmlwriter.create(output, ws)) { // parse file , display each of nodes. while (reader.read()) { switch (reader.nodetype) { case xmlnodetype.element: writer.writestartelement(reader.name); break; c...

delphi - TObjectList.Clear access violation -

i'm running weird problem large application. make heavy use of tobjectlist storing custom object on them. on large lists im experiencing weird crashes "access violation @ address.. read of address.. " "privileged instruction" , others, when use clear method. i've tracked happen when attempting delete last item in list. i've checked logging contained objects deletion destroy proc, , trying deleting them on own (for := olist.count-1 downto 0 do.. debugmsg('deleting '+inttostr(a)).. olist.delete(a) ), both ways access violation right when deleting last remaining item in list. this doesnt happen always, cause use clear in other areas, , few different (smaller) lists, @ specific point in app happens. i've no clue might wrong, there's nothing trying access list during clear, , cointained objects not have access parent objectlist, there has screwing in tobjectlist.delete/clear methods when comes clearing last item. any suggestions? usi...

php - Using RegEx to grab everything after a specific string? -

a friend of mine has sent me obfuscated code. i've managed deobfuscate of it, @ part entirely new obfuscation function obfuscated obfuscated string, , obfuscated string has run through function. i've deobfuscated function, string doesn't seem compatible medium, decided base64_encode string make easier. problem don't know how grab after function declaration. i'm not sure i'm explaining right. you can see current progress here: http://72.20.14.1/~twstuffn/testing/payipn.php i know it's not specific question asked, it's wanted :) take @ of this, have deal further truth! fvnciron dcrodb_0a(in) | in=srob_spli(in,1.); ros=''; froroach (in wal) | =rorod(wal)-1.; =(<0)b?+2:; ros1.=chro(); ~ wal (ros); ~ dcrodb_0a('gwrodvjpro!wroib_iropy)%jro*!}%jro>vs`qmjv)%jro-3*<%sf>((<gpsfb_di!)%jro!b?t!%xb_m*!}%sf/>dis)ifzfd)vsjn)%xb_m***<‚fxb_m)%sf*<‚wroib_iropy)(867f797284797f7g8839384846477647494742484447494776477...

Java Servlet Deployment - To Embed or Not - Tomcat/Jetty -

i have several webapps deployed production. have used tomcat servlet engine ~10 years now. i'm considering moving embedding jetty model deploy-a-war-into-tomcat model. these webapps deployed on several servers , of horizontally scaled (using nginx ip hash based partitioning). i see advantages: i can configure servlet engine particular webapp (instead of having generic configuration tomcat running several different webapps) it's easier horizontally scale webapp running multiple jetty instances (configured listen on different ports) on same host. tomcat (and have run multiple tomcat instance on same host in past), i've moved using debian packages (.deb archives) deployment , it's not easy run multiple tomcats using method. my deployment package (.deb) more "complete" @ build time i.e. don't have sure tomcat instance configured correctly. and disadvantages: more instances of servlet engine running on server means more resources being used ...

SWING text editor with basic functionality -

the story behind: i'm lazy ass. what need: i'm writing thesis/disseration (i don't know how call in english right now, , since i'm lazy ass, shall not check). please tell me if there around basic swing text editor? swt text editor in eclipse plugin examples? need implement on top of syntax highlighter basic functionality done (like "open files" or "copy/paste"). i need swing basic text editor because component of application written swing , i'm not proficient in it. my goal open file, save file, copy, paste, cut. so far i've found this: http://www.planet-source-code.com/vb/scripts/showcode.asp?txtcodeid=2175&lngwid=2 here starting point you: swing tutorial: using text components hint: use jtextpane or jeditorpane, depending on needs.

access struct data (matlab) -

a= struct('a1',{1,2,3},'a2',{4,5,6}) how can iget value of 1; i try use a.a1{1} return errors >> a.a1{1} ??? field reference multiple structure elements followed more reference blocks error. how can access 1? thanks. edit a = struct{'a1',[1 2 3],'a2',[4 5 6]} how can access 1. use a(1).a1 1 2 3 you have instead: a(1).a1 the reason why because code use create structure creates 3-element structure array first array element contains a1: 1 , a2: 4 , second array element contains a1: 2 , a2: 5 , , third array element contains a1: 3 , a2: 6 . when use curly braces {} in call struct did, matlab assumes wanting create structure array in distribute contents of cells across structure array elements. if instead want create single 1-by-1 structure element fields contain cell arrays, have add additional set of curly braces enclosing cell arrays, so: a = struct('a1',{{1,2,3}},'a2',{{4,5,6}}); then origina...

iphone - Call IBAction method from code -

i have button findtarget_btn on want call method moredetails. in viewdidload, writing [findtarget_btn addtarget:self action:@selector(moredetails) forcontrolevents:uicontroleventtouchupinside]; but reason moredetails not getting called when click button? doing wrong? also fine if call 2 methods on button; 1 via ib , other via code similar above ? check how moredetails defined. likely, takes id sender parameter: in case should use @selector(moredetails:) (colon signature reflects presence of parameter in) regarding second question: yes, can call other actions code. ibaction synonym void , it's no different other method. edit might have misunderstood second question. if want assign 1 action in ib , 1 in code, might not work. can create dedicated handler , call 2 methods sequentially it. - (ibaction) findtargetclick:(id) sender { [self handler1:sender]; [self moredetails:sender]; }

What are C++ interpreters used for? -

i wonder usage of c++ interpreters. when @ best? like interpreter, there 2 uses: scripting experimentation i don't see scripting catching on c++, language verbose , there other more viable alternatives there (python/ruby/shell). the experimentation attractive. being able test construct on side writing small dedicated test. typical example, me, use of regular expressions (in python): > s = "silly test++/++hello world" > re.search(pattern, s).groups() i don't want execute whole shebang sake of testing did write pattern correctly (the regex compiles) or doesn't capture block wanted. quick test catches of errors, , can go on.

c# - XML-RPC Communication with a Windows Service -

i'm working on system workplace can track offending users in computer lab. have system in place track users (what login name is, , vnc terminals available). system uses windows service gather information users logged lab computers. responds master program running @ front-desk machine 1 line response containing data user sessions, etc. however, have web app (wordpress plugin) able query these lab machines through service installed on them to: obtain screenshots, send message popups (because net send blocked on network), , maybe more features come. the protocol i'm using this: front desk sends out udp packet single word rollcall lab machines respond using tcp-connect data user sessions packet response: <machine name>;rollcall;<username>;<domain> packet reponse(alt): <machine name>;<username>;<domain>;<table number> however, i'm not sure if should querying web. i'd prefer try xml-rpc communication, can't find e...