Posts

Showing posts from January, 2010

Only 1 contentString displays in custom Google map -

i have used tutorial adding-custom-google-maps-to-your-website to create custom google map using v3 of google maps api, but have hit problem : when markers clicked, info box pops up, each different marker on map displays same contentstring . you can see here: http://tcchurch.com.au/table1/index.php/missions i assume there problem code preventing individual contentstrings displaying. if can help, appreciate it. you need set content each infowindow documentation google.maps.event.addlistener(companymarker, 'click', function() { infowindow.setcontent(html);//relevant html infowindow.open(map,companymarker); });

c# - How can i expose dto objects using wcf data service with ef code first? -

i trying make wcf data service dont want acces database models instead want use data transfer objects. have been reading lot on internet how accomplish cant answer problem. first time me doing wcf data services little inexperienced. oke here models linked database using entity framework public class user { [key] public int userid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string username { get; set; } public string email { get; set; } public string countrycode { get; set; } public string phonenumber { get; set; } public icollection<user> contacts { get; set; } public virtual language language { get; set; } public user() { contacts = new list<user>(); } } public class message { [key] public int messageid { get; set; } public datetime sentdate { get; set; }

javascript doesnt continue even though it should - mysterious -

i have written simple script goes through textarea , transports !hash tags! , @person names@ 2 separate inputs. however, unless first of 2 regex conditions met (word starts '!' , ends '!' symbol), not work next condition. for example code on line 42 console.log(persons_parsed); doesnt execute @ all, unless !hash tag! typed textarea. how make work, enter @person name@ , fill in input#persons_jquery ? code in jsfiddle: http://jsfiddle.net/yz2jw/1/ the problematic part if (tags_parsed.length > 0) { var vysledek_tags = null; (i = 0; < tags_parsed.length; i++) { if (vysledek_tags) { var vysledek_tags = vysledek_tags + ', ' + tags_parsed[i].replace(/[!]/g, ''); } else { var vysledek_tags = tags_parsed[i].replace(/[!]/g, ''); } } $('#tags_jquery').val(vysledek_tags); } console.log(persons_parsed); // doesnt return v

hadoop - Hbase: Migration from standalone mode to Fully distributed mode -

i want if possible migrate standalone mode distributed mode in hbase.i have data in standalone mode persist during migration. please help. quite old question encountered same problem , solved using following steps: in standalone mode export table want migrate: bin/hbase org.apache.hadoop.hbase.mapreduce.driver export table_name /local/path/table_name_backup in pseudodistributed/distributed mode copy table in hdfs using hadoop: ./bin/hadoop fs -copyfromlocal /local/path/table_name_backup/ table_name_backup import data using hbase: ./bin/hbase org.apache.hadoop.hbase.mapreduce.driver import table_name table_name_backup remove old data hdfs using hadoop: ./bin/hadoop dfs -rmr table_name_backup u might want check number of rows before , after migration check if went according plan: ./bin/hbase org.apache.hadoop.hbase.mapreduce.driver rowcounter table_name

javascript - Unit Testing Chrome Extensions? -

this question has answer here: how test chrome extensions? 3 answers what best way unit test google chrome extension? i need unit test various javascript functions , content-scripts on websites designed for, automate user input on webpages content script injected into. is there anyway can automate testing process? if asking unit testing, same other javascript code. remember unit tests should small possible , shouldn't touch (they can mock) external api. if asking integration testing, different matter.

php - SQL error: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource -

i error if try publish article on cms. the error: warning: mysql_fetch_object(): supplied argument not valid mysql result resource in /home/investmp/domains/cashcow.nl/public_html/publiceer/functions.php on line 32 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'premiekoopwoning moet terugkomen'', 'eddy', 'publiceren')' @ line 1 functions.php: <?php //## function list: news manager ##// //## content news: lead - header - chapeaux - flat text (text) - quote - frame - image - chart ##// //upload images folder (resize = 1|0 - $dir (default = /images stated in admin) function uploadfile($fileinput ,$resize, $dir, $id) { global $_files; $file = $_files[$fileinput]['name']; if (is_uploaded_file($_files[$fileinput]['tmp_name'])) { copy($_files[$fileinput]['tmp_name'], $dir.$id."_".$file); if($resize == 1){

ruby on rails - Is it possible to convert a string into a partial? -

i have string stored in database used custom layout. i parse custom layout inside of app layout, using : render_to_string(partial: custom_template, layout: "pdf_template", locals: locals) where custom_template string db. however, when try : nomethoderror: undefined method `to_sym' nil:nilclass is possible i'm doing? if so, can complete this? i've noted can try things : render_to_string(text: template, locals: locals, template: "pdf_template") and render_to_string(inline: template, locals: locals, template: "pdf_template") but doing so, can't find template , returns : actionview::missingtemplate: missing template layouts/pdf_template {:handlers=>[:erb, :builder, :coffee, :haml], :formats=>[:pdf], :locale=>[:en, :en]}. searched in: * "/users/elephanttrip/sites/shasta/app/views" which strange because worked fine in current location , definition. if want store views in database, should

html - How to toggle innerHTML between 2 alternative strings using Jquery -

i have span element wish toggle contents of, between words 'price' , 'net', onclick of element. essentially, needs test existing cell contents see present , swap other. something this: <input type = "checkbox" name = "element1" onclick = "$(#element2).togglehtml('price', 'net')"> <span id="element2">price</span> i made togglehtml method used above demonstrate how expect might work. you can use html or text method's callback function. $('input[name="element1"]').click(function() { $('#element2').text(function(_, text) { return text === 'price' ? 'net' : 'price'; }); }); http://jsfiddle.net/blpqj/ you can define simple method: $.fn.togglehtml = function(a, b) { return this.html(function(_, html) { return $.trim(html) === ? b : a; }); } usage: $('#element2

apache2 - Use bottlepy and php in the same computer -

i use ubuntu 12.04 apache2 , mod_wsgi installed. i want use bottlepy , php in local computer . know such issue asked else in apache mod_wsgi , php in same domain . suggest me make new question since problem different. i've change /etc/apache2/sites-available/default this: <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/> options indexes followsymlinks multiviews allowoverride none order allow,deny allow </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bin/ <directory "/usr/lib/cgi-bin"> allowoverride none options +execcgi -multiviews +symlinksifownermatch order allow,deny allow </directory> errorlog ${apache_log_dir}/error.log # possible values include: debug, info, notice, warn, error

php - MissingRegistraton error when trying to send data to GCM -

i've searched lot couldn't find solution question. i'm using php server , trying send pushnotifications android app. when i'm trying out code in browser error: "error=missingregistration". here code run: registration_ids = array($regid); $message = array( 'hangmessage' => $message, 'userid' => $user_id ); $result = $gcm->send_notification($registration_ids, $message); and code call: $url = "https://android.googleapis.com/gcm/send"; $fields = array( 'registration_ids' => $regisration_ids, 'data' => $message, ); $headers = array( 'authorization: key=' . google_api_key, 'content-type= application/json', ); //open connection $ch = curl_init(); //set url, number of post vars, post data curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_ht

mysql - unable to execute query using phpmyadmin -

select email, record_id ( select email, record_id record_data email not regexp ( select group_concat( pattern separator '|' ) blockedcompanies ) tmp ) email not regexp(select group_concat(email separator '|' ) unsubscribed ); whats wrong query? getting following syntax error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'tmp) email not regexp(select group_concat(email separator '|' ) un' @ line 4 i believe : select email,record_id ( select email,record_id record_data email not regexp ( select group_concat( pattern separator '|' ) blockedcompanies ) tmp <--romove here ) <-- , put here. email not regexp( select group_concat(email separator '|' ) unsubscribed );

.net - Row Duplication -

i junior developer working on .net web application project. in 1 of pages user compiles several text fields , presses 'save' button. text fields on page mapped properties of object. have 1 object mapped 1 table in db. use custom orm working quite well. sometimes, happens when users saves page data, corresponding row in db being duplicated. can give me suggestions on might be? hard without knowing more project. it's possible objects being treated new when shouldn't be, resulting in insert instead of update.

Are these two Ruby methods with a hash parameter equivalent? If not, why not? -

first version of method: def method(param1, param2={}) meth_x(param2).meth_y(param1) meth_z #... end second version of method (notice second param2)... def method(param1, param2={}) meth_x(param2={}).meth_y(param1) meth_z #... end i assume these 2 methods equivalent , i'd go first 1 (less typing, less redundancy). however, i'm curious if these expected behave differently and, if so, why. in second, set param2 empty hash before giving parameter meth_x . in method definition param2 = {} means if parameter omitted, set default empty hash, in meth_x(param2 = {}) means drop original content of param2 , replace empty hash, giving meth_x . irb(main):001:0> = {:alma => 2} => {:alma=>2} irb(main):002:0> puts {:alma=>2} => nil irb(main):003:0> puts(a) {:alma=>2} => nil irb(main):004:0> puts(a = {}) {} => nil

c++ - Subscripting a reference to const -

i'm here looking @ c++ code , not understanding something. irrelevant comes yarp (robot middleware) tutorial goes documentation. virtual void getheader(const bytes& header) { const char *target = "humanity"; (int i=0; i<8 && i<header.length(); i++) { header.get()[i] = target[i]; } } now, header reference const , cannot modified within function. get called on it, prototype char *get() const; . how can header.get() subscripted , modified ? program compiles fine. may have not understood happens here i'm basing myself on i've read in c++ primer... i appreciate little clarification! have nice day, char *get() const; the right hand const means "this member doesn't alter in class that's not mutable", , it's honoring - isn't changing anything. implementation this: char *bytes::get() const { return const_cast<char *>(m_bytes); } the pointer being returned, however, simple &quo

Some doubts about BNF grammars and Prolog's DCG grammars -

i studying grammars in prolog , have litle doubt conversions classic bnf grammars prolog dcg grammars form. for example have following bnf grammar: <s> ::= b <s> ::= <s> b that, rewriting, generates strings of type: ab aabb aaabbb aaaabbbb ..... ..... a^n b^n looking on ivan bratko book programming artificial intelligence convert bnf grammar dcg grammar in way: s --> [a],[b]. s --> [a],s,[b]. at first seems me similar classic bnf grammar form have doubt related , symbol used in dcg this not symbol of logical or in prolog separator character in generated sequence. is right? you can read , in dcgs "and then"/"concatenated with": s --> [a], [b]. and t --> [a,b]. is same: ?- phrase(s,x). x = [a, b]. ?- phrase(t,x). x = [a, b]. it different , in prolog rule means logical conjunction: a. b. u :- a, b. ?- u. true. i.e. u true if , b true(which case here). another difference predi

sql - Need assistance understanding pivot table -

apologies pleading title! i have following query need pivot: select name, flag,count(*) [thecount] vwpopulationinformation group name, flag a sample of returns is: name flag thecount clea 1 309 clea 0 2 dms 1 18 dms null 34 emid 1 392 emid null 436 emid 0 45 emidn 0 1 emidn 1 167 emidn null 31 ...and need pivot return name yes no ? total clea 309 0 0 309 dms 18 0 34 52 emid 392 45 436 873 emidn 167 1 31 199 where flag field bit , needs translated to: 1 = 'yes', 0 = 'no', , null = '?' i've looked @ pivot table examples can't head around it. can please? you did not specify database using since mentioned pivot, assuming sql server. use: select name, coalesce(yes, 0) yes, coalesce(no, 0) no, coalesce([?], 0) [?], coalesce(yes, 0) + coalesce(no, 0) + coalesce([?], 0) total ( select name, case

c# - WPF ContextMenu for tray icon -

i'm having wpf application can minimize tray. when normal-click it, window shows again. now i'm wondering how create simple contextmenu ? the contextmenu has filled x options onclick run function. need 'exit'-item linked 'exit_click' method. something i've tried is: contextmenu menu = (contextmenu)this.findresource("notifiercontextmenu"); menu.isopen = true; menu doesn't know of isopen value. other examples use lot of different things. one of them requires me create hostmanager reason. i need simple contextmenu . how can achieve this? as @h.b. mentioned hardcodet's notifyicon pretty darn wpf taskbar icons. sucks don't out of box wpf might use , address issue wait microsoft fix it(they should add library standards) now solve issue(using above solution): download solution build library add source control if have 1 , add reference it( hardcodet.wpf.taskbarnotification.dll ) in project now in mainwin

Convert DataModel to List in Java -

can tell me if possible convert datamodel arraylist ? and how can it? please have know possible!!! i can convert arraylist listdatamodel using new listdatamodel(list list) , don't know how inverse! ex: public void filtrarcamadaporcategoriaefabricante(){ this.listadecamadasparaescolha = new listdatamodel<camada>(this.service.getservicecomponentesconstrutivos().filtrarcamadaporcategoriaefabricante(idcategoriadecamadaaseradicionada, idfabricantedecamadaaseradicionada)); } looks datamodel has iterator http://docs.oracle.com/javaee/6/api/javax/faces/model/datamodel.html#iterator() you should able use iterator iterate contents on datamodel , create arraylist.

backbone.js - requirejs text plugin downloads all templates which are not required -

i'm using requirejs along text plugin load handlebar templates dynamically in backbone layout manager. on page load templates downloaded instead of specified one. in case shown below when want render footer files ( header , modal ) gets fetched instead of footer.tpl . templateloader.js define(function (require) { var handlebars = require('handlebars'); var gettemplatefile = function (templatename) { var tmpl = null; switch (templatename) { case 'header': tmpl = require('text!../html/templates/header.tpl'); break; case 'footer': tmpl = require('text!../html/templates/footer.tpl'); break; case 'modal': tmpl = require('text!../html/templates/modal.tpl'); break; } return tmpl; }; var _compiled = function (tpl, context) { var compiled = handlebars.compile(tpl); r

r - find highest proportion in data.frame -

i have dataframe looks this: x <- data.frame(sector=rep(1:5, each=2), subspecies=rep(c("type a", "type b"), 5), proportion= c(.2, 1-.2, .3, 1-.3, .4, 1-.4, .5, 1-.5, .6, 1-.6)) x$dominance <- na x[,1] <- sort(x[,1]) x sector subspecies proportion dominance 1 1 type 0.2 na 2 1 type b 0.8 na 3 2 type 0.3 na 4 2 type b 0.7 na 5 3 type 0.4 na 6 3 type b 0.6 na 7 4 type 0.5 na 8 4 type b 0.5 na 9 5 type 0.6 na 10 5 type b 0.4 na in each sector 1-5, if type highest proportion, need add 'a dominant' 'dominance' column, or if type b highest proportion, need add 'b dominant' 'dominance' column. if there tie, need add 'ti

image - opencv setting submat of Mat to another Mat -

i having problems using setto() method. code follows: arraylist<mat> someimagesofsamesize = new arraylist<mat>; someimagesofsamesize.add(img1); someimagesofsamesize.add(img3); someimagesofsamesize.add(img3); mat combinedimagesofsamesize = new mat(new range(0,30), new range(0,100*someimagesofsamesize.size()),3); mat tempimage = null; for(int = 0; someimagesofsamesize.size();i++){ tempimage = someimagesofsamesize.get(i); combinedimagesofsamesize.submat(new range(0,30), new range(i*100,(i+1)*100)).setto(tempimage) } it gives me following opencv error: * opencv error: assertion failed (checkscalar(value, type(), _value.kind(), _inputarray::mat )) in unknown function, file ......\src\opencv\modules\core\src\copy.cpp, line 348 exception in thread "main" cvexception [org.opencv.core.cvexception: ......\src\opencv\modules\core\src\copy.cpp:348: error: (-215) checkscalar(value, type(), _value.kind(), _inputarray::mat )] @ org.opencv.core.mat.n_setto(nativ

Get url configuration in django 404 pages when Mezzanine is installed -

i'm working mezzanine django project, , can't figure out how turn on debug=true url configuration output django produces on 404 pages. with mezzanine installed, debug=true, ever blank 404 page. steps tried without success: googling around "mezzanine 404 url" , various implementations skimming mezzanine documentation disabling custom mezzanine 404 handler any ideas on how standard django url report back? thanks mezzanine contains "catch all" urlpattern pages. is, pattern mezzanine pages anything - example.com/foo, example.com/foo/bar, etc. standard 404 error. what you're looking error occurs when no urlpattern matches url requested. can't occur mezzanine, since patterns can match url.

iphone - imported app data via email - I can't access the data -

i have configured iphone app able import , export data via email. far able export files extension .qm2 (this own extension configured in app plist) , import files. data i'm using export nsdata. working fine unable populate array when data imported in. method chose import follows in appdelegate: - (bool)application:(uiapplication *)application handleopenurl:(nsurl *)url { nsstring *urlstring = [url absolutestring]; nsdata *datareceived = [nsdata datawithcontentsoffile:urlstring]; nsarray *newarray = [nskeyedunarchiver unarchiveobjectwithdata:datareceived]; nslog(@"%@",newarray); // logs out null; return yes; } the data there because if nslog urlstring prints our following: urlstring = file://localhost/private/var/mobile/applications/a3615b4e-388f-4986-acd0-b564dbb7d265/documents/inbox/test%201-16.qmf. again problem how imported data , put in nsarray?

c# - Split 'appSettings' section in several web.config files -

i'm working on asp.net project , need add settings in appsettings section of web-app. now these settings growing up, i'd organize them in different files. i've created other web.config files in different directories of application, adding this: <?xml version="1.0"?> <configuration> <system.web> </system.web> <appsettings> <add key="settingkey" value="settingvalue" /> </appsettings> </configuration> but when try access them via configurationmanager.appsettings["settingkey"] , null . so, possible split settings in different files? there way logically organize app settings values? you able see web.config settings within directory if executing path within directory. so example: /mydirectory/web.config is visible if loading page like: /mydirectory/mytestpage.aspx you not see web.config settings here example: /otherdirectory/mytestpage.aspx this post ma

c# - setting database value to a property value of an object -

i'm trying create new object in database take value of database entry based on choice of dropdownlist. in following example want new "domena" object hold value of property "cena" belongs class tld, property "cena" has been created , it's in database decimal value. should take value of "cena" tld class when given tld has been selected dropdownlist. here's domena class model : public class domena { public int domenaid { get; set; } public int tldid { get; set; } // foreign id public int klientid { get; set; } // irrelevant code omitted public decimal cena { get; set; } // value should copied "cena" tld class public virtual tld tld { get; set; } public virtual klient klient { get; set; } } here's tld class : public class tld { public int tldid { get; set; } public string typ { get; set; } public decimal cena { get; set; } public virtual icollection<domena> domeny { get; set; } } i've been looki

objective c - NSPopover padding content on one side -

Image
i have 2 nspopovers, both of set same (just linking custom nsview ib). both pop fine, 1 appears offset content 20px. this nspopover (properly) not padding content... but 1 adds 20px ride side. here 2 views laid out in ib as can see, search bar should pinned right side left, reason not. @ first thought contraints issue, after messing around them while can confirm not. any clue whats up? edit: decided subclass view , fill rect, got strange results! view appears offset. have no clue why is... from here , caught eye (emphasis mine): the principle circumstance in should not call settranslatesautoresizingmaskintoconstraints: when not person specifies view’s relation container. example, nstablerowview instance placed nstableview . might allowing autoresizing mask translated constraints, or might not. private implementation detail. other views on should not call settranslatesautoresizingmaskintoconstraints: include nstablecellview ,

regex - Parsing out a grouping of parentheses with ruby regular expressions -

i trying array of tokens such "((token 1))" , "((token 2))" . have following code: sentence = "i had ((an adjective)) sandwich breakfast today. oozed on ((a body part)) , ((a noun))." token_arr = sentence.scan(/\(\(.*\)\)/) # => ["((an adjective))", "((a body part)) , ((a noun))"] the above code not stop match when runs first occurrence of "))" in sentence "it oozed..." . think need negative lookahead operator, i'm not sure if right approach. typical problem. use non-greedy quantifier. sentence.scan(/\(\(.*?\)\)/) alternatively, replace /./ "things other ")" ": sentence.scan(/\(\([^)]*\)\)/)

javascript - Measure ajax receive time -

i'm trying measure download/upload speed , make lot of simultaneous ajax requests. of them blocked due browser connections limit, can't establish real download time doing kind of this: var start = new date; $.get('/data').done(function () { console.log(new date - start); }); so, i'm using raw xhr way: var open, start, end; var req = new xmlhttprequest(); req.open('get', '/data', true); req.onreadystatechange = function () { switch (this.readystate) { case 2: case 3: if (!start) { start = new date(); } break; case 4: if (!end) { end = new date(); } console.log('%d: pending = %d, download = %d, total = %d', i, start - open, end - start, end - open); break; } }; if (!open) { open = new date(); } req.send(); is there way same using jquery? update i need initialize start not before ajax request, after requeststate changed 2 or 3 (actua

java - Packaging war file with maven -

i thought that, if project named my-web-application, when call mvn clean install maven first compiles target\my-web-application-1.0 folder , "zips" folder my-web-application-1.0.war... but found it's not how (maybe default settings) works. i'm using 3rd party components , i'd modify styles (.css) , behavior (.js) components, replace content in dependency jar modification using <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.2.1</version> <plugin> execution example follows (it zips org folder componenttomodify.jar) <execution> <id>fix</id> <phase>package</phase> <configuration> <executable>jar</executable> <workingdirectory>${basedir}</workingdirectory> <arguments> <argument>-uvf</argument> <argument&

arrays - How To Loop Through Radio Questions Back Button Javascript -

i'm trying loop through array of objects 'back' , 'next' buttons. reason doesn't loop properly. when 'next' button pressed, 'back' button should decrement how every many times more next button pressed. this function accessing button go through sets of radio questions. see full code please visit js fiddle . thanks! var questions = { allquestions: [ { topquestion: [" 1a) click on music producer, produced justins timberlake 4th album?", "2a)click on famous celebrity did justin timberlake date in 1999? ", "3a)click on social media movie did justin timberlake starred in?", "4a)click on famous disney kids show did first justin timberlake made first appearance?", "5a)click on famous singer did justin timberlake accidently tear clothes off during performance?", "6a)what magazine named justin timberlake stylish man in america?"], question: "

objective c - VAO related functions throw error in OpenGL 3.2 cocoa -

i'm writing opengl 3.2 program in cocoa, using 1 simple vertex array. can generate vao correctly, when try bind (using glbindvertexarrayapple), invalid operation error. i've read it's because use *apple exposed functions, there no functions without extension available. i've read have include "gl3.h", i'm including opengl framework through xcode , if try include directly error.

knockout.js - How would I get a Knockout Click binding to respect the Knockout Enable binding on non-form elements? -

i have <span> couple of bindings on it. enable , , click . <span data-bind="enable: buttonenabled, click: takeanaction">take action</span> is there custom binding handler write, or simple way of getting click binding respect (and not act) when enable binding false? i know can add if statement in click action, great if automate action without adding logic view. looks updated question comment. if use button or input element supports being disabled, work naturally you. if did need use span , write quick custom binding wrap in condition check like: ko.bindinghandlers.clickif = { init: function(element, valueaccessor) { var options = ko.utils.unwrapobservable(valueaccessor()), wrappedhandler; if (options && options.condition && typeof options.action === "function") { wrappedhandler = function(data, event) { if (ko.utils.unwrapobservable(options.conditi

linux - How to allow to create a directory in home folder another user -

i have 2 users: adduser user1 adduser user2 i need allow creating folders in user2 home directory user1 user2@ubuntu: mkdir /home/user1/tmp how can that? bacause error message: mkdir "/home/user1/tmp" failed: permission denied this 1 of primary purposes of group permissions in *nix. create group , make sure both users members of group, home directories have group set group-owner, , permissions on home directories include group-write. along these lines: groupadd somegroupname usermod -a somegroupname user1 usermod -a somegroupname user2 chgrp somegroupname ~user1/. ~user2/. chmod g+rwx ~user1/. ~user2/.

mock objects in python are not working on Jenkins? -

i have method, needs mocked dependend on params. e.g.: mock_obj.method('param1').get() returns 10 mock_obj.method('param2').get() returns '~/programs' etc. i using side_effect: def method_mock(*args, **kwargs): param_name = args[0] pref = magicmock() pref.get.return_value = { 'param1': 10, 'param2': "~/programs" }[param_name] return pref mock_obj = magicmock() mock_obj.method = magicmock(side_effect = method_mock) then call mock: >>> mock_obj.method('param1').get() 10 >>> mock_obj.method('param2').get() '~/programs' everything working fine on machine. when run tests (using nosetests) on ci server(jenkins) this: >>> mock_obj.method('param1').get() <magicmock name='mock_obj.method().get()' id='22379152'> >>> mock_obj.method('param2').get() <magicmock name='mock_obj.method().g

java - How to create a local_db.bin from a live app engine application -

is there way export google app engine's datastore , use create local_db.bin file use eclipse? there more 1 way want. the sole sane way create local_db.bin file use local dev web app server it. if source data resides in google cloud somewhere (gae datastore or other google cloud storage mechanism) could: use running gae application access data , export in form suitable local dev web app server read (and write local datastore) somehow use local dev web app server read data google cloud directly (if possible) (and write local datastore) (?) use non-gae google cloud mechanism export data in form suitable read local dev web app server. any help?

c# - Creating,using and comparing elements within a button collection -

Image
i'm making tic-tac-toe project, , i'm having difficulties. i've gotten loose grip collections, can see problem. thing is, created 9 buttons change background image when clicked, , disable themselves. i've managed make run 2 players, wish create sort of ai. i need button collection can compare properties, , avoid usual one-by-one comparison , massive , numerous if statements. what want able test whether buttons in same row or column have same values (background images). i've used far array of strings describes sign value, it's entirely detached buttons, , take lot of time type out code. if cannot done way imagined it, please tell. open suggestions, , grateful. oh, , if need code, or further detail, let me know. you need separate data (array) , presentation (buttons). update i published sample console project compiles , runs. model separate presentation can take tictactoe.cs , write gui it. you don't need string

python - getslice deprecated in Python2.6, but still in use when subclassing tuple? -

consider following example, executed under python 2.6.6 (which i'm unfortunately stuck @ moment): >>> class a: ... def __getitem__(self, index): ... print(type(index)) ... def __getslice__(self, start, end): ... print("don't call me, i'm deprecated") ... >>> = a() >>> a[3] <type 'int'> >>> a[3:3] <type 'slice'> as should be, slicing call __getitem__ . alter definition subclassing tuple : >>> class b(tuple): ... def __getitem__(self, index): ... print(type(index)) ... def __getslice__(self, start, end): ... print("don't call me, i'm deprecated") ... >>> b = b() >>> b[3] <type 'int'> >>> b[3:] don't call me, i'm deprecated why happening? due historical reasons, __getslice__ in places still gets used builtin types. tuple, used [i:j] style synta

jquery - What javascript event is tied to "waiting for localhost"? -

i want wait until "waiting localhost" message in browser goes away before running function. is $(document).ready(#myfunction) or $(window).load( #myfunction ); or else? the first chance run javascript if include in page outside of jquery event callbacks. further page is, sooner run (as it's parsed browser) like... <html> <head> <script type="text/javascript"> alert('running'); //... would execute browser has read first few lines server. it's worth noting there's little point in running javascript there's nothing in dom modify. that's why $(document).ready(); exists - delay script until there's document work with.

utf 8 - Converting web app files to UTF-8 for Windows 8 Apps -

it seems same utf-8 error every time submit windows 8 app. is there faster way convert batch of files utf-8 formatted? you can use powershell script below convert files in directory utf-8. $files = [io.directory]::getfiles("c:\temp\files") foreach($file in $files) { $content = get-content -path $file $content | out-file $file -encoding utf8 } you should able run script above using powershell ise or follow instruction .

Decoding many different resources continuously in Android -

i working on game android. game real time strategy game uses tiles or cells , has actors (units, trees, rock, etc.) occupy cells. in game, cells , actors objects have own draw method. fear of speed problems, decode resource in map class , feed decoded image object's draw method. like this: _watercell = bitmapfactory.decoderesource(context.getresources(), r.drawable.watertile); ... _row.get(cell).draw(_watercell, canvas, _paint, _x, _y); this fine now, considering have few cell types , 1 actor how go when have hundreds of images decode without having decode resource every time draw object? , if decode of resources in map class, cause out of memory errors? i cannot whether decoding resources cause out of memory error since don't know size. however, decoding of resource itself, assuming there enough memory handle whatever being decoded should not cause out of memory exception. more likley result is, depending on how need decode resources, slow app down. have

c - G-WAN persist request data in handler -

solution: int session = (int)get_env(argv, session_id); identifier unique connection us_vhost_data (vhost) or us_handler_data (listener) or us_server_data (server) data persistent > current connection missing pieces: either persistent data connection only or way execute code when current connection closed client (econnreset etc.) or server (e.g. kalive_tmo reached) this should solvable new hdl_before_close state handlers added, makes question answered me. original question: is possible in g-wan handler store information persistent request/connection (don't know if "request" applies here)? to better illustrate mean, got now: client (browser, javascript) sends websocket handshake handler starts, gets into: hdl_after_accept - here call gc_init us_request_data, , no error hdl_after_read - here check us_request_data not yet set, websocket handshake , gc_malloc + set us_request_data, increase kalive_tmo, , return 2 send data client sees we

entity framework - SQL Server Express 2008, Joins, and Timeout Expired Error Message -

i have stored procedure quite bit of joins. query though runs pretty fast, around 3 seconds. cant figure out below error poping every once in while. event cache document uses query minute doesnt ran on , over. using entity framework 5, , stored procedure using cte paging. clues or insight? system.data.sqlclient.sqlexception (0x80131904): timeout expired. timeout period elapsed prior completion of operation or server not responding. ---> system.componentmodel.win32exception (0x80004005): wait operation timed out @ system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action`1 wrapcloseinaction) @ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection, action`1 wrapcloseinaction) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) @ system.data.sqlclient.tdsparser.tryrun(runbehavior runbeha