Posts

Showing posts from January, 2013

How to write rspec tests for ruby Script that works with Git -

i have ruby script checks changes between git repo , files @ url endpoints. if changes exist, commits them , pushes them repo. i'd write rspec tests script, i'm having trouble understanding how so, since don't want tests push actual git repo. i'm thinking need set sort of mock repository i'm not entirely sure. suggestions how best write unit tests such script appreciated. i think can make use of fact it's legal push local "bare" repository, i.e. need following steps: create "bare" repository repo1 (i.e. repository, doesn't have working copy, consists entirely of contents of .git folder) clone regular repository repo2 repo1 . make changes in repo2 (add, commit, push). check push successful. check data available in repo1 too. here's sample console session in /tmp directory: ruby-2.2.0 in /tmp ♥ mkdir repo1 ruby-2.2.0 in /tmp ♥ cd repo1 ruby-2.2.0 in /tmp/repo1 ♥ git init --bare initialized empty git reposi...

javascript - What does getBackgroundPage() function return exactly? (Google Chrome) -

i'm trying return first* image displayed on webpage code: img.src = chrome.extension.getbackgroundpage().imagesrc[0] 0 represents first image. seems work. however, getbackgroundpage() functional tab opened. want work if user using different webpage. in discovering how find first image of website isn't runnning, first have understand chrome.extension.getbackgroundpage() returns. string? or url? i've tried replacing with, [document.getelementid("hi").getsrc.]imagesrc[0]...hi represented in htm as div src of url want...but not work. solutions? why trying use extension this? try this; document.getelementsbytagname('img')[0]; this vanilla javascript , needs no plugins, extensions or particular browsers. edit to answer question; returns javascript 'window' object background page running inside current extension. returns null if extension has no background page. thats according the docs . edit 2 ok, so, chrom...

How to generate canvas component server side and send it to client side in Node.js? -

i want create canvas component server side convert in image , send client side. want perform in node.js facing problem in creating canvas component server side. node.js not have kind of dom default , can't operate on elements such canvas . can here: https://github.com/automattic/node-canvas that package allows manipulate canvas-like object server-side.

javascript - Mongoose query hangs after callback -

this must user error, have reduced example far can, , can't spot it. here make simple query, calls callback result , no error. however, program hangs afterwards; never exits. import mongoose "mongoose"; const someschema = new mongoose.schema({ name: string }); const m = mongoose.model("someschema", someschema); mongoose.connect("mongodb://localhost", err => { console.error("connection error", err); m.find({}, (queryerror, result) => console.log("result:", result, "error:", queryerror)); }); result: connection error undefined result: [ { _id: 55ffada74fb9958d13ec7c4b, name: 'asdf', __v: 0 } ] error: null (program hangs instead of exiting) i'm sure i've overlooked basic, can't spot in guide, , juggling things around isn't helping. weird, have bunch of more complex mongoose models working elsewhere. mongoose: ^4.0.5 babel-node: 5.8.20 your program stay...

Cannot read property 'children' of null at object.Iscroll -

i know question asked before answers not helpful me.here i'm using iscroll, console error "cannot read property 'children' of null @ object.iscroll" when reloading page. can me. function iscroll (el, options) { this.wrapper = typeof el == 'string' ? document.queryselector(el) : el; this.scroller = this.wrapper.children[0]; this.scrollerstyle = this.scroller.style; // cache style better performance this.options = { resizescrollbars: true, mousewheelspeed: 20, snapthreshold: 0.334, // insert point: options startx: 0, starty: 0, scrolly: true, directionlockthreshold: 5, momentum: true, bounce: true, bouncetime: 600, bounceeasing: '', preventdefault: true, preventdefaultexception: { tagname: /^(input|textarea|button|select)$/ }, hwcompositing: true, usetransition: true, usetransform: true ...

node.js - How to install mocha js for Nodejs? -

on ubuntu system nodejs verison v0.10.25 , nop version 1.3.10 . when tried install mochajs testing getting following error user@ubuntu:~/mochatest$ sudo npm install -g mocha npm err! error: cannot find module 'fstream' npm err! @ function.module._resolvefilename (module.js:338:15) npm err! @ function.module._load (module.js:280:25) npm err! @ module.require (module.js:364:17) npm err! @ require (module.js:380:17) npm err! @ object.<anonymous> (/usr/lib/nodejs/tar/lib/entry.js:14:15) npm err! @ module._compile (module.js:456:26) npm err! @ object.module._extensions..js (module.js:474:10) npm err! @ module.load (module.js:356:32) npm err! @ function.module._load (module.js:312:12) npm err! @ module.require (module.js:364:17) npm err! if need help, may report log at: npm err! <http://github.com/isaacs/npm/issues> npm err! or email to: npm err! <npm-@googlegroups.com> npm err! system linux 3.13.0-36-generic np...

android - SKMap (Skobbler) convert map data -

how can convert map data navitel .skm , use offline in android app? currently cannot on own. an intermediary step convert data .osm (something our map conversion tool understands) , create .skm file. note: currently, tool allows 1 convert custom .osm file .skm not public (depending on project scale, might able convert under enterprise agreement - send email dev@skobbler.com).

sharding - how mongodb scales when you have relationships between collections? -

i have mongodb links documents (the data cannot embedded) does mongos cluster ( http://docs.mongodb.org/manual/core/sharding-introduction/ ) support sharding when documents linked? how impacts performance? thanks! considering there nothing special referenced documents , logical relationship inferred application layer , not mongodb itself, sharding supported. applies "manual" references, dbrefs. can shard on dbref property, although i'm not sure why you'd want considering dbref should have inherently low cardinality. there impact in performance both manual , dbrefs, in multiple queries must performed "join" data. docs: to resolve dbrefs, application must perform additional queries return referenced documents. many drivers have helper methods form query dbref automatically. drivers not automatically resolve dbrefs documents.

php - Magento AOE Scheduler not starting -

after updating magento installation 1.9.1, orders emails stopped working. i've read tutorial explains install aoe scheduler , set cronjob. so did, can't open configuration: every time go system --> scheduler --> schedule configuration error, , don't know how fix. no configuration found code "mailup_mailupsync" nb: don't have mailup addon installed the question posted 2 years ago, ran problem today magento 1.9.3 , aoe scheduler last version. there no solution on internet. so, writing here, should need it. mailup email marketing saas mailchimp. provide module magento integration. code, apparently, not clean. when installed, mailup module create task in magento. task syncs local data user account in mailup. if module removed or disabled (setting "false" in configuration file), task remains orphaned , aoe scheduler generates error report. setting mailup cron "disabled" in aoe scheduler not solve issue. so, in /...

Creating an array of strings through user input in c? -

i'm new c clarification helpful! i'm trying use scanner ask program series of words store..what have far is, char[]listofwords[9999]; //creates large array of characters scanf("%s", listofwords); //stores inputs listofwords with this, can access first word easily, comes matter of accessing second, , third words..any suggestion? example, how input was hello how guys i can access "hello" no problem, how call "how" , "are" scanf() accepts input single word.(not after space.) to enter multiple words, can use gets(string) or scanf("%[^\n]", string).

c# - data repeater not showing image -

Image
i need please. have used data repeater display values database, columns display values in text boxes on repeater except image. failing convert byte image here's code save database private void btnsave_click(object sender, eventargs e) { byte[] imagebt = null; filestream fstream = new filestream(this.txtimgpath.text,filemode.open,fileaccess.read); binaryreader br = new binaryreader(fstream); imagebt = br.readbytes((int)fstream.length); // byte[] pic = stream.toarray(); try { condb.open(); oledbcommand command = new oledbcommand(); command.connection = condb; command.commandtext = "insert abaanacc (ccspn_code,ccfname,cclname,ccmname,ccdob,ccgender,ccschool,caclass,ccvillage,ccsiblings,ccguardian,cccontact,ccimage)" + " values ('" + spn_codetxt.text + "','" + txtfname.text + "','" + lnametxt.text + "','" + mnametxt.text + ...

iphone - iOS swift Post request -

so want create post request following output: "user"=>{"email"=>"test@test.com", "password"=>"[filtered]", "password_confirmation"=>"[filtered]"} instead get: {"user[password_confirmation]"=>"[filtered]", "user[email]"=>"test@test.com", "user[password]"=>"[filtered]", "user"=>{}} this code use make post request: let request = nsmutableurlrequest(url: nsurl(string: urlstring)!) let session = nsurlsession.sharedsession() let params = ["user[email]":username.text!, "user[password]":password.text!, "user[password_confirmation]":passwordrepeated.text!] request.httpbody = try? nsjsonserialization.datawithjsonobject(params, options: []) request.addvalue("application/json", forhttpheaderfield: "content-type") request.addvalue(...

android - Adapter converView sometimes null -

i have listview , adapter. simple getview code found below. public view getview(final int position, view convertview, viewgroup parent) { if (convertview == null) { log.d("mzule", "convertview null " + position); convertview = minflater.inflate(r.layout.item_cheap_layout, null); } return convertview; } when build , run app. got logs below. d/mzule (25020): converview null 0 d/mzule (25020): converview null 1 d/mzule (25020): converview null 2 d/mzule (25020): converview null 3 d/mzule (25020): converview null 4 d/mzule (25020): converview null 5 d/mzule (25020): converview null 16 d/mzule (25020): converview null 32 d/mzule (25020): converview null 47 d/mzule (25020): converview null 38 it obvious previous 6 converviews null. not figure out why 16th, 32nd, 47th , 38th convertview null. make listview laggy. take @ here . explaination how listview's recycling mechanism works.

vector - Is it more efficient to slice an array or use Iterator::skip? -

i want call function each element in slice [0+k .. n] , k offset , n number of elements in vector. importantly, want index of element original slice. i have found 2 ways of doing this: use enumerate , skip beginning items vec.iter().enumerate().skip(k).map(|(i, v)| (f(v), i)).min() take subslice , add offset index `enumerate vec[k..].iter().enumerate().map(|(i, v)| (f(v), + k)).min() in both cases, vec vector of strings, , f returns specific character in string ( v.chars().nth(offset) ). of these solutions efficient? let's use code example. it's similar example, bit simpler: fn main() { let items = ["a", "bb", "ccc", "dddd", "eeeee"]; let k = 3; let 1 = items.iter().enumerate().skip(k).map(|(i, v)| (v.len(), i)); let 2 = items[k..].iter().enumerate().map(|(i, v)| (v.len(), + k)); // sanity check results same let items1: vec<_> = one.collect(); let items2: vec...

c++ - #define an array value with index -

for legacy reasons need maintain old array structure(s), compiler tells me there problem 'expression syntax'. here's have: #define array[globalindexvariable] get(globalindexvariable)->subtype; get returns valid pointer struct, contains subtype now imagined take every occasion of array[globalindexvariable] , convert function call, apparently mistaken. i don't know search in context, little highly appreciated. thank much. edit: since asked, here 1 of lines throw error: localvariable = array[globalindexvariable]; i wish stress, i'm not looking make macro , rather want replace array[globalindexvariable]; get(globalindexvariable) , other globalindexvariable used, replacement fail , throw different error. edit: just make absolutely sure understood: right have 4 long arrays of type int . want stuff these struct both mark belong (they describe different aspects of same thing) need bulk solution previous code fragments (a few thousand oc...

IIS Import/Export Application is missing on Windows Server 2012 -

we've got new application server , have set iis. unfortunately, import application of default web site missing... couldn't find have activate / install these items... can me find option enable deployment-category? thanks in advance if don't working can cmd: export: %windir%\system32\inetsrv\appcmd list app "%websitename%/%application%" /config /xml > c:\users\%username%\desktop\%websitexml%.xml and import: %windir%\system32\inetsrv\appcmd add app /in < c:\users\%username%\desktop\%websitexml%.xml you can make own small bat app out of this...

android - Get original ID from filtered Listview -

i have class in can put in stringarray, , shows list search box filter contents. application prone every field has set id. however, when search value, ids change filtered list. there way id original list, in filtered list can have ids 9, 14 instead of 0, 1, 2.... lv1.setadapter(new arrayadapter<string>(this,android.r.layout.simple_list_item_1 , searchitems)); ed.addtextchangedlistener(new textwatcher() { public void aftertextchanged(editable s) { } public void beforetextchanged(charsequence s, int start, int count, int after) { } public void ontextchanged(charsequence s, int start, int before, int count) { textlength = ed.gettext().length(); arr_sort.clear(); (int = 0; < searchitems.length; i++) { if (textlength <= searchitems[i].length()) { if (ed.gettext().tostring().equalsign...

http - Restrict access to static files in NGINX by PHP business logic? -

i have nginx web-server , php business logic. want allow access static files (images, media) users. the authentication rules defined in php. i understand achievable via serving static files through php. cost in low performance. is there alternative approach? solved task using x-sendfile feature. more here: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/

jquery - DateTimePicker set secondary picker minDate to first select date -

i'm using datetimepicker plugin here ( http://trentrichardson.com/examples/timepicker/ ) , have 2 options, 1 being start date , second being end date. i'm trying set second (end date) first selected date can't select date prior first set date. i've tried can't working. code have end date is: $('#enddate').datetimepicker({ timeformat: "hh:mm", stephour: 1, stepminute: 15, hourmin: 8, hourmax: 20, dateformat: "dd/mm/yy", mindate: date(moment($('#startdate').datepicker( 'getdate' )).format("yyyy, mm, dd")), }); which getting format shown in documentation, each time year 2021, instead of 2015 month , day correct! i've used .moment format date correctly have no idea why doesn't work correctly. here revised code works fine me now var startdatetextbox = $('#startdate'); var enddatetextbox = $('#enddate'); $.timepicker.datetimerange( start...

jsf - <t:panelNavigation2> causes javax.faces.FacesException: Cannot add the same component twice -

i using tomahawk20 1.1.14 jsf 2.0 on wildfly 8.2.0. when using <t:panelnagivation2> , below exception thrown: javax.faces.facesexception: cannot add same component twice how caused , how can solve it? here stack trace: caused by: javax.faces.facesexception: cannot add same component twice: nav:panel-nav:nav_panel-nav_uinavmitem1 @ com.sun.faces.context.statecontext$dynamicaddremovelistener.handleaddremovewithautoprune(statecontext.java:751) [jsf-impl-2.2.8-jbossorg-1.jar:] @ com.sun.faces.context.statecontext$dynamicaddremovelistener.handleadd(statecontext.java:678) [jsf-impl-2.2.8-jbossorg-1.jar:] @ com.sun.faces.context.statecontext$addremovelistener.processevent(statecontext.java:352) [jsf-impl-2.2.8-jbossorg-1.jar:] @ com.sun.faces.context.statecontext$dynamicaddremovelistener.processevent(statecontext.java:568) [jsf-impl-2.2.8-jbossorg-1.jar:] @ javax.faces.event.systemevent.processlistener(systemevent.java:108) [jboss-jsf-api_2.2_spec-2.2.8.jar...

Two Forms Binding WPF -

Image
i'm still learning wpf , tried make simple score program use 2 form. first form control panel, , second 1 display. couldn't find way change value in display form when change value in control panel. googled it, said use binding. me please? here code: <window x:class="score.control" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:score" mc:ignorable="d" title="control" height="300" width="400" minheight="300" minwidth="400" background="#ff181818" windowstartuplocation="centerscreen"> <grid> <grid.rowdefinitions> <rowdefinition height="1*"/...

html - How to align div on the bottom inside table cell -

i want content of second div bottom-aligned image. <table> <tr> <td> <div> <div style="float: left;"> <img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" style="max-width: 200px; max-height: 200px;"/> </div> <div style="float: right; vertical-align: bottom;"> want text on same line bottom of image </div> </div> </td> </tr> </table> you can table , table-cell display properties. <table> <tr> <td> <div style="display:table"> <div style="display:table-cell"> <img src="http://www.online-image-editor.com//styles/2014/images/example_image.png" style="max-width: 200px; max-height: 200px;"/> </div> ...

Magento doesn't deliver email to interal domain -

i have problem: let's site www.mysite.com ; everytime cronjob sends mail external domains , emails correctly delivered. but email contains @mysite.com , domain, isn't. think magento trying somehow deliver email itself, our email server outside on web hoster (aruba). i've tried modify "mx entry maintenance" cpanel, , set "remote", nothing changed... don't know if that's correct procedure. how can fix this? have setup configuration magento or hoster ?

c# - Render view as string in MVC 6 -

Image
this question has answer here: render razor view string in asp.net 5 2 answers after long search solution problem, found mvc5 , outdated solutions. now in asp.net 5 beta 7, there way render view string variable ? i need render view show in bootbox javascript control (like modal windows). the mvc 5 solutions not work in version 6 because there no "viewengine" class in there. look: and razor object can´t found: you can use approach (see renderpartialviewtostring ): https://stackoverflow.com/a/32577016/2631076

osx - Xcode 7 fails to open with "Failed to load code for plug-in com.apple.dt.IDE.IDEiOSSupportCore" message -

xcode 7 fails open on mac running os x 10.10.5. dialog box opens saying "loading plug-in failed". starting xcode command line outputs following: 2015-09-20 23:39:36.616 xcode[1511:58710] [mt] dvtpluginloading: failed load code plug-in com.apple.dt.ide.ideiossupportcore (/applications/xcode.app/contents/plugins/ideiossupportcore.ideplugin), error = error domain=nscocoaerrordomain code=3587 "the bundle “ideiossupportcore” couldn’t loaded because damaged or missing necessary resources." (dlopen_preflight(/applications/xcode.app/contents/plugins/ideiossupportcore.ideplugin/contents/macos/ideiossupportcore): library not loaded: /system/library/privateframeworks/mobiledevice.framework/versions/a/mobiledevice reinstalling itunes fixed problem. download latest itunes version , install it, , xcode should open expected.

ubuntu - Automatic Deployment with Git - unable to run post-receive hooks -

i've created repository in /var/repo/myrepo.git using git init --bare and post-receive hooks inside: #!/bin/sh git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f then: chmod +x post-receive now, push local remote works , know because can see local branch in /var/repo/myrepo.git/refs/heads but problem hooks not work. then if run terminal: git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f all file repo copied /var/www/domain.com so why hook not work command inside if executed bash? update_1 as suggested, inside /var/repo/myrepo.git/hooks/post-receive i'm using: git --work-tree=/var/www/domain.com --git-dir=/var/repo/myrepo.git checkout -f >/tmp/mylogfile 2>/tmp/mylogfile the file executable becouse can run with: ./post-receive this copy repo file inside warking dir expected, file "/tmp/mylogfile" empty. you try debugging script outputting stdout , stderr fil...

php - Postmate API not working -

i using postmates api book store. using test credentials, don't know how use it. kindly guide me how can make basic api call. using php. want send post data using curl thank you <?php $url = "https://api.postmates.com/v1/customers/my-customer-key/delivery_quotes"; $uname = "my-api-key"; $pwd = null; $data = array( 'dropoff_address' => '20 mcallister st, san francisco, ca 94102', 'pickup_address' => '101 market st, san francisco, ca 94105', ); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_httpheader, array('content-type: application/x-www-form-urlencoded')); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_httpauth, curlauth_basic); curl_setopt($ch, curlopt_userpwd, "$uname:$pwd"); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($process, curlopt_pos...

node.js - Add NodeJS to a Clojure app in Heroku -

i need node program (nodejs) present in dynos in heroku when deploy clojure app. app not nodejs app, cannot have package.json example , don't want heroku validate whether it's valid nodejs app or not (it's not, it's clojure app). what's way achieve this? i tried setting explicit buildpacks: $ heroku buildpacks === projectx buildpack urls 1. https://github.com/heroku/heroku-buildpack-nodejs 2. https://github.com/heroku/heroku-buildpack-clojure but still when deploying error message: remote: compressing source files... done. remote: building source: remote: remote: -----> multipack app detected remote: -----> fetching custom git buildpack... done remote: remote: ! push rejected, failed detect on logs can see this: 2015-09-21t10:56:07.731335+00:00 heroku[slug-compiler]: slug compilation started 2015-09-21t10:56:07.731344+00:00 heroku[slug-compiler]: slug compilation failed: no cedar-supported app detected 2015-09-21t10:56:07.731346+00:00 he...

java - Test observable evaluated only once -

we using rx-java, have problem test if observable evaluated once. we have following signature of services: class { observable<string> computea(); } class b { observable<void> computeb(string inputa) } class c { observable<void> computec(string inputa) } in our case have service invokes service a, , use result of service input 2 service b , c. want check service in invoked once. we tried using atomicinteger counter mocking observable of service or mocking observable.onsubscribe checking times call invoked, test turns difficult read. the question is: there cleaner way kind of test? we adding source .doonsubscribe(() -> counter.getandincrement()) .op() .op() ... at required place , check counter value after things quiet down. note have operator called publish() makes sure source subscribed once , side-effects of happen once (as long connect() called once).

robotframework - How to write python function to test the matched strings (to use for Robot framework keyword)? -

i writing custom library robot framework in python. don't want use builtin library reasons. my python code : import os import re output = "ip address 1.1.1.1" def find_ip(): cmd = 'ipconfig' output = os.popen(cmd).read() match1 = re.findall('.* (1.1.1.1).*',output) mat1 = ['1.1.1.1'] if match1 == mat1: print "pass" in above program have written python function : execute windows command "ipconfig" written regular expression match 1.1.1.1 create list variable, mat1 = ['1.1.1.1'] now want put condition like, if "match1" , "mat1" equal test should pass. else should fail in robot framework. any 1 please give idea on how write python function purpose? please note dont want use "should match regexp" keyword in robot framework. because know same whatever asking. to make keyword pass, don't need except return caller. fail, need raise ex...

javascript - Plotly sorting dataset -

i havent been able find documentation hoping 1 of guys might able help. i have following chart options: var chardata = [{ x: x, y: y, type: 'bar', marker: { color: '#3bbfb9' }, name: $filter('translate')('competences.graph.current') }], layout = { legend: { traceorder: 'reversed' }, margin:{ b: 200 } }; where x list of names , y looks this: [1, 13, 13, 4, 4, 4, 4, 4, 4, 4, 4, 15, 6, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9] now wish add sort functionality users can press , chart sorts (from low high) however im not sure how this. plotly documentation doesnt state sorting data. note if can set in chartdata configuration sorts low high helpful aswell!

Monolog: Handler to catch errors/exceptions and output the messages in the response (as per PHP default) -

how can configure monolog output php errors within response, have been done without monolog? what want when, example, php e_error occurs within php page, error message output response, , passed other handlers set monolog. afaik, might use streamhandler , have output stdout, don't know how or if work expected? there 2 variations i'd option of: monolog re-formats error message before having output within response monolog relays error (or exception) php native error handling outputs message in same format in response if monolog not mediating it how achieve these? don't know how can monolog register handler exceptions , errors. need write own functions pass register_error_handler() , register_exception_handler() , register_shutdown_function() ? short version: use monolog\errorhandler; $logger = new logger('logger name'); errorhandler::register($logger); longer, more customizable version: use monolog\errorhandler; $logger = new logger(...

PHP: How to push to an array an other array, but without it creating a new value to the array -

i have 2 numeric arrays. 1 starts 0 , ends 24 - , other starts 25 , ends 50. i want merge/push 1 starts 25 continue first one. have new array starts 0 , ends 50. i using array_push isn't serving intentions, this: how push array: 0 => string 'us' (length=2) 1 => string 'au' (length=2) 2 => string 'ca' (length=2) 3 => string 'cn' (length=2) 4 => string 'fr' (length=2) 5 => string 'de' (length=2) 6 => string 'gb' (length=2) 7 => string 'it' (length=2) 8 => string 'jp' (length=2) 9 => string 'kr' (length=2) 10 => string 'ru' (length=2) 11 => string 'dz' (length=2) 12 => string 'ao' (length=2) ...

c# - Enemy sprite going black XNA -

i'm doing simple tower defense game on xna , i'm having trouble. have enemy sprite should green, image correct, when insert on program appears black, in right shape. here's code (sorry it's mess): namespace microdefense { public class game1 : microsoft.xna.framework.game { graphicsdevicemanager graphics; spritebatch spritebatch; enum gamestate { mainmenu, options, playing, } gamestate currentgamestate = gamestate.mainmenu; // screen adjustments int screenwidth = 800, screenheight = 600; cbutton btnplay; level level = new level(); wavemanager wavemanager; player player; gui.button arrowbutton; gui.button spikebutton; gui.button slowbutton; gui.toolbar toolbar; public game1() { graphics = new graphicsdevicemanager(this); content.rootdirectory = "content"; // width of level in pixels graphics.preferredbackbufferw...

c# - Querying the background colour of an app -

i have 2 basic ui designs xamarin.forms app, 1 light backgrounds, , 1 dark backgrounds. basically, icons change white black depending on background colour. have approximated selection of these whether platform ios (light) or android (dark). however, given option android users use skins, wondered if there way of finding out whether phone had light or dark background? thanks. you have make platform specific dependency injection service ( https://developer.xamarin.com/videos/cross-platform/accessing-native-features-through-the-dependency-service/ ). on android use this: https://stackoverflow.com/a/9537629/5064986 to background color: const int type_first_color_int = 28; const int type_last_color_int = 31; typedvalue = new typedvalue(); theme.resolveattribute(android.resource.attribute.windowbackground, a, true); if (a.type >= type_first_color_int && a.type <= type_last_color_int) { // windowbackground color int color =...

php - Opencart 1.4.9 from mysql to mysqli -

my host has upgraded it's php version 5.5 , mysql 5.6. we still using opencart 1.4.9.6 , cannot upgrade store live , have lot of own modifications. right unable view our administration area , message shown on top of of our pages: deprecated: mysql_connect(): mysql extension deprecated , removed in future: use mysqli or pdo instead in /home/public_html/system/database/mysql.php on line 8 how should proceed if want message disappear , able log in our admin pages? possible change mysql_connect mysqli ? here code used in mysql.php : <?php final class mysql { private $connection; public function __construct($hostname, $username, $password, $database) { if (!$this->connection = mysql_connect($hostname, $username, $password)) { exit('error: not make database connection using ' . $username . '@' . $hostname); } if (!mysql_select_db($database, $this->connection)) { exit('error: not connect database ' . $dat...

android - How to import simple ongesture listener and override its methods properly? -

Image
i have error: it says "i dont know find onfling, onscroll etc superclass of simple on gesture listener, though override it my code: package nis.tryout_erjan; import android.view.gesturedetector.simpleongesturelistener; import android.view.motionevent; public class answerview implements simpleongesturelistener { @override public boolean onsingletapup(motionevent e) { return true ; } @override public void onlongpress(motionevent e) { super.onlongpress(e); } @override public boolean onscroll(motionevent e1, motionevent e2, float distancex, float distancey) { return super.onscroll(e1, e2, distancex, distancey); } @override public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) { return super.onfling(e1, e2, velocityx, velocityy); } @override public void onshowpress(motionevent e) { super.onshowpress(e); } @override public boolean ...

oracle - ORA-00933: SQL command not properly ended In Spring batch Item Writer -

i writing 1 spring batch based application in have write consolidated xml file data multiple tables of database. bean id="mysqlitemwriter" class="org.springframework.batch.item.database.jdbcbatchitemwriter"> <property name="datasource" ref="datasource" /> <property name="sql"> <value> <![cdata[ insert lease (lease_id, contract_type, contract_number, lease_amount, description, create_date, register_date) values ( :leaseid, :contracttype, :contactnumber, :leaseamount, :description, :leasecreatedate, :leaseupdatedate) insert customer (customer_id ,first_name, last_name, surname, customer_number, record_code, source_system, birth_date,create_date, update_date,address,street,house_number, state, postal_code, country_code ) values ( :customerid , :firstname, :lastname ,:surname, :customernum...

c# - StartCoroutine with IEnumerator including Time.deltaTime sometimes infinite loops -

Image
i'm hoping can me issue i'm having creating 2d game. i'm using unity create android application. i'm moving character (a goat) across screen using grid system (gridmove - http://wiki.unity3d.com/index.php/gridmove ). i included global , move script in following links : global : http://codeshare.io/i6bdn move : http://codeshare.io/jhdas in move update function there startcoroutine moves goat position (based on grid size 0.5). the transform.position gets set vector3.lerp , time.deltatime. on computer works fine, when start opening programs or attach debugger goat seems keep looping in same position. happens on low end phone or samsung galaxy s4. is there way stop goat resetting transform.position or way check it? can't seem pinpoint goes wrong. looping goat position : if need more information, let me know. while (t <= 1f) lets think second. want move him position 0f position 1f . if reaches 1f , code will not stop running because ...

javascript - let in if without braces -

if (true) { let x = 5 } works expected (no syntax error), but if (true) let x = 5 throws syntaxerror: unexpected strict mode reserved word in node 4.1.0 , babel is expected behavior? know stupid example. i'm wondering wether bug or not. yes expected behavior. the production rule of if statement if ( expression[in, ?yield] ) statement[?yield, ?return] but let declaration is not statement , therefore not allowed in position: statement[yield, return] : blockstatement[?yield, ?return] variablestatement[?yield] emptystatement expressionstatement[?yield] ifstatement[?yield, ?return] breakablestatement[?yield, ?return] continuestatement[?yield] breakstatement[?yield] [+return] returnstatement[?yield] withstatement[?yield, ?return] labelledstatement[?yield, ?return] throwstatement[?yield] trystatement[?yield, ?return] debuggerstatement declaration[yield] : hoistabledeclaration[?yield] classd...

javascript - Ember data: findRecord is undefined. (also peekRecord or peekAll) -

i'm trying switch ember-data , cant seem find solution error: typeerror: this.store.findrecord not function. (in 'this.store.findrecord('feed', feed_id)', 'this.store.findrecord' undefined) this code inside controller action: togglearchive(feed_id, param,intercom_event){ var self = this; this.set('isloading',true); return this.store.findrecord('feed', feed_id).then(function(feed) { //setting system_status of feed either 4 (archived) or 1 (normal) feed.set('system_status',param); //persist change store (and server) return feed.save(); }); }, on route call : model: function(params){ return this.store.findrecord('feed',params.feed_id); }, and in package.json im using : "ember-data": "1.13.8", if call old this.store.find() method, record retrieved, not ideal method being deprecated , doesn't work ...