Posts

Showing posts from February, 2010

analysis - Things you look for when trying to understand new software -

i wonder sort of things when start working on existing, new you, system? let's system quite big (whatever means you). some of things identified are: where particular subroutine or procedure invoked? what arguments, results , predicates of particular function? how flow of control reach particular location? where particular variable set, used or queried? where particular variable declared? where particular data object accessed, i.e. created, read, updated or deleted? what inputs , outputs of particular module? but if more specific or of above questions particularly important please share :) i'm particularly interested in extracted in dynamic analysis/execution. i use "use case" approach: first, ask myself "what's software's purpose?": try identify how users going interact application; once have "use case", try understand objects more involved , how interact other objects. once did this, draw uml-type diagra

python: <type 'exceptions.UnicodeEncodeError'> Why this happen? -

below full log, problem in 23 dd.append(str(msg.get_json())) i have utf-8 returned msg.get_json()... str() try encode parameter using ascii? <type 'exceptions.unicodeencodeerror'> python 2.6.5: /usr/bin/python mon nov 15 18:53:39 2010 problem occurred in python script. here sequence of function calls leading error, in order occurred. /usr/lib/pymodules/python2.6/flup/server/fcgi_base.py in run(self=<flup.server.fcgi_base.request object>) 556 """runs handler, flushes streams, , ends request.""" 557 try: 558 protocolstatus, appstatus = self.server.handler(self) 559 except: 560 traceback.print_exc(file=self.stderr) protocolstatus undefined, appstatus undefined, self = <flup.server.fcgi_base.request object>, self.server = <flup.server.fcgi.wsgiserver object>, self.server.handler = <bound method wsgiserver.handler of <flup.server.fcgi.wsgi

xpath: decipher this xpath? -

what xpath mean ? can decipher ? //h1[following-sibling::*[1][self::b]] select every h1 element (in document of context node) followed b element (with no other intervening element, though there may intervening text). breaking down: //h1 select every h1 element descendant of root node of document contains context node; [...] filter out of these h1 elements don't meet following criteria: [following-sibling::*[1]...] such first following sibling element passes test: [self::b] self b element. literally, last test means, "such when start context node , select self (i.e. context node) subject node test filters out except elements named b , result non-empty node set."

objective c - What does the "&" character mean prepended to a var in obj-c -

hi, consider these method calls 1) audiofileopenurl(infileurl,kaudiofilereadpermission,kaudiofilemp3type,fileid) 2) audiofileopenurl(infileurl,kaudiofilereadpermission,kaudiofilemp3type,&fileid) the second call has "&" symbol before fileid parameter. "&" mean? that's not objective-c feature. it's c "address of" operator. gives memory address of variable opposed contents.

javascript - Help required on onbeforeunload or click on browser back button -

if user clicks browser's button, want prompt appear , ask confirmation. if user clicks 'ok', should navigate xx.html . if user clicks 'cancel', should prevent navigation. how can this? note: tried onbeforeunload method, working navigation actions. example, clicking link on page fire event , show message user. you can't. best can use onbeforeunload , remove event when clicking on normal link: <script type="text/javascript"> window.onbeforeunload = function() {return "are sure?"} </script> <a href="somewhere.html" onclick="window.onbeforeunload = null;">leave</a>

Can we develope User Script in Opera Mobile using Opera Widget? -

is possible develop addon/plugin in opera mobile greasemonkey load users script when web page loaded every time? check if can go opera:config#user%20javascript in opera mobile. if address works , setting exists, have user javascript support , should able write scripts want pointing "user javascript file" setting suitable file or folder on phone's file system. (if setting isn't there i'm afraid you're out of luck - - have no idea versions of opera mobile support user js..)

java - How to teach checkstyle to ignore my custom javadoc tags? -

i have custom javadoc tag ( @todo ) attached methods , classes. checkstyle says: [error] foo.java[0:null] got exception - java.lang.illegalargumentexception: name [todo] not valid javadoc tag name is possible teach checkstyle ignore these tags? i tried configure specified here : <module name="javadoctype"> <property name="allowunknowntags" value="true"/> </module> but got message: ... cannot initialize module treewalker - property 'allowunknowntags' in module javadoctype not exist, please check documentation moreover, need use these tags not types, packages, methods, , variables. ps. it's maven-checkstyle-plugin 2.6 you can't use property because maven checkstyle plugin uses checkstyle 5.0 whereas allowunknowntags property introduced in checkstyle 5.1. (see checkstyle release notes )

xcode - Load three UITableViews from different datasources -

i have 3 uitableviews on view. i have created 3 different nsmutablearray loaded different data. i need place 1 of nsmutablearray datasource 1 of uitableview. i able assign 3 uitableviews datasource through viewdidload of form. but need do, assign each of uitableview datasource different nsmutablearray. how can perform task? thanks tony if 3 uitableviews share same datasource object (the object holds 3 of arrays), use if statements differentiate between table views asking data: - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // if table 1 asking, give table 1 data... if (tableview == mytableview1) { // assume sections have 3 rows each // purposes of simple demonstration... return [datasourcefortable1 count]; } // if table 2 asking, give table 2 data... if (tableview == mytableview2) { // assume sections have 3 rows each // purposes of simple demo

How to convert Perl objects into JSON and vice versa -

i have defined point object in file point.pm following: package point; sub new { ($class) = @_; $self = { _x => 0, _y => 0, }; return bless $self => $class; } sub x { ($self, $x) = @_; $self->{_x} = $x if defined $x; return $self->{_x}; } sub y { ($self, $y) = @_; $self->{_y} = $y if defined $y; return $self->{_y}; } 1; now when use json convert object json following code: use json; use point; point $p = new point; $p->x(20); $p->y(30); $json = encode_json $p; i following error: encountered object 'point=hash(0x40017288)', neither allow_blessed nor convert_blessed settings enabled @ test.pl line 28 how convert , json object using json module? well warning tells wrong. json not deal blessed references (i.e. objects) unless tell do: you can convert_blessed , can allow_blessed . allow_blessed , says: if $enable false (the default), encode throw exception wh

How to write this better? Ruby Sequel chaining OR -

in sql should this: select * `categories_description_old` ((`categories_description` = '') or (`categories_name` = '') or (`categories_heading_title` = '')) my (ugly) solution: conditions = [:categories_name, :categories_heading_title, :categories_description] b = table_categories_description_old.filter(conditions.pop => "") conditions.each |m| b = b.or(m => "") end is there better solution chain or conditions? you can like: conditions.inject(table_categories_description_old.filter(true)){|acc, cond| acc.or(cond => '') } but in cases when have thought out sql query, find easier type whole condition , use sequel sanitize query parameters.

symfony: how "svn revert ." works? -

i've done checkout, after modify file has been download. then svn revert . file is, expecting has again contents has after doing checkout has modification have made after. so how can go state of file after doing checkout? javier you need recursive flag svn revert -r . your command revert things on folder, e.g. svn-property changes, not on files or folders below.

css - IE6 renders spacing even when margin and padding are zero -

Image
i've created contrived example illustrate problem. there 2 paragraphs div in between. div's height , line-height have been set 0 , margins 0. expect 2 paragraphs right next each other without spacing div @ all, not case in ie6. seems work fine in other browsers. here html styles inlined: <!doctype html> <html lang='en'> <head> <title>test</title> </head> <body> <div id="container" style="border: 1px solid blue;"> <p style="margin: 0;"> text </p> <div style="height: 0; line-height: 0; margin: 0; border: 1px solid red;"> &nbsp; </div> <p style="margin: 0; border: 1px solid green"> should right below "some text" </p> </div> </body> </html>

cygwin - Xerces Library and Qt -

i'm trying setup xerces can use in qt creator windows. does qt support windows/linux binaries or have compile using mingw target? how 1 goes compiling libraries in windows? no, can't use libraries compiled linux under windows. you'll have either build or use existing windows binary distribution. how works in detail depends on third-party library want use. basic options are, in case have build yourself: build msvc under windows, mingw under windows, or cross-compile mingw e.g. linux. msvc tends less hassle under windows, mingw might work well. important : mingw , msvc abi-incompatible when comes c++ libraries. can't use e.g. msvc-built xerces in mingw-qt project, or mingw-xerces in msvc project. affects c++ libraries, not pure c ones.

Importing Excel Sheets into MySQL with Values that relate to a separate table -

first up, might wrong place ask question.. so, sincere apologies that! i have 2 mysql tables follows: first table: employee_data id name address phone_no 1 mark street 647-981-1512 2 adam street 647-981-1214 3 john street 647-981-1452 second table: employee_wages id employee_id wages start_date 1 3 $15 12 march 2007 2 1 $20 10 oct 2008 3 2 $18 2 june 2006 i know, both these tables can combined 1 , there no need split data 2 tables. but, i'm working on requires data separate , in 2 different tables. now, company used handle data in excel sheets , followed conventional method of having these 2 tables combined 1 sheet follows: excel sheets id name wages start_date 1 mark $20 10 oct 2008 2 adam $18 2 june 2006 3 john

c++ - Is std::vector::push_back permitted to throw for any reason other than failed reallocation or construction? -

consider: std::vector<int> v; v.reserve(1); v.push_back(1); // statement guaranteed not throw? i've chosen int because has no constructors throw - if copy constructor of t throws, exception escapes vector<t>::push_back . this question applies insert push_back , inspired is safe push_back 'dynamically allocated object' vector? , happens ask push_back . in c++03 , c++0x standard/fcd, descriptions of vector::insert if no reallocation happens, iterators/references before insertion point remain valid. don't if no reallocation happens, no exception thrown (unless constructors etc of t). is there elsewhere in standard guarantee this? i don't expect push_back throw in case. gnu implementation doesn't. question whether standard forbids it. as follow-up, can think of reason why implementation throw? best can think of, if call reserve ends increasing capacity value in excess of max_size() , insert perhaps permitted throw length_error w

user agent - How can I get the actual culture name from an iPhone web app? -

clarified: javascript web application not native object-c application. i have web application running on iphone need globalize. i've configured settings->general->international->region format "united kingdon" , left language "english". upon inspection of user agent string i'm seeing following: mozilla/5.0 (iphone; u; cpu iphone os 4_0 mac os x; en-us ) applewebkit/532.9 (khtml, gecko) mobile/8a293 i expect en-gb i'm seeing en-us. i've tried restarting iphone , remains en-us. from understand, language portion comes set type of iphone's "language" (e.g. menus , buttons in user interface) , not region format. source

java - Display jpg from sdcard android -

i cant work anymore here code: imageview jpgview = (imageview)findviewbyid(r.id.imageview01); string myjpgpath = "/sdcard/pic.jpg"; jpgview.setvisibility(view.visible); //jpgview.setscaletype(imageview.scaletype.fit_center); jpgview.setadjustviewbounds(true); bitmapfactory.options options = new bitmapfactory.options(); options.insamplesize = 2; bitmap bm = bitmapfactory.decodefile(myjpgpath, options); jpgview.setimagebitmap(bm); can help? you can use bitmapdrawable, e.g. imageview jpgview = (imageview)findviewbyid(r.id.imageview01); string myjpgpath = "/sdcard/pic.jpg"; bitmapdrawable d = new bitmapdrawable(getresources(), myjpgpath); jpgview.setimagedrawable(d);

Socket Programing By C# in ASP.net -

is possible write socket c# in asp.net ? example can write code perl code in c# , asp.net ? : > use http::request::common qw(post); > use lwp::useragent; $ua = new > lwp::useragent(agent => 'mozilla/5.0(windows; u; windows nt 5.1; en-us; rv:1.8.0.5)gecko/20060719 firefox/1.5.0.5'); > $ua -> timeout(20); > $req = post 'http://example.com/', > [ login_username => 'mehdi' , login22 => '654321' , go => 'submit']; > $content = $ua->request($req); please give me example or convert above code c# , asp.net . in advance . yes, achieve same functionality in .net using webclient class: class program { static void main() { using (var client = new webclient()) { client.headers[httprequestheader.useragent] = "mozilla/5.0(windows; u; windows nt 5.1; en-us; rv:1.8.0.5)gecko/20060719 firefox/1.5.0.5"; var values = new namevaluecollection

iphone - PDF Reader like iBooks -

Image
i want create pdf reader ibooks. can see thumbnails pages, press on , opens page etcetera. bookshelf showing loaded pdf's does know how can create that? there library or knows tutorial? thanks in advance! what need this: for page curl, see this discussion . else, should break problem down more focused questions since it's hard tell how detail give (ie, don't know how know). update for drawing part, start cocoa drawing guide , views programming guide . believe can basic pdf thumbnails using uiimage class.

In C# how to create a List<T> with a default count of zero? -

rookie question: i have been experiencing minor bug in mvc2 application. able trace code: list<stream2fieldtypes> stream2fieldtypes = new list<stream2fieldtypes>(); foreach (var item in stream.stream2fieldtypes) { stream2fieldtypes.add(item); } the problem experiencing when instatiate new list, has count of one. i'm thinking due using constructor. tried this: list<stream2fieldtypes> stream2fieldtypes; foreach (var item in stream.stream2fieldtypes) { stream2fieldtypes.add(item); } but, of course not compile because of error on stream2fieldtypes.add(item); . there way can create list<stream2fieldtypes> , make sure count zero? the problem experiencing when instatiate new list, has length of one no, that's totally impossible. problem somewhere else , unrelated number of elements of newly instantiated list. list<stream2fieldtypes> stream2fieldtypes = new list<stream2fieldtypes>(); stream2fieldtypes.cou

.net - Regular expression to extract numbers from a string -

can me construct regular expression please... given following strings... "april ( 123 widgets less 456 sprockets )" "may (789 widgets less 012 sprockets)" i need regular expression extract 2 numbers text. month name vary. brackets, "widgets less" , "sprockets" text not expected change between strings, useful if text able varied well. thanks in advance. if know sure there going 2 places have list of digits in string , thing going pull out should able use \d+

bytearray - jquery association array -

need little i'm sure easy jquery i have following repeating markup (several list items) <li> <div class="answer"> <p><select class="dropdown"> ..options.. </select></p> </div> <div class="commentbox"> ..content.. </div> </li> depending on value of selected option when pages loads, "commentbox" shown/hidden. i have tried following jquery var dd = $('.dropdown'); var com = $('.commentbox'); dd.each(dd, function(n, val){ if($(this).val() == 'whatever'){ com[n].setstyle('display', 'none'); } }); i error "b.apply not function" so in head, how should work - if it's first select dropdown, show/hide first "commentbox" div. if it's second dropdown show/hide second "commentbox" div. , on. i think have got in mess trying various jquery techniques sure there dozens of possibilities here. thanks

Android "vspace" memory? -

i'd know bit more vspace memory exactly. running out of vspace memory when loading lib our android games occurs tend take ram can @ application startup. haven't been able find information it. here`s error message get: 11-11 16:00:57.057: error/libegl(946): load_driver(/system/lib/egl/libegl_adreno200.so): cannot load library: alloc_mem_region[847]: oops: 64 cannot map library 'libegl_adreno200.so'. **no vspace available**. what vspace memory? some links / info android / linux memory model appreciated too! thanks! vspace stands "virtual [address] space". in 32bit systems limited 4gb, , 1/4 of reserved os. program binary , dynamically loaded libraries need fit in address space other mmapped files, address range used memory allocations (heap) , threads' stacks.

Technical architecture diagram for an iPhone app -

is there sample technical architecture diagram iphone app depicts high level components , interactions. please guide. is there in particular looking for? have taken @ apple's ios application programming guides? or looking technology overview ?

floating point - Float comparison issues in Perl -

possible duplicate: how fix perl code 1.1 + 2.2 == 3.3? i'm working on perl script compares strings representing gene models , prints out summary of comparison. if gene models match perfectly, print out terse summary, if different, summary quite verbose. the script looks @ value of variable determine whether should terse or verbose summary--if variable equal 1, should print terse summary; otherwise, should print verbose summary. since value numeric (a float), i've been using == operator comparison. if($stats->{overall_simple_matching_coefficient} == 1) { print "gene structures match perfectly!\n"; } this worked correctly of tests , of new cases running now, found weird case value equal 1 above comparison failed. have not been able figure out why comparison failed, , stranger yet, when changed == operator eq operator, seemed work fine. i thought == numerical comparison , eq string comparison. missing here? update: if print out val

tsql - Statements after END in stored procedure -

i came across interesting problem today. altering stored procedure , put select statement @ end. meant temporary , working data. surprised find out later statement got saved , executing whenever sp ran. set ansi_nulls on go -- comments go here , saved part of sp alter procedure [dbo].[mysp] @param int begin --your normal sql statements here end --you can add sql statements here select * largetable --you have access params select @param it makes sense saved, not inside begin/end, otherwise comments , set ansi_nulls , etc. disappear. i'm little confused starts where, have few questions: set ansi_nulls gets saved part of sp. have confirmed each sp has own value. how sql server know save part of sp since it's not referenced before? full scan of current environment state, when alter procedure runs saves state (possibly non-default values)? apparently begin/end optional , have no intrinsic meaning. why included then? give false sense of scope doesn

How can I make some code available throughout a Rails app conveniently? -

i want add library wrote rails app (and other rails apps later). tried putting in /lib seemed logical... [rails_root]/lib/my_lib/the_main_file.rb [rails_root]/lib/my_lib/some_other_file.rb then... require 'my_lib/the_main_file' that works fine. but great way it? now have put require everywhere want call library. i thought putting require in initializer seems kind of weird. what people this? using initializer may weird when have single file include, have many files want add, , end using intializer includes stuff. it's pretty neat.

.net - ASP.net: FTP issue, trying to move ASPX files from one FTP to another -

here's code: response.close() ftpwebrequest = webrequest.create(ftp_location & dr("file_location").tostring.replace("~", "")) ftpwebrequest.credentials = new networkcredential(ftp_user, ftp_pw) ftpwebrequest.method = webrequestmethods.ftp.uploadfile ftpwebrequest.usebinary = true ftpsourcerequest = webrequest.create(ftp_source & dr("file_location").tostring.replace("~", "")) ftpsourcerequest.credentials = new networkcredential(ftp_user, ftp_pw) ftpsourcerequest.method = webrequestmethods.ftp.downloadfile ftpsourcerequest.usebinary = true try ftpsourceresponse = ftpsourcerequest.getresponse() dim t system.net.ftpstatuscode = ftpsourceresponse.statuscode dim responsestream io.

Use JQuery to convert JSON array to HTML bulleted list -

how can convert array of strings represented in json format , convert html bulleted list using jquery? var ul = $('<ul>').appendto('body'); var json = { items: ['item 1', 'item 2', 'item 3'] }; $(json.items).each(function(index, item) { ul.append( $(document.createelement('li')).text(item) ); }); as far fetching json server using ajax concerned use $.getjson() function. live demo .

java - adding static property data when creating entities -

suppose have 2 entity types: user , country. country entities never created , aren't mutable. they're keyed iso alpha3 country codes, e.g. "usa". reside in table country pk column id. users have many-to-one mapping country w/ cascade = none. users reside in user table fk column country_id references country(id). when creating new user might like: user user = new user(); user.setcountry(em.find(country.class, "usa")); em.persist(user); i gather that's wasteful, though, since requires query against country first. noticed can this: country usa = new country(); usa.setid("usa"); user user = new user(); user.setcountry(usa); em.persist(user); since cascade = "none" shouldn't need query country table; should insert "usa" directly user country_id. correct? now suppose there's code ever creates users country_id = "usa". in case, occurred me store static instance of country id = "usa&

java - Error implementing the Thrift API -

i'm implementing thrift remote procedure call framework in java. set thrift , generated skeleton code without lot of issues, i'm using api methods, strange errors. here errors get: exception in thread "main" org.apache.thrift.transport.ttransportexception: cannot write null outputstream @ org.apache.thrift.transport.tiostreamtransport.write(tiostreamtransport.java:142) @ org.apache.thrift.protocol.tbinaryprotocol.writei32(tbinaryprotocol.java:163) @ org.apache.thrift.protocol.tbinaryprotocol.writemessagebegin(tbinaryprotocol.java:91) @ simonsays$client.send_registerclient(simonsays.java:102) @ simonsays$client.registerclient(simonsays.java:96) @ simon.main(testclass.java:16) i don't think i'm not making mistakes, make sure, here's code that's leading errors: tprotocol prot = new tbinaryprotocol(new tsocket("http://thriftpuzzle.facebook.com",9030)); simonsays.client client = new simonsays.client(prot); client.registerclien

wpf - Disable TabStop on Expander -

i set istabstop false , tab still navigates expander. any ideas doing wrong? <expander header="data" istabstop="false"> <border background="white" borderthickness="0"/> </expander> it looks bug in expander template: http://social.msdn.microsoft.com/forums/en-us/wpf/thread/e51ad4f5-95d3-4c3e-be87-7917e4d81fa0/ here's full workaround (ugly, know): <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:class="wpfapplication1.mainwindow" x:name="window" title="mainwindow" width="640" height="480"> <window.resources> <style x:key="expanderrightheaderstyle" targettype="{x:type togglebutton}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type

java - Strange Problem with Android, Program compiles but does not work -

in android project, have simple java file gets webpage content, text , returns text string . text display in scrollview in activity on android. it works fine, problem comes when try manipulating text in java file. tried arrays, didn't work switched string , still nothing. particular method fails provide output program compiles fine. however, same method when tried in java project in eclipse works fine. here's code: // method return selected stripped text extracted rawdata public static string fillmenus(string rawdata){ string result = ""; int c1, c2; for(int i=0; i<11; i++){ c1 = rawdata.indexof("\" width=\"50px\" />") + 17; c2 = rawdata.indexof(" €</td>") + 2; if (c1==16 || c2==1) break; if (c1<=c2){ result = result+"\n"+ rawdata.substring(c1, c2); rawdata = rawdata.substring(c2); } if (c1>c2){

How to access Gmail Atom feed using Zend Libraries (PHP)? -

i have worked out oauth authentication etc. don't quite know how access it. searched zend documentation couldn't find it.. use simplepie parsing rss or atom feeds.

r - ddply : push or pull? -

does ddply push or pull when grouping data? i.e, involve many passes on data frame, or one? if take @ code, see general structure of function: function (.data, .variables, .fun = null, ..., .progress = "none", .drop = true, .parallel = false) { .variables <- as.quoted(.variables) pieces <- splitter_d(.data, .variables, drop = .drop) ldply(.data = pieces, .fun = .fun, ..., .progress = .progress, .parallel = .parallel) } <environment: namespace:plyr> so rearranges variables in format that's easier use, breaks data pieces, , use ldply on pieces. pieces generated function splitter_d. pieces little bit more sophisticated list - it's pointer original data , list of indices. whenever request piece of list, looks matching indices , extracts appropriate data. avoids having multiple copies of data floating around. can see how functions using getanywhere("splitter_d") or plyr:::splitter_d . ldply passes once o

scrum - How do you make sure that you always have a releasable build? -

how make sure have releasable build? i'm on scrum team running following problem: @ end of sprint, team presents finished user stories product owner. po typically accept several user stories reject 1 or two. @ point, team no longer has releasable build because build consists of both releasable stories , unreleasable stories , there no simple way tear out unreleasable stories. in addition, not want delete code associated unreleasable stories because typically need add few bug fixes. how should solve problem? guess there way branch build in such way either (a) each user story on own branch , user story branches can merged or (b) there way of annotating code associated each user story , creating build has working user story. don't know how either (a) or (b). i'm open possibility there easier solutions. i want stress problem not build broken. build not broken -- there user stories in build cannot released. we using svn willing switch source control system if

eclipse - Plugin classpath issues when running from IDE -

i have maven plugin transforms class bits after compilation. plugin works precisely designed when run command line. however, problem arises in eclipse (3.6.1) when maven project building clean state. happens error message in console informing me plugin has failed due inability find class in fact on classpath. as mentioned, plugin works when build command line, rather annoying problem seems bit difficult track down. has else ran problem before, , if so, there solution i'm missing? thanks. i can confirm maven eclipse plugin works different "console version". can try change "preferences->maven->installations" external maven installation (that use when running command line). eclipse plugin embedded version 3.0-snapshot (in installation) , maybe not stable in points.

how to forbidden page cache on rails -

i'm design shopping cart,there 2 web page, first checkout page,and second order_success page if user use go button on webbrowser go checkout page after user have go order_success page. so want find way forbidden let use go back, is there way on rails archieve this? "i know user use go button,if there cache in client, user still see & re-submit, not expect" [was meaning?] if want prevent user resubmit same request, may add hidden field (just random) , store in session after request has been processed: if params[:token] == session[:used_token] render_already_processed_notice return end if @cart.save session[:used_token] = params[:token] .... if use cart id in request, may use status of cart model: @cart = cart.find(params[:id]) render_some_notice , return if @cart.done? .... @cart.done = true @cart.save personally not create checkout , order_success pages. create single page - cart status, , depending on model status display di

image processing - Take a picture from google streetview -

is possible embed streetview address. user move around in streetview zoom, pan etc , can provide user button capture image , send application. alternatively, if not possible use button , capture image of user sees then, can take streetview link user this one , can image on php similar shown in flash? the whole idea able user sees on streetview image server. have @ streetview.py python script parses panorama information.

c# - Loading app.config file in Release -

in visual studio 2008 project, i've added app.config file store app-data in xml format. i read data in code this: string somedata = configurationsettings.appsettings["somedatakey"].tostring(); when start application in visual studio, works. if try run exe file (release or debug) error (if debuf it breaks on line above): object reference not set instance of object. the file app.config not inside folder. is app.config file in same folder exe? if not, copy there. starting debugging in visual studio builds everything, , copies output (including app.config) output folder, starting there.

xml - How to fix Python error importing ElementTree? -

i'm beginning learn python , here i'm trying read xml file using elementtree: import sys elementtree.elementtree import elementtree doc = elementtree(file="test.xml") doc.write(sys.stdout) however error: file "my_xml.py", line 2, in elementtree.elementtree import elementtree importerror: no module named elementtree.elementtree i have lib files in /usr/lib/python2.6/xml/etree/... doing wrong? thanks lot :) it should be: from xml.etree.elementtree import elementtree more information on can found @ python docs .

android - is it possible to selecte multiple contacts from contact picker? -

Image
i using contact picker, possible select multiple contacts of checkbox in contactpicker activity? there other possible way? p.s: using contactpicker activity,which helps single contact! :-( by using custom simplecursoradapter can create contact picker multiple selections. i guess want implement functionality shown below in image:

Multidimensional arrays in C# -

i defined multi dimensional array in c#: int[,] values = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } }; now values not longer in form in dictionary: values2.add("keya", new list<float> {1,4}); values2.add("keyb", new list<float> {2,5}); values2.add("keyc", new list<float> {3,6}); now i'm trying parse dictionary in 2 dimensional array again, somehow there problems: list<float> outlist = new list<float>(); values2.trygetvalue(values2.keys.elementat(0) string, out outlist); int[,] values = new int[outlist.count, values2.keys.count]; (int = 0; < values2.keys.count; i++) { list<float> list = new list<float>(); values2.trygetvalue(values2.keys.elementat(i), out list); (int j = 0; j < list.count; j++) { values[i, j] = convert.toint32(list.elementat(j)); } } this throws innerexception: system.indexoutofrangeexception. why? i'm not able convert values properly. edit: can as

generics - Std::multimap equivalent in delphi -

i looking way store tuples of key (guid) , several objects (all of same type) in hashmap. my approach define new generic type this: type tmultimap<t, v> = tdictonary<t, tobjectlist<v>>; //fails , but rejected compiler. is there readymade multimap implementaion available in delphi 2010? if not, how can create one? that doesn't compile, does: type tmultimap<t, v: class> = class(tdictionary<t, v>); but if want "real" multimap instead of building ad-hoc one, check out dehl . it's got several useful container libraries, including handful of multimap implementations.

java - Offline api references and recommended online ones? -

i want find offline reference on jsf components. i'm learning jsf 2.0 core jsf 2.0 book + glassfish + cdi. i've found online version such download.oracle.com/docs/cd/e17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/index.html , www.jsftoolbox.com/documentation/help/12-tagreference/index.jsf , far i've been unlucky find offline versions of api doc. could share offline versions of it, , maybe share other jsf 2.0 references ? thank ! if download mojarra binaries homepage (click orange button on right hand side), necessary documentation available in /docs/mojarra-x.x.x-fcs-documentation.zip of downloaded binary (where x.x.x version number). documentation contains offline versions of java api docs , js docs , managed bean docs , renderkit docs , taglib docs jsp , taglib docs facelets ). can download jsf 2.0 specification pdf file (click 1 "for evaluation"), contains among others several references configuration settings.

windows phone 7 - How to make multiple buttons with different backgrounds from one template in Expression Blend 4 -

i made simple button template rectangle "make control../button" command. now, need several buttons template each button must have different background image. tried in blend4 when change button background, button holds template background (or none, whichever set in template), ignoring image have set specific button. button template: btnmenu (no brush) -rectangle (no brush) -[contentpresenter] (some text) i apreciate advice. style: <style x:key="btnstylemenuhome" targettype="button"> <setter property="template"> <setter.value> <controltemplate targettype="button"> <grid x:name="btnmenu" width="90" height="70" margin="0" verticalalignment="center" horizontalalignment="center"> <grid.background>

How to read file with no-cache in Android? -

i working on test application on android platform. test write/read speed sdcard. write in c language ndk interface. first write for-loop create 256 files 512 random bytes in each. part works fine. open file flag o_creat|o_wronly|o_sync , mode 0666. after call write, sync() make sure data written on card. then write 2-level for-loop read these file test speed. use o_rdwr|o_sync open file. call read(). here thing: if first time run read part. first loop read take more time after. i'm sure because after first loop, program read cache not real physical card. i've tried o_direct flag read. error einval. in man page open, says maybe because of function not implement platform. do have idea on how read no-cache in android? you may need rooted phone disable operating-system-level caching. http://wiki.cyanogenmod.com/index.php?title=sdcardspeedtests that takes care operations large enough overwhelm on-card buffers.

java - Problem with converting a string to an integer and passing as an ID to a view -

there 20 buttons in activity . the ids r.id.buttonr1c1; r.id.buttonr1c2 .. , on ie. row 1, col 1.. now earlier had created 20 buttons. private button b1,b2,b3...; and b1=(button)findviewbyid(r.id.buttonr1c1); b2=(button)findviewbyid(r.id.buttonr1c2); .... , on. finally b1.setonclicklistener(this); b2.setonclicklistener(this); ... 20 so thought i'd create button array button barray[][]=new button{4][5]; for(int i=1;i<=4;i++) { (int j=1;j<=5;j++) { string t="r.id.buttonr"+i+"c"+j; barray[i-1][j-1]=(button)findviewbyid(integer.parseint(t)); } } gives error.. any help?? if have copied code directly, syntax wrong. button barray[][]=new button{4][5]; should be button barray[][]=new button[4][5]; note curly bracket instead of square bracket before 4. your next problem, trying value of r.id.something, have string representation of it. so, way know using reflection. what need is, button barra

apache - Simple .htaccess subdomain rewrite -

i know there lot of questions on here this... right feel deer stunned oncoming headlights... don't know start , option choose. my requirements simple. user goes http://application.domain.com or http://www.application.domain.com , real location of these files http://www.domain.com/application obviously needs done using wildcards domain (even if doesn't exist) triggers rewrite. i hope makes sense someone edit: should mention have added wildcard record dns entries in cpanel *.domain.com thanks tim i posted question onto serverfault.com , icyrock solved it. incase else wondering answer given here: https://serverfault.com/questions/203780/troubleshooting-a-htaccess-wildcard-subdomain-rewrite/203804#203804 tim

javascript - Ext GroupingView is not working simply listing the rows without grouping -

i trying use ext groupingview listing rows without grouping code groupingstore: //......................................................// _store = new ext.data.groupingstore({ autodestroy: true, proxy: new ext.data.memoryproxy({ items: [] }), remotesort: true, grouponsort: true, sortinfo: { field: 'xxxexamprofg', direction: "asc" }, groupfield: 'xxxexamprofg', reader: new yyy.xxxexamdetjsonreader() }); _gridpanel = new yyy.xxxexamdetgridpanel(ext.copyto({ id: _this.id + '-gridpaneld', store: _store, }, _this.initialconfig, [])); ext.apply(_this, { onrender: function(ct, position) { yyy.xxxexamdetlistfield.superclass.onrender.call(_this, ct, position); _this.wrap = _this.el.wrap({ cls: 'x-form-field-wrap' }); _this.resizeel = _this.positionel = _this.wrap; _gridpanel.render(_this.wrap); }, //........................................

javascript - HTML Website, Email issues -

hi need code send e-mail directly javascript, without load information on outlook server, or other email server. using html static website. there way achieve or have move asp.net system.mail library. any highly appreciated. regards you have different options, unfortunately no 1 fits definition you can use third party email form system. set contact form (fields, tos, ccs...) loaded page. you call server-side method managing request (so should go asp.net or other server side language) you have webservice way contact mail server , submit email requests, you'll need ajax call perform operation call user mail client (i.e outlook, thunderbird)

iphone - UIGraphicsBeginImageContextWithOptions undeclared -

Image
greetings! i'm attempting build iphone application makes use of ios4-only function: 'uigraphicsbeginimagecontextwithoptions'. i'm building iphone device 3.1.3 in xcode 3.2.1 , getting errors function not being defined. this stackoverflow page showed me should link weakly against uikit , check function null, doing this: however, build still fails with: anyone have idea? you need build against ios 4.x sdk, otherwise compiler has no knowledge of function.

how to parse string to int in javascript -

i want int string in javascript how can them test1 , stsfdf233, fdfk323, are show me method integer string. it rule int in of string. how can int @ last in string var s = 'abc123'; var number = s.match(/\d+$/); number = parseint(number, 10); the first step simple regular expression - \d+$ match digits near end. on next step, use parseint on string we've matched before, proper number.

Animate a <div> with jQuery -

i looking option move <div> on page when page loaded. <div> contains chat window. the box must fall down bottom of page , land on footer. how can achieved? check out .animate() function, can used smoothly move div's , other elements on page: animate . additionally, div can added @ page load such: $(document).ready(function() { $('body').append('<div id="chatwindow">hello world!</div>'); });

rhel5 - Cannot access an application hosted on jBoss remotely -

i have hosted application in machine running red hat enterprise linux 5. started jboss using command. ./run.sh -b 0.0.0.0 and ./run.sh -djboss.bind.address=<<server_address>> and ./run.sh --host=<<ipaddress>> but using of these commands cannot access application remotely. using the above commands cannot access application on host machine itself, using localhost ip address. not able figure out problem here. can ping linux machine other windows machines. check iptables rules not blocking firstly also running user? if so, not have permission bind port number less 1024. try telneting port server check service responding e.g. telnet localhost 8080 presuming running on 8080 in example above. you can drop iptables temporarily testing if safe by: /etc/init.d/iptables stop and restart them when you've finished with /etc/init.d/iptables start you can make permanent change iptables config adding following line /etc/sysconfig/i

internet explorer 8 - IE8 Flash canceling png tiling -

i have weird issue seems show on ie 8 far. i have semi transparent png tiling accross divs on site. works ok. put flash content on div on page, doesn't matter where, ie stops tiling png , stretches instead. occurs flash , on ie8. anyone had similar issue , know how fix? cheers instead of using 1x1 images, use 2x2 images. somehow solves it. by benjammin http://www.codingforums.com/showthread.php?t=204253

objective c - ObjectiveC, creating array of classes -

i have class contains values: @interface params : nsobject { [...] nsstring *fc; nsstring *sp; nsstring *x; nsstring *y; [...] @property (nonatomic, assign) nsstring *fc; @property (nonatomic, assign) nsstring *sp; @property (nonatomic, assign) nsstring *x; @property (nonatomic, assign) nsstring *y; [...] @end it's possible create in objective-c array of classes ? c# / java? myclass[] = new myclass[20] ??? a[0].fc = "asd" ? or equivalent? thanks, alberto while standard way nsarray , can c-style array well: int numobjects = 42; params ** params = malloc(sizeof(param*) * numobjects); (int = 0; < numobjects; ++i) { params[i] = [[[params alloc] init] autorelease]; } free(params); however, using nsarray simpler. :)

c# - Order between OnHandleCreated and OnLoad -

on windows form, there guaranteed firing order between these, know? on .net v2. appears former(sorry) first. thanks onhandlecreated comes first. from documentation : the form , control classes expose set of events related application startup , shutdown. when windows forms application starts, startup events of main form raised in following order: control.handlecreated control.bindingcontextchanged form.load control.visiblechanged form.activated form.shown

Simple XML Question -

alright, using xml editor check validation i'm getting "validation stopped @ line 2, column 8: no declaration found element 'staff'. know why is? also, every 3 staff members of different type , each type include different elements (adjunct staff members have email, name, position instance, while fulltime types have information of elements.) bad form have element data left blank? if they're staffmembers of different type, alright rid of elements or every staffmember need same elements way through? thanks! <staff> <staffmember type="fulltime"> <name>richard baskerville</name> <position>professor</position> <officephone>(404) 413-7362</officephone> <building>robinson college</building> <room>919</room> <url>www.cis.gsu.edu/~rbaskerv</url> <email>rbaskerville@cis.gsu.edu</email> <degree