Posts

Showing posts from March, 2012

java - void type not allowed here in servlet -

java - void type not allowed here in servlet - this java class : public string year, title,detail; public league(string year,string title,string detail) { this.year=year; this.title=title; this.detail=detail; } public void gettitle() { system.out.println(""+year+""+title+""+detail+""); } this servlet: protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { processrequest(request, response); //creats set of league leaguelist=new linkedlist(); leaguelist.add(new league("2003","spring","soccer league(spring`03)")); leaguelist.add(new league("2003","summer","summer soccer fest")); leaguelist.add(new league("2003","fall","fall soccer league")); leaguelist.add(new league("2004","spring","summer soccer fest...

html5 - Avoid scrolling to off-canvas content -

html5 - Avoid scrolling to off-canvas content - i doing little tutorial on responsive design, have problem. i going classic off-canvas menu swiping in left side, when enable menu can still scroll horizontally see total content, rather using menu-button hide menu. see next pen: http://codepen.io/webconsult/pen/jmcit note codepen hides tag. meta viewport tag using: <meta name="viewport" content="width=device-width, initial-scale=1"> i suspecting should set the viewport tag differently? can play around viewport tag clicking on settings-cog in html frame. add css body { overflow-x:hidden; } you have .site-wrapper { width:100%; } according css on larger screens main content occupies 100% of width. on smaller screens when open off-canvas menu - produces horizontal-scroll because .site-wrapper + off canvas occupy more 100% of width - 100% warrper + 75% aside.navigation . by adding overflow-x:hidden; on body scroll-bar. ...

bolt cms - Is there a "sustainable" way to add something to the dashboard? -

bolt cms - Is there a "sustainable" way to add something to the dashboard? - it looks it's easy add together stuff dashboard.twig, best practice, keeping future bolt updates in mind? 1 line of code referring include? or there improve way? for bolt 1.6, take @ google analytics extension, since adds dashboard widget. with 2.0 way works might change, though. we'll need figure out want extensions able add together widgets page. bolt-cms

cmake - OpenCV 2.4.9 and CUDA 6.5 -

cmake - OpenCV 2.4.9 and CUDA 6.5 - i upgraded cuda 6.5, , recompiled succefully opencv 2.4.9 on ubuntu 14.04. however when recompiled project using opencv , cmake, got next configuration error: -- gcc detected, adding compile flags cmake error @ /usr/share/cmake-2.8/modules/findpackagehandlestandardargs.cmake:108 (message): not find cuda: found unsuitable version "6.5", required exact version "6.0" (found /usr/local/cuda-6.5) phone call stack (most recent phone call first): /usr/share/cmake-2.8/modules/findpackagehandlestandardargs.cmake:313 (_fphsa_failure_message) /usr/share/cmake-2.8/modules/findcuda.cmake:806 (find_package_handle_standard_args) /usr/local/share/opencv/opencvconfig.cmake:215 (find_package) cmakelists.txt:9 (find_package) -- configuring incomplete, errors occurred! see "/home/andrey/data/projects/groups_code/lulu/build-ubuntu/cmakefiles/cmakeoutput.log". how prepare one? need reinstall cmake, or upgrade mo...

android - Image corrupted when sent via bluetooth -

android - Image corrupted when sent via bluetooth - i developing client app in google glass takes image , sends byte array via bluetooth android phone has server app installed in it. after sending info phone, tried create bitmap byte array , display in imageview . exact number of bytes sent received in server. when decode byte array create bitmap, image looks corrupted. overall image looks right there rectangular green/blue/red bars across image. lot, few. sometimes, lower part of image gray. what issue here? or can seek find problem. client code writing outputstream: int buffersize = 512; bytebuffer bb = bytebuffer.allocate(buffersize); bb.aslongbuffer().put(bytes.length); mmoutstream.write(bb.array(), 0, buffersize); //write size of info sent first mmoutstream.write(bytes); //write actual byte info server code reading inputstream (this in infinite while loop): len = mminstream.read(buffer); if (len > 0) { bytebuffer bb = bytebuffer.wrap(buffer); ...

swift - Xcode 6 is showing funny characters -

swift - Xcode 6 is showing funny characters - i having problem xcode 6, starts showing funny , annoying characters seen below. think typed key mistakenly made xcode editor show such annoying stuff. can point me in right direction editor normal state? you've accidentally enabled "show invisibles" option, located in editor menu: simply click alternative (now "hide invisibles") 1 time again hide characters. xcode swift

Rails 4.1 enum query -

Rails 4.1 enum query - i seeing rails generate wrong query value when utilize enum col value in clause, (self added clarity). dominant_product_strategy enum. def some_model_method_on_mymodel mymodel.where(dominant_product_strategy: self.dominant_product_strategy) end this produces right value (again, self added clarity): mymodel.where(dominant_product_strategy: self.attributes["dominant_product_strategy"]) i'm guessing rails sees enum string, , converts integer value of zero. ughhhhh! am missing something? this works: mymodelwhere(dominant_product_strategy: mymodel.dominant_product_strategies[dominant_product_strategy]) it seems have answered question yoursef. enum variables hash: {str1: int1, str2: int2, ...} the value (integer) storing in db, , string representation of int value. when phone call self.dominant_product_strategy , representation (string) of dominant_product_strategy column storing integer in db. i think first...

Visual Studio 2013 Express Toolbox empty -

Visual Studio 2013 Express Toolbox empty - i trying larn visual basic guidance of youtube tutorials. have recommended utilize of microsoft visual studio express 2013 has built in compiler. encountered problem toolbox bar on left of screen empty. know how prepare this? http://gyazo.com/328ade3754613c971dd6d4745a0ed171 link screenshot. just right click within tools , click on "show all" visual-studio

mocking - How do I mock a method in test code that's been "declare"d in production code? -

mocking - How do I mock a method in test code that's been "declare"d in production code? - in production code, have couple of lines of code that's declaring 2 functions utilize google analytics: declare function ga(command: string, type: string, exceptiondetails: object); declare function ga(command: string, type: string, category: string, action: string, label: string) in unit test code, implement mock of these functions nothing. however, app.tests.ts references app.ts, cannot var ga = (command: string, type: string, exceptiondetails: object) => { }; because duplicate definition. how can accomplish without adding ga definition unit test runner html? you override function substituting value. almost doing in example, because have set var in front end of it, looks accidental duplication. remove var , have: ga = (command: string, type: string, exceptiondetails: object) => { }; simplified illustration illustration: var ga...

database - data curation system and manual data management -

database - data curation system and manual data management - i'm looking solution may exist; however, i'm unable identify name type of scheme , hence unable find one. hoping identify i'm looking for. i have info get's manually , automatically curated. manually curated info updated , managed in excel or form of spreadsheet. automated scheme generates spreadsheets more manual curation. i'm looking rdbms based software solution allow info entry employees or curators create info schemas little db experience (using gui). in add-on can create schema changes , modifications info set. info can deployed number of sources triggers etl daemon fetch changes , persist destination source (staging, production, etc). here requirements: system should user friendly , accessible non-dba or non-programmer (friendly gui) system should allow users create , alter schemas in db system should have api developers can utilize automatically curate data system...

c# - Posting organized data using webapi -

c# - Posting organized data using webapi - i need help , stuck on topic i need build rest web api takes input parameter set of organized info need insert in database. info like: <journalreport> <journalheader> <reportsequencenumber>2012061401</reportsequencenumber> <reportsequenceid>466</reportsequenceid> <primaryreportperiod>2012-06-14</primaryreportperiod> <secondaryreportperiod>2012-06-14</secondaryreportperiod> <begindate>2012-06-14</begindate> <begintime>06:28:37</begintime> <enddate>2012-06-14</enddate> ...

Stata using loop values sequentially -

Stata using loop values sequentially - i want replace code loop: replace var1=1 if year > 1996 & st==5 replace var1=0 if year < 1996 & st==5 replace var1=1 if year > 1998 & st==6 replace var1=0 if year < 1998 & st==6 my info looks st year var 5 1993 5 1996 5 1992 6 1991 6 1999` i wrote loop foreach st in 5 6} foreach yr in 1996 1998 } replace var1=1 if year>`yr' & state==`st' replace var1=0 if year<`yr' & state==`st' } } however loop not produce results similar manual method. know making stupid mistake. edit: to farther clarify actual code wrote (without using loops) looks below. utilize loop or other simpler method arrive @ same results: gen policy=. replace policy=1 if year>1996 & fipscode==5 replace policy=0 if year <1997 & fipscode==5 replace policy=1 if year>1995 & fipscode==6 replace policy=0 if year <1996 & fipscode==6 replace policy=1 if...

abstract syntax tree - replace variable names with actual values in an expression in AST python -

abstract syntax tree - replace variable names with actual values in an expression in AST python - i have look described in variable forms this 's1*3 - (s2-s1)*1' i have given values of s1 , s2 can alter according need i can utilize python ast module evaluate look replacing respective s1 , s2 values (s1 = 20,s2=30) import ast import operator op operators = {ast.add: op.add, ast.sub: op.sub, ast.mult: op.mul, ast.div: op.truediv, ast.pow: op.pow, ast.bitxor: op.xor, ast.usub: op.neg} def eval_(node): if isinstance(node, ast.num): # <number> homecoming node.n elif isinstance(node, ast.binop): # <left> <operator> <right> homecoming operators[type(node.op)](eval_(node.left), eval_(node.right)) elif isinstance(node, ast.unaryop): # <operator> <operand> e.g., -1 homecoming operators[type(node.op)](eval_(node.operand)) else: raise typeerror(node) >>...

objective c - iOS list of available bluetooth-devices with information programmatically -

objective c - iOS list of available bluetooth-devices with information programmatically - i new in community. need help solving problem bluetooth in objective-c. want find available bluetooth-devices , info existing connection. (not scan peripherals!) possible in ios? illustration list in settings > bluetooth! ios objective-c iphone ios7 bluetooth

java - The method findViewById(int) is undefined for the type R.layout -

java - The method findViewById(int) is undefined for the type R.layout - i started programming android recently, , have problem. i'm trying word written in edittext, string. package com.example.generatoredifrasi; import android.os.bundle; import android.r.layout; import android.os.bundle; public class edittext { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.my_layout); edittext text = (edittext) findviewbyid(r.id.edittext); string string = text.gettext().tostring(); // value edittext } } findviewbyid gives me error: the method findviewbyid (int) undefined type r.layout why? how solve problem? there easier way word written in edittext string? the first error experiencing "the method findviewbyid (int) undefined type r.layout" because have import r; in imports, layout r.layout , not layout view. if layout reference view, findviewbyid() valid method ...

javascript - Detecting touchstart while detecting touchmove -

javascript - Detecting touchstart while detecting touchmove - i've been plugging away @ project , until i've been using chromes debugger mobile emulator. means i've been able simulate touches , dragging behaviors mouse. unfortunately because of having 1 mouse never both @ same time. the project i'm working on adds 2 half-page sized dom elements page, 1 on left has touchmove event listener tied it, , other on right has touchstart event listener tied it. both work swimmingly. but tonight uploaded project online test stuff out , opened ipad , found perform 1 action @ time. page not observe touchstart events on right while touchmoved on left, , likewise couldn't observe touchmove events on left while tapped on right. anyone done before? detecting different sets of touches on separate dom elements? code snippets bit big include here link github repo here: https://github.com/matthewolsson/joyshtick dom elements share single touches array. prior pha...

java - 404 Error when trying to get document metadata via the google drive API -

java - 404 Error when trying to get document metadata via the google drive API - i authenticating using domain-wide delegation. i getting google drive service looks this: com.google.api.services.drive.drive@6ebd27b9 this link file i'm trying retrieve: https://docs.google.com/a/rmi.org/document/d/1jrs8slzaad2u4cg-gbdmbvn25dp6f_uuyyl6ermpano/edit i passing in value file id: 1jrs8slzaad2u4cg-gbdmbvn25dp6f_uuyyl6ermpano . when code gets line: file file = service.files().get(fileid).execute(); i error: an error occured: com.google.api.client.googleapis.json.googlejsonresponseexception: 404 ok { "code" : 404, "errors" : [ { "domain" : "global", "message" : "file not found: 1jrs8slzaad2u4cg-gbdmbvn25dp6f_uuyyl6ermpano", "reason" : "notfound" } ], when seek find file in question using tool @ bottom of this page, if turn on oauth 2.0, 200 response code , info file in question. i've...

elasticsearch - What is the format of ip address in kibana that i want to see ip distribution in map? -

elasticsearch - What is the format of ip address in kibana that i want to see ip distribution in map? - recently, i'm developing elasticsearch , kibana. now, want see ip distribution in map, not know ip format, example.json shows below can not identified in kibana map : {"index":{"_index":"json","_type":"column","_id":126245}} {"@timestamp": "2014-01-11t19:38:56.573z","column_id":126246,"play_name":"a winters tale","speech_number":38,"column_number":"","client_ip":"199.72.81.55","text_entry":"exeunt"} and json schema likes : { "mappings" : { "_default_" : { "properties" : { "client_ip" : {"type": "string", "index" : "not_analyzed" }, "play_name" : {"type": "string"...

c# - Get a part of string -

c# - Get a part of string - i have string as "cmp197_10_27_147ee7b825-2a3b-4520-b36c-bba08f8b0d87_tempdoc_197" i want fetch lastly digits(i.e. 197) obtaining same have implemented below code int lastunderscore = adducoid.lastindexof('_'); string getucoid = adducoid.substring(lastunderscore).trimstart('_'); the getucoid string gets digit part properly.the problem have check if digits occur in string,i.e. string can "cmp197_10_27_147ee7b825-2a3b-4520-b36c-bba08f8b0d87_tempdoc" how perform check on such string, whether part(197) exists @ end in string or not. here 197 example.it numeric data,for illustration 196,145,etc i suspect want know if lastly part numeric or not: bool isnumeric = regex.ismatch(getucoid, @"^\d+$"); c# string

psql - Duplicate values returned on SQL INNER JOIN -

psql - Duplicate values returned on SQL INNER JOIN - i'm getting duplicate values returned when inner bring together change_management table. returns 3 records want recent cmp.id. select cmp.id, cr.id, coalesce(cmp.effort, 0.00) "effort" m_change_request cr inner bring together (select max(id) id, change_request_fk, effort m_change_management grouping id, change_request_fk, effort) cmp on cmp.change_request_fk = cr.id cr.release_fk=509 i need homecoming recent record max(cmd.id). ideas how can prepare ? found solution select cmp.id, cr.id, cr.number "psl #" m_change_request cr left bring together m_change_management cmp on cr.id = cmp.change_request_fk left bring together m_change_management cmp2 on cr.id = cmp2.change_request_fk , cmp.id < cmp2.id cr.release_fk=509 , cmp2.change_request_fk null psql

xcode - Expected identifier or "(" when adding picker -

xcode - Expected identifier or "(" when adding picker - hello getting error when effort add together picker :uiviewcontroller uiimagepickercontrollerdelegate ... suggestions..thanks #import <uikit/uikit.h> #import "gpuimage.h" #import "gpututorialcell.h" @interface gpututorialviewcontroller :uiviewcontroller <uiimagepickercontrollerdelegate> uiviewcontroller { //expected identifier or "(" nsmutablearray *filternames; } - (ibaction)load:(id)sender; - (ibaction)save:(id)sender; @property (weak, nonatomic) iboutlet uiimageview *imageview; @property (weak, nonatomic) iboutlet uitableview *filterstable; @end uiviewcontroller { //expected identifier or "(" nsmutablearray *filternames; } it looks you're trying declare instance variable. stray uiviewcontroller has worked way code. delete it. this: { nsmutablearray *filternames; } xcode identifier

windows 7 - How to check file integrity of download if checksum value is not posted -

windows 7 - How to check file integrity of download if checksum value is not posted - i plan download big amount of files this website. there no checksums posted on website (that know of). there way can generate checksum file on server (perhaps via command line interface) , compare downloaded file? i'm using windows 7 32-bit. you can't, unless server yours , have access file system. seek find same file source , compare 2 downloads. uncle google help on this. windows-7 download checksum data-integrity

r - how to program factoranalysis iterations -

r - how to program factoranalysis iterations - currently i'm busy new type of factor analysis. created next binary operators: %m% calculates square positive definite symmetric matrix r dataframe %e% calculates communality estimates , places these on main diagonal of square matrix m %f% extracts 1 factor @ time new square matrix %r% reproduce new square matrix factor loadings of %f% , subtracts original matrix this 1 cycle. steps 2 4 duplicated residuals,%f% extracts sec factor, %r% reproduces new matrix, etc. in fashion finish procedure (steps 2 - 4 , 2 - 4) successively applied smaller , smaller matrices. my question is: how can programme these iterations in r? clearly, in each iteration step 4 input new cycle step 2 step 4 in next iteration. some r - code use: iterations res= a%m%lg3 est= res%e%5 f1= est%f%1 res= f1%r%est est= res%e%5 f2= est%f%1 res= f2%r%est est= res%e%5 f3= est%f%1 res= f3%r%est a= r dataframe, l...

maven - Android Library Declare-Styleable Runtime Error -

maven - Android Library Declare-Styleable Runtime Error - i have library widgets in maven central. when add together library dependency (from maven central) project using gradle, get: java.lang.noclassdeffounderror: com.my.pacakge.r$styleable if manually download .aar , include in project, works fine. tried using android studio's code completion see if library's r included. when utilize maven dependency, typing com.my.pacakge.r returns no results, when utilize local .aar returns r library. here's library code: // widget constructor public foregroundimageview(context context, attributeset attrs) { super(context, attrs); typedarray = context.obtainstyledattributes(attrs, r.styleable.foregroundimageview); drawable foreground = a.getdrawable(r.styleable.foregroundimageview_android_foreground); if (foreground != null) { setforeground(foreground); } a.recycle(); } // attrs.xml <?xml version="1.0" encoding="...

ios - Apple push notification get an error Authentication failed because the remote party has closed the transport stream -

ios - Apple push notification get an error Authentication failed because the remote party has closed the transport stream - i follwoing error "authentication failed because remote party has closed transport stream" after ling code: stream.authenticateasclient(this.applesettings.host, this.certificates, system.security.authentication.sslprotocols.ssl3, false); it poined valid p.12 void connect() { client = new tcpclient(); //notify connecting var eoc = this.onconnecting; if (eoc != null) eoc(this.applesettings.host, this.applesettings.port); seek { client.connect(this.applesettings.host, this.applesettings.port); } grab (exception ex) { throw new connectionfailureexception("connection host failed", ex); } if (applesettings.skipssl) { netw...

scala - For-Comprehension Future with exceptions -

scala - For-Comprehension Future with exceptions - i have 2 future , want recover exceptions on 1 of them : def getid(): future[either[exception, id]] = ... def result(): future[result] = ... i have seek this: for { id <- getid() r <- result(id, param, param) } yield { r } recover { case e => println(e.getmessage) } someone can help me? many before. you should recover @ val beingness processed rather @ for. below code sets id , r 0 if exception thrown. for { id = getid() id.recover { case e => { println(e.getmessage) 0 } } r = result(id, param, param) } yield r.recover { case e => { println(e.getmessage) 0 } } scala

node.js - How can I get distance using geoSearch in Mongoose -

node.js - How can I get distance using geoSearch in Mongoose - i succeed in using geonear() shops distance; i successed in using geosearch() shops in special type without showing me distance. how can list shops in special type showing me distance? model.geonear({ "type": "point", "coordinates": opts.coordinates }, { lean: true, spherical: true, includelocs: true, maxdistance: opts.radius / earth_radius, distancemultiplier: earth_radius }, function(err, shops, stats) { var results = exports.trimeddistance(shops); deferred.resolve(results); }); -- model.geosearch({ _category: mongoose.types.objectid(opts.categoryid) }, { near: opts.coordinates, lean: true, limit: 10, maxdistance: opts.radius / earth_radius }, function(err, shops) { var results = exports.trimeddistance(shops); deferred.resolve(results); }); resolved. using geonear aggregate http://docs.mongodb.org/manual/reference/operator/aggregation/geonear/ node.js mongod...

c - My own random number generator -

c - My own random number generator - i want create random number generator user specifies range , amount of generated numbers. want create every number unique (no repeat). i've done far (it generates of them repeat, why?) #include <time.h> #include <stdio.h> #include <windows.h> #include <conio.h> int main() { srand(time(null)); int start, stop, amount; system("chcp 1250 >nul"); printf("welcome random number generator!\n"); printf("\nwhat range? \nfrom: "); scanf("%i", &start); printf("to: "); scanf("%i", &stop); printf("\nhow many numbers?: "); scanf("%i", &amount); int number[amount]; for(int i=0; i<amount; i++) { number[i] = rand() % ((stop+1)-start) + start; for(int j=i; j>-1; j--) { if(number[i]==number[j]) { number...

html - Unfixed div overlapping fixed div on bootstrap 3 -

html - Unfixed div overlapping fixed div on bootstrap 3 - i have layout page divided 2 columns using bootstrap 3 similar this. <div class="row"> <div class="col-md-4 info"> <!--some markup --> </div> <div class = "col-md-8 tasks-column"> <!--some markup --> </div> </div> i want div class "info" remain fixed on top left side when scrolling page. when seek bootstrap "affix" class content in "info" gets fixed "tasks-column" moves way left covering it. have tried plain css position:fixed; on "info" not anything. content in info not navigation panel. give thanks guys. edit: content in info dynamic (it varies depending on user input). you need offset tasks-column. seek this. <div class="row"> <div class="col-md-4 info"> <!--some markup --> </div> <div clas...

html - Set accesskey to keyboard numeric pad keys with jQuery -

html - Set accesskey to keyboard numeric pad keys with jQuery - i'm developing web app html5 , jquery 1.10. i'm using accesskey attribute in inputs , links improve navigation. actually have code: $("#linktabcost").attr("accesskey", "1"); $("#linktabcapture").attr("accesskey", "2"); $("#linktabinvoice").attr("accesskey", "3"); with code, accesskeys working follows: my question is: how can set accesskey numbers of keyboard numeric pad jquery? i able solve issue shortcut.js library , adding numeric pad keys (97,98,99...) library special_keys array. var special_keys = { 'numpad_1': 97, 'numpad_2': 98, 'numpad_3': 99, 'numpad_4': 100, 'numpad_5': 101, 'esc':27, 'escape':27, ...

html - I cannot download certain file types from website. In particular .frm, .frx, .mgf. Getting HTTP 404 error -

html - I cannot download certain file types from website. In particular .frm, .frx, .mgf. Getting HTTP 404 error - i cannot download file types website. in particular .frm, .frx, .mgf. getting error: http error 404 - file or directory not found. added these file types in iis local, did not help. can add together kind of code webpage allow downloading of such files? all need done on website hosting server, not on downloading computer. daaahhh. create sure hosting business relationship switched iis7. web.config file need created (can done in notepad) , placed in root directory of website. web.config file allowing download of .mgf files: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <staticcontent> <mimemap fileextension=".mgf" mimetype="text/plain" /> </staticcontent> </system.webserver> </configuration> html browser

java - Convert JsonNode object to Map -

java - Convert JsonNode object to Map - i have c# programme sends me json object. i'm making java play website capture post data. right info jsonnode object need convert map. i'm using com.fasterxml.jackson.databind.jsonnode here correctly capture jsonnode object: public static result index() { jsonnode json = request().body().asjson(); now have object need figure out how convert map can magic on it. later i'll want convert map json object sent in response. i've been looking in documentation, methods available don't scream solution. here documentation i've been referencing particular jsonnode object: http://fasterxml.github.io/jackson-databind/javadoc/2.2.0/com/fasterxml/jackson/databind/jsonnode.html got here trying find reply myself. dug little deeper , found bit reply here basically utilize objectmapper convert value you: objectmapper mapper = new objectmapper(); map<string, object> result = mapper.convertvalue...

javascript - Adding junk character in currency symbol while exporting data to CSV -

javascript - Adding junk character in currency symbol while exporting data to CSV - i getting unusual issue whenever exporting info in csv have currency symbol, has added junk character in info beside currency symbol. for illustration if info = french republic - admin fee 1 x £100 getting result = french republic - admin fee 1 x £100 when open in excel. code : <html> <head> <script type="text/javascript"> function createcsv() { var buffer = "france - admin fee 1 x £100"; buffer = "\"" + buffer + "\""; // buffer = "" + euro; //"\u2034"; var uri = "data:text/csv;charset=utf," + encodeuricomponent(buffer); var filename = "invoicedata.csv"; var link = document.createelement("a"); if (link.download !== undefined) { // feature detection // browsers back upwards html5 download attribute link.setattribute("href", uri); link.set...

how to read an array from txt.file? Python, curses -

how to read an array from txt.file? Python, curses - i using curses in python, , trying create game print out characters in terminal window. field supposed saved in text file if press 's' , if press 'o' saved playing field supposed uploaded. manage store characters in array, don't know how upload file back/print on terminal window. so problem don't know how 'reload' characters have stored. saved txt.file looks this: [' ', ' ', 'f', 'i', ' '....] [' ', 'f', ' ', ' ', ' '....] [... [... etc my program..... import curses def main(scr): """ draw border around screen, move around using cursor , leave mark of latest pressed character on keyboard. quit using 'q'. """ # clear screen of output scr.clear() # screen dimensions y1, x1 = scr.getmaxyx() y1 -= 1 x1 -= 1 y0, x0 ...

phpunit - How to get record with same fixture in Yii unit test -

phpunit - How to get record with same fixture in Yii unit test - its parent kid relation, in childgroup1, getting error during accessing 'parent_id' attribute. given error trying property of non-object. i having access dynamically. how parent_id in such case. homecoming array( 'group1'=>array( 'id' => 1, 'name' => 'test', 'status' => 1, ), 'childgroup1'=>array( 'id' => 2, 'parent_id' => $this->getrecord('groups','group1')->id, 'name' => 'child test group1', 'status' => 1, ), ); since records not loaded yet, cannot utilize $this->getrecord() acquire record. such, utilize plain old array logic record's id. $records = array(); $records['group1'] = array( 'id' => 1, 'name' => 'test', ...

java - in jsf how to store radio buttons into a bean -

java - in jsf how to store radio buttons into a bean - please write bean code: <h:datatable rows="10" value="#{loginformbean.keyaslist}" rendered="true" var="deviceid" id="producten"> <h:column> <h:outputtext value="#{deviceid}" /> </h:column> <h:column> <h:selectoneradio value="#{loginformbean.devicemap[deviceid]}"> <c:if test="#{loginformbean.devicemap[deviceid] eq on}"> <f:selectitem itemvalue="on" itemlabel="on" /> </c:if> <c:otherwise> <f:selectitem itemvalue="off" itemlabel="off" /> </c:otherwise> </h:selectoneradio> </h:column> </h:datatable> <h:commandbutton value="submi...

sql - MySql: get data from two tables with grouping by Date -

sql - MySql: get data from two tables with grouping by Date - i have 2 table same columns, want merge them , grouped date table1: order_payments_detail | payment_by | amount( debit in result) | added_on | | ali | 1000 | 2014-09-21 | | aslam | 2000 | 2014-09-25 | | akram | 4000 | 2014-09-28 | table2: orders | cust_name | amount( credit in result)| added_on | | shop1 | 1000 | 2014-09-22 | | shop2 | 2000 | 2014-09-26 | | shop3 | 4000 | 2014-09-29 | result this | particulars| debit | credit | added_on | | ali | 1000 | null | 2014-09-21 | | shop1 | null | 1000 | 2014-09-22 | | aslam | 2000 | null | 2014-09-25 | | shop2 | null | 2000 | 2014-09-26 | | akram | 4000 | null | 2014-09-28 | | shop3 |...

java - Android CountDown Timer in Quiz Application -

java - Android CountDown Timer in Quiz Application - i have made quiz application include 5 questions. have made resultactivity page displays result of quiz. have added countdown timer of 20 sec each question. when countdown timer finishes moves next question automatically. when questions finished should move resultactivity page display result. i have 1 issue... afetr reaching lastly question..if not select reply , timer finished applicaton not moving resultactivity page..the timer getting started 1 time again , 1 time again on same question until select option here code: quizactivity.java package com.example.triviality; import java.util.linkedhashmap; import java.util.list; import android.os.bundle; import android.os.countdowntimer; import android.app.activity; import android.content.intent; import android.util.log; import android.view.view; import android.widget.button; import android.widget.radiobutton; import android.widget.radiogroup; import android.widget.text...

javascript - angular.js parsing integer incorrectly -

javascript - angular.js parsing integer incorrectly - i'm using angular create ajax phone call own rest api. $scope.authenticate = function() { $http({ headers: httpheaders, url: '/something/', method: "post", data: { 'userid' : $scope.userid, 'password': $scope.password }, cache: false }) .success(function(response, status) { console.log(response); var ourstring = json.stringify(response); console.log(ourstring); $scope.authenticate_data = response; $scope.sessionid = response.sessionid; $scope.cookie = response.cookie; $scope.message = "you have authenticated." }); } somehow, angular incorrectly parses integers, , in chrome inspector's network tab, phone call shows following: request tab {"sessionid": 115053508782199126, "cookie": "jsessionid=e61dd3443ae9e119060a637cf039936b; path...

sql server - Exchanging data between Android SQL-Lite and SQL Sever without using webserive -

sql server - Exchanging data between Android SQL-Lite and SQL Sever without using webserive - i want create android app gets info user in offline mode , stores them on local sql-lite database. later when phone in online mode, user can click "sync" button , info stored on local sqlite database should uploaded database on central server. the question is, how can implement without using webservice? ittia db sql allow have replication between 2 databases i'm looking built in sqllite or sqlserver feature implement replication or more, 2 way replication. thanks put local db behind content provider, , allow content provider handle offline , sync. take @ google iosched how maintain info in sync, different scenario, gives ideas , best practices. in case, content provider can replay transactions remote db when network connection becomes available, or may save transactions in little sqlite db, , send "update" db server. on server, apply chang...

ruby on rails - Why "error_message" don't show error ActiveRecord validate? -

ruby on rails - Why "error_message" don't show error ActiveRecord validate? - im worked on project create events.but click on "create event" button empty fields partial "_error_messages" don't render list errors.the page page loaded again.validates seems working, in rails console tried create , bash show me error "can't blank". _event_form.html.erb <%= form_for event, html: { class: "event-form" } |f| %> <%= render 'shared/error_messages', event: event %> <% unless current_user %> <div class='row'> <div class='col-md-4'> <div class="form-group col-sm-12"> <%= label :email, "Введите Ваш email:" %> <%= text_field_tag :email, "",class: "form-control" %> <small>Он нужен для того, что бы Вы могли позже отредактировать добавленное Вами событие.</small...

excel - How to write MAX IF formula in VBA to achieve a lookup on two values -

excel - How to write MAX IF formula in VBA to achieve a lookup on two values - i have been using array formula resource name entry located in column y, project name in column b , homecoming latest / highest date value in column ae using max function. this set bluntly, killing spreadsheet due sheer size of info in spreadsheet (60,000 lines). formula is: {=if(y3="","",iferror(max(if(y$2:$y$60000=y3,if($b$2:$b$60000=b3,$ae$2:$ae$60000))),""))} if @ table below, formula homecoming 21/04/2014 richard, , 21/06/2014 fred, whom both working on project capitol . b | y | ae capitol richard 21/03/2014 capitol richard 21/04/2014 capitol fred 21/05/2014 capitol fred 21/06/2014 i wondering if there way re-write formula in vba in order same result, run more efficient memory? beginner in vba learning. a pivottable homecoming results mention: excel vba excel-vba pivot-table nes...

javascript - kendo grid cancelChanges issue -

javascript - kendo grid cancelChanges issue - i working on web application using kendo grid(angular js). should phone call grid.savechanges() after every delete or insert operation. in special scenario such insert record , phone call savechanges then delete same record , phone call savechanges then phone call call grid.cancelchanges() normally goes lastly savechanges state in case showing deleted row. help? i've tried in demo: http://demos.telerik.com/kendo-ui/grid/editing works correctly. maybe works when phone call savechanges() manually. info restore when you're calling cancelchanges() stored in _pristinedata property seek workaround: var grid= $("#yourgrid").data("kendogrid"); grid.savechanges(); grid.datasource._pristinedata = grid.datasource._data; javascript user-interface kendo-ui grid kendo-grid

Authenticating to a SQL Server instance as a Windows User via JDBC -

Authenticating to a SQL Server instance as a Windows User via JDBC - i'm having back upwards multiple database types tenant-enabled web application. among others, have supported microsoft's sql server, using net.sourceforge.jtds.jdbc.driver class connection string "jdbc:jtds:sqlserver://192.168.1.189:1433/applicationname". works, requires user explicitly defines user in sql server instance , enables sql server authentication. now, inevitably, requirements changed, , we're supposed back upwards connecting sql server via windows authentication. evidently requires sort of alter connection string, since info base of operations server must somehow able distinguish whether credentials passed info base of operations connection user defined in sql server installation or in windows os. it? acting on advice internet, if progressed far extending connection string ;usentlmv2=true;domain=workgroup . seems create info base of operations server aware want...

How do I create a List by applying an operation to all elements of a scala Map? -

How do I create a List by applying an operation to all elements of a scala Map? - i have scala map mymap , want create list mylist of pairs follows: for each (k,v) in mymap, mylist should have tuple (v.somemember, k) element the result of using map , for comprehension new map. there improve way start empty list , add together elements loop through (key, value) pairs in map var mylist = list.empty[(double, string)] mymap foreach { case(k,v) => mylist ::= (v.somemember, k) } use tolist , map . for example: scala> map("a" -> 1, "b" -> 2).tolist.map { case (k, v) => (k.size, v) } res12: list[(int, int)] = list((1,1), (1,2)) or, if want more memory efficient , not allocate intermediate list, can build list while map ing breakout import scala.collection.breakout scala> val l: list[(int, int)] = map("a" -> 1, "b" -> 2).map({ case (k, v) => (k.size, v) })(breakout) l: list[(int, int)] ...

android-consume in app payment - result: IabResult: Items of type 'subs' can't be consumed -

android-consume in app payment - result: IabResult: Items of type 'subs' can't be consumed - i'm writing consumable in app payment. code : static final string sku_premium = "goldvip1"; boolean mispremium = false; static final int rc_request = 12345; iabhelper mhelper; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.payit); initilize(); actionbar(); string base64encodedpublickey = "mihnma0gcsqgsib3dqebaquaa4g7adcbtwkbrwds6t/zu28hm3usan93f+s0nlvk1sajcmwiulyeurqs8ebf1eb8jdm6fqxibp0q3kdijpgdla5idexybxpkvcqcf9ekugyu8mizjwgtmrjtlpo+/xhgjxpdvrgvtksdsu4gtovl5miv6jvvugltms68qxct+rea6gtxvjprnhzei0lxnd6a6qubdzn/bxy6qw2hq0nmugm/+gzl1cffdxlookllnj/oqnwosq4ilbwsoccaweaaq=="; mhelper = new iabhelper(this, base64encodedpublickey); mhelper.startsetup(new iabhelper.oniabsetupfinishedlistener() { public void oniabsetupfinished(iabresult result) { ...

mysql - How to set variable values for different statement for same NOT FOUND SQL EXCEPTION in STORE PROCEDURE -

mysql - How to set variable values for different statement for same NOT FOUND SQL EXCEPTION in STORE PROCEDURE - i have procedure need set d_x select statement 1, d_y select statement 2, d_z select statement 3. how modify below procedure accomplish ... create procedure () begin declare d_a int; declare d_b int; declare d_c int; --- -- - declare go on handler not found begin set d_x = 1; set d_y = 2; set d_z = 3; end; select aa d_x test1; select bb d_y test2; select cc d_z test3; end i found 1 solution problem. , probable answer. if there more alternative ways please define. create procedure () begin declare d_a int; declare d_b int; declare d_c int; --- -- - begin declare go on handler not found begin set d_x = 1; end; ...

python 2.7 - Extremely slow import of module skimage.io -

python 2.7 - Extremely slow import of module skimage.io - just reinstalled numpy (built against mkl), scipy, cython, pil, scikit-learn , scikit-image in new virtualenv , getting extremely slow import time of module skimage.io: import skimage --> 0.07536911964 secs skimage import io --> 3.15395903587 secs what might reason? have tried timing import of matplotlib ? that's 1 of plugins used skimage.io . the io subpackage wrapper around these other libraries (and includes wrappers pil , tifffile , imread , freeimage , etc). @ import, bundle looks default backend (usually matplotlib , pil , on systems). 1 of these dependencies responsible slow import. python-2.7 virtualenv scikit-learn scikit-image

c# - Get Atttribute value from XDocument -

c# - Get Atttribute value from XDocument - i trying responsecode attribute value out of xml. the xml xdocument <idmresponse xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="1" xmlns="http://www.fake.org/namespace/"> <artsheader> <response responsecode="rejected"> <requestid>1</requestid> <businesserror severity="error"> <code>idminvalidusernamepasswordloginprovided</code> <description>invalid username or password, if problem persists, please contact administrator</description> </businesserror> </response> </artsheader> </idmresponse> with xpath: (no error checks done) xmlnamespacemanager nsm = new xmlnamespacemanager(new nametable()); nsm.addnamespace("def"...

c# - Solution for circular dependency -

c# - Solution for circular dependency - i have below 2 classes in 2 projects , each class needs phone call other class method. cannot add together reference each other because creating circular dependency. i know must utilize interface resolve issue not able comeup answer. please allow me know how implement & resolve this. project test2 namespace test2 { public class classtest2 { public string getclasstest2() { homecoming "classtest2"; } } } project test1 namespace test1 { public class classtest1 { public string getclasstest1() { homecoming "classtest1"; } } } you'd need 3rd project in define interface: public interface iclassnameaware { string getclassname(); } from both existing projects, reference new assembly , create classes implement interface: public class classtest1 : icla...

c# - Bind EditorFor to Array of string -

c# - Bind EditorFor to Array of string - after trying more sophisticated viewmodel no success came utilize viewmodel this: public class carteexpressviewmodel { public string[] lesentrees; public string[] lesplats; public carteexpressviewmodel() { lesentrees = new string[]{ "", "", "", "", "", "" }; lesplats = new string[]{ "", "", "", "", "", "" }; } } i pass viewmodel in create method of controller public actionresult create() { carteexpressviewmodel carteexpressviewmodel = new carteexpressviewmodel(); homecoming view(carteexpressviewmodel); } problem can see input value if utilize formcollection parameter of post create method null if utilize viewmodel view line this: @for (int = 0; < model.lesentrees.length; i++) { <div class="editor-label "> @html.labelfor(...

algorithm - Storing data for trees and graphs? -

algorithm - Storing data for trees and graphs? - in tree or graph problems tried solve,the input entire tree or graph construction in node1->leafs or node1->adjacent nodes format. is there list of commonly used structures save info in memory later helps intended algorithm.for example: say have list of graph nodes like: 1 3 8 2 4.....# 1 connected 3 8 2 4...nodes 2 5 1 3... # 2 connected 5 1 3...nodes 3 1 2... #likewise . ... 8 ...... so if want utilize random contraction algorithm (in have contract edges contract 1 , 8..i utilize multi-linked list construction in each node on adjacency list points corresponding row i.e.8 in first line points 8th node. now question,why chose construction store data? contracting making 1 , 8 1 single entity, so read 1's adjacency list starting 3 , go 3rds adjacency list alter 1 8 , next 8's row create 1 8 go 2's list alter 1 8....and append 1s list 8 , remove duplicates..yep,so 1 deleted graph after con...