Posts

Showing posts from September, 2012

objective c - How to pass a returning NSMutableArray from a method into a NSMutableArray -

i know how call method nsobjectclass returns nsmutablearray , save returning mutablearray nsmutablearray in calling class. effectively how looks nsobject class has method return value - (nsmutablearray *)mymethod { // stuff return mymutablearray } the class calls method dose of initialization can use mymethod method uncertian of how returning mymutablearray mutablearray in class... is like thenameofthensobjectclass *myobjclass = [[thenameoftheobjectclass alloc] init]; anothermutablearray = [myobjclass mymethod]; because thats trying @ moment , getting warning incompatible pointer types assigning 'nsmutablearray *__strong' 'thenameofthensobjectclass *' any appreciated. if have method following on class called baginator : - (nsmutablearray *) mutabledoggybags; and want call method then: baginator *b = [baginator new]; nsmutablearray *bags; bags = [b mutabledoggybags]; parsing question, sounds equivalent of mutabledoggybags dec

c++ - Declare 3d array with blitz++ -

how can declare 3d array(like arrays nested in arrays in turn nested in arrays) blitz++? dimensions 3,4,5. how access said array elements? tell me how size of each dimension of multi dimensional array? c++ vectors there onedvec.size(), twodvec.size() or twodvec[di].size() etc. // declare blitz::array<double, 3> blitzarray( 3, 4, 5 ); // access blitzarray(0,0,0) = 1.0001;

c# - exit with escape key in for loop -

i have loop , working : (int x = 0; x < nombres.length; x++) { validxx.text = x.tostring(); validxy.text = nombres.length.tostring(); origen = nombres[x]; cambia = nombres[x]; pedrito = control.validardocumentoxml(cambia); if (pedrito == true) { } else /* file.move (origen , destino );*/ try { } catch(ioexception iox) { messagebox.show(iox.message); } { /* corrupto[x] = cambia; */ messagebox.show("malo" + cambia); } } i want o break loop escape key , have try : private void importar2_keydown(object sender, keyeventargs e) { if (e.keycode == keys.escape) { } } but can not write key_down loop. you this: bool escpressed = false; .... //run loop in different thread

ios - What is the proper way to handle retina images from resized nsdata? -

when user selects image photo library, i'm resizing , uploading server , @ other point in app user can view photos. (i'm simplifying work flow) the uiimageview on "detail" screen 320 x 320. based upon below method should using: uiimage *image = [uiimage imagewithcgimage:img]; or uiimage *image = [uiimage imagewithcgimage:img scale:[uiscreen mainscreen].scale orientation:img.imageorientation]; part b when request download image (nsdata) should use imagewithcgiimage or imagewithcgiimage:scale:orientation - (uiimage *)resizedimageforupload:(uiimage *)originalimage { static cgsize __maxsize = {640, 640}; nsmutabledata *data = [[nsmutabledata alloc] initwithdata:uiimagejpegrepresentation(originalimage, 1.0)]; cfmutabledataref dataref = (__bridge cfmutabledataref)data; cgimagesourceref imgsrc = cgimagesourcecreatewithdata(dataref, null); cgfloat width = [originalimage maxdimensionforconstraintsize:__maxsize]; nsnumber *maxwidth = [nsnum

c# - Self-hosting ServiceStack REST Service on local network -

i wondering if - have local network (wireless, computer , laptop connected it) , i've tried hosting rest service developed servicestack on it. if run application on computer (a console app now) , try access service using machine ip or 127.0.0.1 works fine - if try , access laptop, using computer's ip stalls, , rest service never called. i've tried turning off firewalls etc, running in admin mode still nothing.. missing simple working? any appreciated! some of code samples (my apphost class inheriting apphosthttplistenerbase) restservicetostart.value.init (); restservicetostart.value.start (_hosturi); where main machine, _hosturi set "http://my-ip-address:8080/" you haven't listed code use start apphost (please descriptive when asking questions) i'm going assume you're not listening http://*:{port}/ , e.g. self hosting wiki : var apphost = new apphost(); apphost.init(); apphost.start("http://*:1337/"); the * wildcar

arrays - How would I print this in PHP -

stdclass object ( [entities] => stdclass object ( [urls] => array ( [0] => stdclass object ( [url] => asdl;kfas.com [expanded_url] => http://howdoiprintthisurl.com [display_url] => asdlkfsldfj.com ) ) ) ) when print_r variable $fullurl code above. how print part says ' http://howdoiprintthisurl.com '? thanks print $fullurl->entities->urls[0]->expanded_url;

expert system - CLIPS infinite facts -

i developing expert system make admission decisions using pyclips. however, code kept generating 'out of memory' errors. think have isolated problem. wrong clips file. hoping can see i'm doing wrong here. simple version of code....i simplified in order debug it: here's template, , sake of argument, there's 1 rule: if transcript received, app-complete attribute marked true. ; template application facts (deftemplate application "structure of application" (slot app-id (type integer)) (slot app-complete (type symbol)) (slot transcript-received (type symbol)) ) (defrule complete "rule app completeness" ?f <- (application (transcript-received yes) ) => (modify ?f (app-complete true) ) ) ; end. so when (assert (application (app-id 123) (transcript-received yes))) then, fact added. when click run though....the window in clips starts getting overloaded thousands of facts...the app-complete attribute lo

performance - Product of two Toeplitz matrices? -

the o(n log n) algorithm product of toeplitz matrix , vector of correct length well-known: put in circulant matrix, multiply vector (and subsequent zeroes), , return top n elements of product. i'm finding trouble finding best (time-wise) algorithm multiplying 2 toeplitz matrices of same size. can give me algorithm this? here's o(n^2)-time algorithm. to compute 1 of diagonals of product matrix, need compute dot products on length-n windows of length-(2n-1) lists sliding in lockstep. difference between 2 successive entries can computed in time o(1). for example, consider product of e f g h o p q r s d e f g h m o p q r c d e f g l m o p q b c d e f k l m o p b c d e j k l m o the 1,1 entry eo + fm + gl + hk + ij . 2,2 entry dp + eo + fm + gl + hk , or 1,1 entry minus ij plus dp . 3,3 entry cq + dp + eo + fm + gl , or 2,2 entry minus hk plus cq . 4,4 entry br + cq + dp + eo + fm , etc. if implement in floating point, mindful of catastr

c++ - Nice representation of byte array and its size -

how represent byte array , size nicely? i'd store (in main memory or within file) raw byte arrays(unsigned chars) in first 2/4 bytes represents size. operations on such array not well: void func(unsigned char *bytearray) { int size; memcpy(&size, bytearray, sizeof(int)); //rest of operation when know bytearray size } how can avoid that? think simple structure: struct bytearray { int size; unsigned char *data; }; bytearray *b = reinterpret_cast<bytearray*>(new unsigned char[10]); b->data = reinterpret_cast<unsigned char*>(&(b->size) + 1); and i've got access size , data part of bytearray. still looks ugly. recommend approach? you're re-inventing "pascal string" . however b->data = reinterpret_cast<unsigned char*>(&(b->size) + 1); won't work @ all, because pointer points itself, , pointer overwritten. you should able use array unspecified size last element of structure: struct by

java - Testing model classes in Android -

i need test model classes of project. here 1 of classes public class tmydata{ private mvar1; private mvar2; ... private tmydata(){ } public static tmydata fromstring(string str){ ... } public string tostring(){ ... } } simply, test should be: 1) create random tmydata 2) call tostring 3) call fromstring 4) check same the problem create random tmydata. testing class separate 1 (tmydatatest), cannot following: tmydata p = new tmydata(); //i can't, because private p.mvar1 = ...; // can't because private i don't want change variables/methods visibilities because of testing... , don't want user have access private variables (no getters nor setters) many people must have had similar problems, projects have own model. proper way test it? i can see solution doing reflection. field f = tmydata.getclass().getdeclaredfield("mvar1"); //nosuchfieldexception f.setaccessible(true); f

java - Making my method return a string -

i trying make program deal hand of cards randomly generate. reason can't print string method in main program. i'm not sure if i'm missing or if it's wrong, i'm rather new java scene. got. public class deck { public static void main (string args[]) { builder(); out.println("your hand is:" card ) } // build deck public static string builder() { // need pick random array random r = new random(); // array, make 1 need [] before string //this how ending string[] suitsa = { "hearts ", "diamonds ", "spades ", "clubs" }; // number array string[] facea = {"1","2","3","4","5","6","7","8","9","10","king ", "queen ", "jack ", "ace ",}; // picks random set arrays string suit = suitsa[r.nextint(4)]; string face = facea[r.nextin

firefox - Why is Chrome not showing pictures from an S3 bucket? -

in site, when using firefox can see image http://live.user.data.s3.amazonaws.com/user/photo/7583/thumb_profile_jz_blue_shirt_cropped_3_jan_2013_color_adj.jpg however, when trying open url in chrome nothing happens - why be?

ruby - having trouble setting up simple rectangular collisions in chipmunk -

Image
recently i've been trying create i've wanted, never had skill , time - computer game. more precise, homage / clone of 1 of many of favourite games. start simple i've decided create classic 2d platform based on castlevania series. being ruby programmer i've decided use gosu . decided don't want reinvent wheel i'm going use chipmunk . after few days, i've ended having inexplicable collision detection problems. i've added boundary-box drawing functions see hell going on. as can see, belmont collides blocks of walls he's not remotely close touching. since demo game included gosu gem works fine, there must wrong i'm doing, don't udnerstand how polygon shape defined , added space. i'm pretty sure it's not draw it. there's public repo game, can see how walls ( brush < entity ) , player ( player < entity ) defined , indeed have simple, rectangular polygon shape. walls not added space (they rogue ), player is. i've

javascript - dynamically add item to angularjs ng-repeat -

i have directive generates drag/drop reorderable list add , remove functionality. if click in container, input added dynamically, type in , when type comma, value typed pushed list used ng-repeat build list. (should kinda familiar users of site :) ) this works awesome when initial object backing not null. when object begins null , try add first item (by detecting null , scope.$apply initialization)the markup not generated. here plunk show mean. http://plnkr.co/edit/momlgpfy82khrpwxgr8v?p=preview in app, data coming external source, can't ensure non-null lists. how can angular respond array initialization (and later push)? set list empty array...whenevr new item pushed array angular listeners update directive http://plnkr.co/edit/h3goptx6chh1wjcm9qrv?p=preview

windows - Is it valid for a C++ compiler to implicitly instantiate ALL member functions of a template class? -

suppose have public class , private implementation class (e.g. pimpl pattern), , wish wrap private class template smart pointer class checked delete, follows: publicclass.h class privateclass; // simple smart pointer checked delete template<class x> class demo_ptr { public: demo_ptr (x* p) : the_p(p) { } ~demo_ptr () { // boost::checked_delete: don't allow compilation of incomplete type typedef char type_must_be_complete[ sizeof(x)? 1: -1 ]; (void) sizeof(type_must_be_complete); delete the_p; } private: x* the_p; }; // public-facing class wishes wrap private implementation guts class publicclass { public: publicclass(); ~publicclass(); private: demo_ptr<privateclass> pvt; }; publicclass.cpp #include "publicclass.h" class privateclass { public: // implementation stuff goes here... privateclass() {} }; //---------------------------------------------------------------------------

Install imagick php module in dreamhost -

i'm tryng install imagick in vps @ dreamhost , when type "phpize" in imagick-3.0.1 folder this: configuring for: php api version: 20041225 zend module api no: 20060613 zend extension api no: 220060519 configure.in:3: warning: prefer named diversions configure.in:3: warning: prefer named diversions i'm following tutorial: http://wiki.dreamhost.com/imagemagick_and_imagick_php_module_on_shared_hosting#configure_php_to_use_this_extension any apreciated. the problem configure script looking magickwand.h file in directory: /home/bylifeweb/local/include/imagemagick/wand/magickwand.h but file in directory /home/bylifeweb/local/include/imagemagick-6/wand/magickwand.h to fix made symlink imagemagick imagemagick-6 , ran configure script again, worked fine time , able run make. libraries have been installed in: /home/bylifeweb/build/imagick-3.0.1/modules

c# 4.0 - MSBuild ExtensionPack for remote installation required more configuration -

is there experienced msbuild.extensionpack have been using install windows service remote machine. the service installed in remote location. problem installed executing machine dependencies , configurations files need in remote locations couldn't found on there. is there way call (.msi) file has been created using visual studio setup project? , use install service. code looks @ moment: <project toolsversion="4.0" defaulttargets="default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <propertygroup> <user>username</user> <password>password</password> <remotemachine>remote machine name</remotemachine> <remoteuser>remote user</remoteuser> <remoteuserpassword>remote password</remoteuserpassword> </propertygroup> <import project="$(msbuildextensionspath)\extensionpack\4.0\msbuild.extensionpack.tasks"/> <target name=

sample - How to set I/O sampling rate to more than 65535 ms (FFFF) -

i'm using xbee module series 2 firmware znet2.5 router/end device api . i send adc sample, saw ir parameter can @ maximum 65535 milliseconds; read ir parameter collecting more samples before transmit, can't find in firmware version. so possible can't use sample rate longer 65535 ms? i found solution, can use xbee sleep time: i set cyclic sleep period (sp) af0 (28 s), number of cycles power down i/o (sn) 4, , sleep option (so) 4, enabling extended cyclic sleep. in way, module sleeps per sp*sn seconds 28 s * 4 = 112 s.

html - Why does the text in the span tags not center? -

i not sure why text not center in title class span. <div id="vid_display"> <span class="title">sampletext</span></br> <span class="desc">sample desc</span> </div> stylesheet #vid_display { height: 500px; width: 700px; box-shadow: 10px 10px 5px #888; } .title { font-family: cursive; font-size: 20px; font-style: bold; text-align: center; } text-align doesn't have effect on inline elements span tags. need apply text-alignment onto parent element display:block; <div> or <p> wrapping span. you might better off this: html <div id="vid_display"> <p class="title">sampletext</p> <p class="desc">sample desc</p> </div> css .title { text-align: center; } update: here working sample: http://codepen.io/anon/pen/jenys

iframe - Adding jquery event listener for google translate -

i'd perform jquery function after translates site different language using google translate dropdown . here's have tried no luck: $('document').ready(function () { $(".goog-te-menu-value").change(function() { alert("my code working!"); }); }); on normal dropdown work fine, i'm having trouble targeting google translate div.. believe in iframe. there anyway target div thats in iframe use in jquery? or maybe workaround? if has ideas on appreciated. i added google translate widget site , of course, broke layout! so reviewed scripts used widget. first, cannot add event listener button because google translate widget has 1 assigned. second, discovered after translates, gt widget sets tag have class. so, gave tag id of "docstart" , created following script. note: breaks firefox v. 21, works in ie 9. haven't tested in other browsers. function layoutfix() { // code here fix layout mylistener(); };

c++ - Binary search for insert char string. Where is the bug? -

i have array of strings. must find 1 char string in array of strings binary search algoritm. if there 1 string function must return position , return true otherwise function must return position insert string in array , false. have somewhere bug, dont know (( example: bool binary_search ( char * arr_strings[], int & position, const char * search_string ) { int start = 0 ; int end = 10 - 1; // arr_strings [10] int for_compare; int middle; while ( start <= end ) { middle = ( start + end ) / 2; for_compare = strcmp ( arr_strings[middle], search_string ); if ( for_compare > 0 ) { start = middle + 1; } else if ( for_compare < 0 ) { end = middle - 1; } else { // if search_string found in array, function return position in array of strings , return true position = middle; return true; } } //

google drive sdk - updateToken auth error when trying to work with application data folder -

i have working drive-integrated app, javascript , go-based, following scopes: https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive now try work application folder. if don't change scopes, expected, error claiming app scope not set properly. add following scope (in api-console , @ app): https://www.googleapis.com/auth/drive.appdata now unfortunately error @ oauth.updatetoken googelapi function following error message: oautherror: updatetoken: 400 bad request have missunderstood how application folder supposed used ? you need show user dialog again , retrieve new token instead of updating existing. create new auth code url config.authcodeurl() , ask user permissions. once permissions granted user, exchange code google endpoints calling t.exchange(code) . var config = &oauth.config{ clientid: "your_client_id", clientsecret: "your_client_secret",

Any examples of loading to BigQuery using a POST request and Java client library? -

does have examples of creating new insert job bigquery using both: the bigquery java client library creating load job post request documented here: https://developers.google.com/bigquery/loading-data-into-bigquery#loaddatapostrequest you need call bigquery.jobs().insert(...) method. i don't know have done yet should have authenticated client api @ least like: bigquery = new bigquery.builder(http_transport, json_factory, credentials) .setapplicationname("...").build(); that's simplified version of insertrows method wrote using google-http-client library java , bigquery-api (you should check dataset exists, validate ids etc.): public long insertrows(string projectid, string datasetid, string tableid, inputstream schema, abstractinputstreamcontent data) { try { // defining table fields objectmapper mapper = new o

Python Beginner - How to generate a list and frequency from another list -

given: [['x','a'], ['y','b'], ['z','a']] i list of elements , count frequency of 2nd element: [['x','a',2], ['y','b',1], ['z','a',2]] >>> collections import counter >>> l = [['x','a'], ['y','b'], ['z','a']] >>> freq = counter(y x, y in l) >>> [[x, y, freq[y]] x, y in l] [['x', 'a', 2], ['y', 'b', 1], ['z', 'a', 2]]

iphone - UISearchDisplayController not correctly displaying custom cells -

so have tableview has sections , rows, , uses custom cell class. custom cell has image view , few labels. table view works fine, , search works, except search not display of labels in custom cell class, imageview correct image. quite confused why is, since image still displayed, not labels. here code. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { //todo: problem search view controller not displaying labels cell, needs fixing jsbookcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; if(cell == nil) { cell = [[jsbookcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } jsbook *book = nil; //uses appropriate array pull data if search has been performed if(tableview == self.searchdisplaycontroller.searchresultstableview) { book = self.filteredtabledata[(nsuinteger)indexpath.section][(nsuinteger)indexpath.row]; } else { book = self.

ios - App Store Localization -

this ipad , iphone app. does localizing metadata , app name hurt app store seo @ apps default localization? or more keywords better? can app have different names same app in different countries? i searched app in spanish usa ipad , came though spanish meta data have in spanish localization. name of app came in english though in spanish localization have spanish name (is there way check see have been able find app english name). thanks.

arrays - Counting duplicates in C -

if have array set as: test[10] = {1,2,1,3,4,5,6,7,8,3,2} i want return number 3 since there duplicate 1, duplicate 2 , duplicate 3. how can achieve this? efficiency doesn't matter. first must sort array easier find duplicates. here example of sort (bubble sort): void bubblesort(int numbers[], int array_size) { int i, j, temp; (i = (array_size - 1); > 0; i--) { (j = 1; j <= i; j++) { if (numbers[j-1] > numbers[j]) { temp = numbers[j-1]; numbers[j-1] = numbers[j]; numbers[j] = temp; } } } } then loop through again , find if values[i] == values[i+1] note: when create loop make 1 length shorter compensate values[i+1] not go out of bounds.

php - Multi-Dimensional Array Formatting -

Image
i'm working on personal project create keyword generating tool. have setup recursive function loop through multi-dimensional array find out possible combinations in supplied list of keywords. public function recurseful($start, $args) { if (is_array($args)) { foreach ($args[0] $value) { $this->output[] = trim("{$start} {$value}"); if (count($args) > 1) { $this->recurseful($value, array_slice($args, 1)); } } } return; } i'm passing in: $data = array( array('new york', 'new york city'), array('hotel', 'lodging','motel'), ); $results = recurseful('', $data); it iterates through , gives me list of various keyword combinations. however, it's returning them in single array of $output . function designed take values $data[0] (or rather $args[0]) , match them other keywords given. i'd rather them

java - A variable that holds coordinates of last mouse click only -

this i'm trying accomplish. want item show on screen @ last position mouse had clicked. sort of works, every time click elsewhere said item moves there well. want static. here's code: global variables px , py. used hold mouse clicks: private int px = 250; // initial coordinates private int py = 250; mouse clicks feed global px , py: private void testpress(int x, int y) { if (!ispaused && !gameover) { // something.. px = x; py = y; girlp.setdestination((px-(girlp.getimage().getwidth(this)/2)), (py-(girlp.getimage().getheight(this)/2))); //system.out.println(px + ", " + py); } } there px , py updated new values. want way hold last mouse click see this question understand how listen mouse events you can use event.clickx , event.clicky coordinates within element listen mouse click on, or use event.screenx , event.screeny absolute mouse coordinates within document.

Magento EcomDev PHPUnit Customer fixtures are not being loaded -

i have case want check if customer exists in database. have created fixture file this: scope: website: - website_id: 1 code: main name: main website default_group_id: 1 group: - group_id: 1 website_id: 1 name: main website store root_category_id: 8 default_store_id: 1 store: - store_id: 1 code: default website_id: 1 group_id: 1 name: default store view is_active: 1 eav: customer: - entity_id: 13 entity_type_id: 1 website_id: 1 email: example@example.com group_id: 1 store_id: 1 is_active: 1 firstname: john lastname: smith when run test, error: zend_db_statement_exception: sqlstate[23000]: integrity constraint violation: 1052 column 'sort_order' in order clause ambiguous this error occurs when load fixture, think has model_fixture_eav class. not sure methods should implement create eav model customers. has managed import custo

sublimetext2 - Setting up Less-Build in sublime text 2 - Mac OS X -

i've browsed , installed following package https://github.com/berfarah/less-build-sublime/blob/master/readme.md i've created file called style.less , inserted following code (just experiment) @bgcolor: red; body { background: @bgcolor; } after saving file , hitting command + b build less file. i'm expecting style.css created when hit command + b instead, message on console saying: [errno 2] no such file or directory [cmd: [u'lessc', u'/users/staff/desktop/site/day2/css/style.less', u'/users/staff/desktop/site/day2/css/style.css', u'--verbose']] [dir: /users/staff/desktop/ paperbusiness /day2/css] [path: /usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin] [finished] what doing wrong? is there need doing in packages/less-build/changelessbuildtype.sh it contains: #!/bin/bash ps3='please enter choice: ' options=("normal" "direc

vb.net - CSV duplicate field names -

i have csv file extract core system. recent development change system has made there csv file data contain duplicate column/field names. so fields appear more once. creator first name creator last name creator salary number revenue contact sales team channel this data upload via ssis/dts package. package won't run or work duplicate field names. need remove or rename duplicate fields. so thinking of creating c# or vb script renames duplicate field names post fix of 1 when counts field name of more 1. is there easy way of doing through microsoft.visualbasic.fileio.textfieldparser or similiar? not sure if has encountered similiar issue. i have added script task runs visual basic 2008 code (below) wip; public sub main() 'check if file exist dim filename string = dts.variables.item("filename").value if not system.io.file.exists(filename) exit sub end if dim csvfilearray(1, 1) string dim newcsvfilearray(1, 1) s

List in property grid c# -

i have list used property grid , want eliminate possibility of adding via button - add. but want able edit data are. my list: private list<pos> _position = new list<pos>(); public list<pos> position { { return _position; } set { _position = value; notifypropertychanged("position"); } } pos.cs: public class pos { public string name { get; set; } public double postion { get; set; } public pos() : this(null, double.nan) { } public pos(string name, double postion) { this.name = name; this.postion = postion; } } i tried put [readonly(true)] above list, still gives option of adding. does have idea how it? i canceled option add / delete, this: i created generic class: public class poslist<t> : list<t>, icollection<t>, ilist { public valueslist(ienumerable<t> items) : base(ite

c# - Routing JSON string in ServiceStack -

i have service accepts encrypted json data want decrypt json data using external service can pass unencrypted data serialized , handled appropriate service handler. the dto encrypted data looks this: [route("/encrypted", "post")] public encrypted { public string data { get; set; } // value stored here encrypted } here's sample dto decrypted data: [route("/book", "post")] public book { public string author { get; set; } } the decryption , book services this: public class decryptionservice : service { public string post(encrypted request) { // decrypt request.data , return decrypted json string } } public class bookservice : service { public object post(book request) { // return list of books based on author } } in servicestack apphost read raw json data request input stream deserialize encrypted object, calling encryptedservice class decrypt data , return unencrypted json st

cucumber - Should Gherkin scenario always have When step? -

when defining scenarios in gherkin there no clear distinction between given , when steps, i.e. there no active interaction system user , purpose of validation verify how system should under circumstances. consider following: scenario: show current balance given user on account page user should see balance vs scenario: show current balance when user goes account page user should see balance i not sure use second variant. if have multiple scenarios sharing context "user on account page" , of them have additional user actions while others don't, seems me should valid keep "user in account page" given step though may lack "when" scenarios. valid approach? formally , technically cucumber/specflow doesn't require write when-step or rather given/when/then's executed in order written in scenario. in regard don't need when-step. but, andy waite wrote about, when-step shows on action or event system takes "setup" ne

eclipse plugin - Cygwin + Linux NDK on Windows -

i think sounds strange it's situation now. i have android jni project on eclipse (windows), after friend 's configuration in eclipse on ubuntu, auto-build plugin on eclipse couldn't work (it raise error: ...ld.exe: can not find -l): **** build of configuration default project tachopro **** ndk-build.cmd sharedlibrary : libtachometer_core.so e:/android/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find -ltachometer_core_armv7_a_cortex_a9 collect2: ld returned 1 exit status make: *** [obj/local/armeabi-v7a/libtachometer_core.so] error 1 **** build finished **** he said must download ndk linux use cygwin build. error (seems more complex before) arrives: http://www.mediafire.com/view/?o0nthcn3hn0b0ix if has been through this, please give me advices... >"< if you're working on windows, have use windows version of android

Android Runtime Exception while creating expandable list -

i'm trying create expandable list shows list of menu items. while execution, on button click new activity leads fatal exception. my source code shown below: public class orders extends expandablelistactivity{ //public string name="dishname"; //expandablelistview explistview; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.orders); simpleexpandablelistadapter explistadapter= new simpleexpandablelistadapter( this, creategrouplist(), r.layout.group_row, new string[] { "group item" }, new int[] { r.id.row_name }, createchildlist(), r.layout.child_row, new string[] {"sub item"},

c# - What is the 2013 way to load an assembly at runtime? -

i want load several assemblies @ runtime plugin directory. core app not have references assemblies beforehand, assemblies implement interface given core app, have reference it. i found , article 2005 explaining need make work . currently have code, linq'd version of find in article above: foreach ( imodule module in directory.enumeratedirectories(string.format(@"{0}/{1}", application.startuppath, modulepath)) .select(dir => directory.getfiles(dir, "*.dll")) .selectmany(files => files.select(assembly.loadfrom) .selectmany(assembly => (from type in assembly.gettypes() type.isclass && !type.isnotpublic let interfaces = type.getinterfaces()

ruby on rails - rolling back a deployment on heroku then uploading another version without roll forward? -

i rolled app on heroku v7 v4 (for example) previous version week ago. since v7 introduced errors, want upload new version. tried deploy new version on heroku got error error: failed push refs 'git@heroku.com:boiling-bastion-xxxx.git' prevent losing history, non-fast-forward updates rejected merge remote changes (e.g. 'git pull') before pushing again. see 'note fast-forwards' section of 'git push --help' details. since don't want v7 , want upload new version instead, still run git push ? don't want roll forward latest version (v7) introduced errors. you can use, git push heroku master -f

file io - PHP: headers already sent when using fwrite but not when using fputcsv -

i know theory behind error driving me crazy again. i'm using tonic in application. library redirect traffic dispatch.php script executes appropriate resource , resource return response displayed (output) dispatch.php . the output method of response this: /** * output response */ public function output() { foreach ($this->headers $name => $value) { header($name.': '.$value, true, $this->responsecode()); } echo $this->body; } so afaik tells can't write php output in resource . i have resource dynamically generates csv input csv , outputs browser (it converts 1 column of data different format). $csv = fopen('php://output', 'w'); // sets header $response->__set('contentdisposition:', 'attachment; filename="' . $filename . '"'); while (($line = fgetcsv($filepointer, 0, ",", '"')) !== false) { // generate line fputcsv($csv, $line); } fclos

UIMA integrate DLL -

how can uima integrate dlls?i want make system ,it can integrate components in uima ! how can it? you write c++ uima annotator, , call dll it. work? uima has exmaple in examples/src/exampleapplication.cpp , or call c++ annotator java uima pipeline.

php - How to set page title in single page site -

hi have single page ajax website single page loading pages set page title depending on current view. i have tried using <title><!--title--></title> <? $pagecontents = ob_get_contents (); // page's html string ob_end_clean (); // wipe buffer // replace <!--title--> $pagetitle variable contents, , print html echo str_replace ('<!--title-->', $pagetitle, $pagecontents); ?> i have added titles page links <li class="menu-link"> <a href="index.php?page=home"><img src="images/menu/home.png" width="72" height="72" alt="home" />home</a> <?php $pagetitle = 'saunders-solutions freelance design , development'; ?> </li> <li class="menu-link"> <a href="index.php?page=about"><img src="images/menu/about.png" width="72" height="72" alt=&qu

c# - Isolated Storage not working on windows phone app -

Image
i have isolated storage function write storage : public static void writeisolatedstorage(object objecttostore, storagetype key) { using (var storage = system.io.isolatedstorage.isolatedstoragefile.getuserstoreforapplication()) using (var storagefile = storage.createfile(key.tostring())) { var xmlserializer = new system.xml.serialization.xmlserializer(typeof(string)); switch (key) { case storagetype.usercredentials: xmlserializer = new system.xml.serialization.xmlserializer(typeof(dmwfusercredentials)); break; case storagetype.backgroundagentusercredentials: xmlserializer = new system.xml.serialization.xmlserializer(typeof(dmwfusercredentials)); break; case storagetype.userprofile: xmlserializer = new system.xml.serialization.xmlserializer(typeof(dmwfuser)); break; case storagetype.inboxitems:

Select from XElement with where statement using linq -

i have , xelement object built xml looking this: <root> <oppurtunities> <oppurtunity> <title> account manager</title> <company>company name</company> <location>boston</location> <enddate>2013-04-11</enddate> <c>acce</c> <id>mnyn-95zl8l</id> <description>this detailed description...</description> </oppurtunity> now need description value specific oppurtunity node, meaning want description id specific. need this: //my xelement object called oppurtunities oppurtunities = new xelement((xelement)cache["oppurtunities"]); string id = request.querystring["id"]; //i want of course not working var description = (from job in oppurtunities .element("oppurtunities") .element("oppurtunity") .element(&qu

android - changing activity on sliding the screen -

i have 3 activities in application . first 1 default activity when slide right left second activity should open layout , when slide left right third 1 should open layout want change activities on sliding not background or layout.. give me appropriate way this. i m using tab view not giving slider functionality public class tabdemo extends tabactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.tab_host); tabhost tabhost=gettabhost(); // no need call tabhost.setup() //first tab tabspec spec1=tabhost.newtabspec("activity 1"); spec1.setindicator("activity 1"); intent in1=new intent(this, activity 1); spec1.setcontent(in1); tabspec spec2=tabhost.newtabspec("activity 2"); spec2.setindicator("activity 2"); intent in2=new intent(this,activity 2);

WPF Canvas, accept mousewheel events -

i have custom canvascontrol draws ground plane. add new canvas canvascontrol draw on. setup mousewheel events. canvas drawingcanvas = new canvas(); this.children.insert(0, drawingcanvas); mousewheel += new mousewheeleventhandler(groundplane_mousewheel); a lot of elements drawn drawingcanvas never changed (apart zoom modifications) means want set ishittestvisible = false improve performance (the gain massive) whilst still accepting mousewheel events on canvascontrol itself. unfortunately when lose ability use mousewheel . there i'm missing? drawingcanvas.ishittestvisible = false; in order input events directly on top level canvas, have set background property, example transparent : background = brushes.transparent; mousewheel += groundplane_mousewheel;

Second Activity doesnt start , App force closes : Fatal exception main ; java.lang.ClassCastException:android.app.Application -

i trying make app gives list of installed apps , when item clicked , starts activity states permissions required installed apps. got installed application list, when click app instead of starting new activity , application force closes. mainactivity package com.example.appslist; import java.util.list; import com.example.appslist.adapter.apkadapter; import com.example.appslist.app.appdata; import android.os.bundle; import android.app.activity; import android.content.intent; import android.content.pm.packageinfo; import android.content.pm.packagemanager; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.listview; public class apklistactivity extends activity implements onitemclicklistener { packagemanager packagemanager; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); pack