Posts

Showing posts from January, 2015

ios - Segue from ViewController to first tab of TabBarController -

i've created tabbed application. in first tab (viewcontroller+tableview), shows results taken db. i've button opens viewcontroller in user can filter results (for "city", example). now, how can return first tabbed page segue? because need pass parameters in order query db. if create segue between page , first viewcontroller doesn't show tabbed menu. thank guys. i assume trying achieve pass data 1 tab another. "now, how can return first tabbed page with segue? because need pass parameters in order query db. " actually, don't have perform segue pass data, instead can following: // somewhere in code when need pass data tab viewcontroller: if let tabbarcontroller = tabbarcontroller { let secondtabviewcontroller = tabbarcontroller.viewcontrollers![1] as! secondviewcontroller // let's assume want pass string secondtabviewcontroller.str = "my str!!" } secondviewcontroller: class secondviewcontroller: uiv...

c# - Async method in an async method -

my question: how wait input async method before going on? some background info: have c# app scans qr code, , loads data on basis of value scanned. above works, want app ask whether value scanned right card. the applied code follows: using zxing.mobile; mobilebarcodescanner scanner; private bool correct = false; //create new instance of our scanner scanner = new mobilebarcodescanner(this.dispatcher); scanner.dispatcher = this.dispatcher; await scanner.scan().continuewith(t => { if (t.result != null) handlescanresult(t.result); }); if (continue) { continue = false; frame.navigate(typeof(characterview)); } handlescanresult(result) being (skimmed down): async void handlescanresult(zxing.result result) { int idscan = -1; if (int.tryparse(result.text, out idscan) && idscan != -1) { string confirmtext = carddata.names[idscan] + " found, card wanted?"; messagedialog confirmmessage = new messagedialog(confirmte...

mediawiki - Parsoid test page fail during VisualEditor installation -

i'm trying install visualeditor in mediawiki wiki stuck when test parsoid. this result of test page: error: no api uri available prefix: enwiki; domain: undefined path: /_rt/mediawikiwiki/parsoid error: no api uri available prefix: enwiki; domain: undefined @ /usr/lib/parsoid/src/lib/config/mwparserenvironment.js:295:10 @ /usr/lib/parsoid/node_modules/prfun/lib/index.js:532:26 @ trycatch2 (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:48:12) @ prfunpromise.promise (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:458:15) @ new prfunpromise (/usr/lib/parsoid/node_modules/prfun/lib/index.js:57:21) @ /usr/lib/parsoid/node_modules/prfun/lib/index.js:530:18 @ trycatch1 (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:40:12) @ promisereactionjob (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:269:19) @ promisereactionjobtask.call (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:284:3) @ flush (/usr/lib/parsoi...

php - How to prevent sharing of static variables in inherited classes? -

consider model.php : class model { protected static $class_name; protected static $table_name; protected $id; public static function initialize() { static::$class_name = get_called_class(); static::$table_name = strtolower(static::$class_name).'s'; } } and children, user.php , product.php : class user extends model { protected $username; protected $password; } user::initialize(); class product extends model { protected $name; protected $price; } product::initialize(); since every user or product have same $class_name , $table_name , makes sense make them static . actual values assigned when initialize() method called on child model (e.g. user::initialize(); , product::initialize(); ). problem i expect end following: user -> $class_name -> 'user', $table_name -> 'users' product -> $class_name -> 'product', $table_name -> 'products' yet followin...

android - How to test the uplink/upload link speed -

i'm struggling on how test uplink internet. know how download link speed upload problem. do have implement own server on internet? is there way use http post? connection-less protocol? i looked using ftp free server didn't find 1 allows remove file uploaded. any recommendations?

Android - Using Picasso in order to load an image for a game? -

i have used both picasso , glide in order load images asyncronously in grids images coming phone's external memory , in order download photos internet. android game in first screen need display image below title (the image takes available height). user taps on specific part of image , game starts. the image content drawable resource. so, specific use (a textview , imageview below takes remaining space), should do: -specify image imageview's src property. -use image loading library, such picasso or glide what suggest , why? thank you. edit: image static, static drawable resource.

python - How to sucsessfully ask the user to choose between two options -

new programmer here i'm trying ask user choose between 2 options can't right. inp = int(input()) while inp != 1 or inp != 2: print("you must type 1 or 2") inp = int(input()) if inp == 1: print("hi") if inp == 2: print("ok") quit() even if enter 1 or 2 when ask still spits "you must must type 1 or 2" my end goal if enter 1, continue program while if choose 2 end program. help. just work strings. if need turn "inp" variable integer, don't wrap int() function around input(), wrap variable (i.e. int(inp) ). also, change ors ands: inp = "" while inp != "1" , inp != "2": inp = input("enter 1 or 2: ") if inp != "1" , inp != "2": print("you must type 1 or 2") if inp == "1": print("hi") if inp == "2": print("ok")

javascript - .every() not waiting for HTTP request -

this question has answer here: how can wait set of asynchronous callback functions? 6 answers i running http request using popular node-request module each item in array; running function @ last item of array. code goes this: const request = require('request'); var arr = ['john', 'jane', 'marry', 'scarlet']; var x = 0; arr.every(function (i) { x++; /*instead of waiting request, adds x , moves on making x 3 when first request runs*/ request({ url: 'http://localhost:8810/getlastname?firstname=' + }, function (error, response, body) { //execute code if(x==arr.length){ //therefore function run each item in array. // should run once per array. } }) return true; }) i hoping achieve without writing ton of code therefore keeping code nice , nea...

PowerShell Reflection: Define a MIME type or subtype as a script's output type -

it's possible in powershell define output type on scripts. consider myscript.ps1 : [outputtype([string])] param( [string]$name ) the following returns string : (get-command .\myscript.ps1).outputtype.name but specify script returns text/json or text/xml . way of doing that? inventing types outputtype (e.g. [string.json] ) not work. there two independent mechanisms declaring output types : if knows why is, let know. both mechanisms have been around since @ least psv2. mechanism a : using outputtype attribute above param() declaration in script or function, in question: only accepts full type names of .net types preloaded or manually loaded current session (and quietly ignores unrecognized ones), , doesn't allow associating description type. accessed via (get-command <command-name>).outputtype mechanism b : using .outputs section of comment-based help . accepts free-form descriptions ; while referencing actual type names makes...

How to stop MySQL after entering $ ps -ef | grep mysql? -

so uninstalled mysql (5.7.16) homebrew on mac, when entered $ ps -ef | grep mysql to check if there's process running, got this "501 1069 1024 0 10:06am ttys000 0:00.00 grep mysql" does mean mysql still running computer? how can uninstall mysql completely? thanks much!!! the piped grep command filters lines include given keyword: mysql . the ps command reports piped grep command running process. the output receive finally, means running process having keyword mysql piped grep command mysql parameter.

ios - Generic toArray<T> function which can call an init on the Type T -

Image
i have struct called flowercategory shown below: struct flowercategory { var id :int? var title :string var imageurl :string } extension flowercategory { init?(node :node) { // here } } i creating extension on node class convert node typed class array. problem cannot invoke t.init initializer shown below: extension node { func toarray<t>() -> [t]? { guard let nodes = self.nodearray else { return nil } return nodes.flatmap(t.init) // not work } } is there anyway trying achieve? update:

xml - Android: CustomListAdapter columns not aligning properly -

Image
i have page displays list of items. each row in list has 3 columns , reason, items int list not aligning properly. below code: custom adapter: <textview android:id="@+id/tvcategoryname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="name" android:layout_weight="0.90" android:textalignment="textstart"/> <textview android:id="@+id/tvweight" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="weight" android:layout_weight="0.05" android:textalignment="center"/> <textview android:id="@+id/tvaverage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="average" android:layout_weight="0.05" android:textalignment=...

How can I show the previous view controller in my UINavigationController's stack underneath a new view controller pushed to the stack? -

i want push view controller uinavigationcontroller 's stack still let previous view controller on stack peek through. how can this? if using presentation apis presentviewcontroller:animated: etc., use modalpresentationstyle , don't think can here.

java - Remote server debugging in eclipse -

Image
i trying remote debugging remote server , it's java application. while doing configurations, know hostname , http port number don't know dt_socket port, using java programming. there way find dt_socket port? please guide me. screen shot of eclipse debug configuration:

django - name 'context' is not defined -

i try use view create table (which later want populate data). if open respective url view creates "name 'context' not defined" error. can explain? def room_overview(request, year, month): rooms = room.objects.all() long_month = ['01', '03', '05', '07', '08', '10', '12'] short_month = ['04','06','09','11'] if month in long_month: month_max = 31 elif month in short_month: month_max = 30 elif year % 4 == 0 , year %100 != 0 or year % 400 == 0: month_max = 29 else: month_max = 28 days = [] in range(1, month_max + 1): days.append(str(i)) context['rooms'] = rooms context['days'] = days context['month'] = month context['year'] = year return render(request, 'hotel/overview.html', context) the template view looks this: <h2>overview {{month...

Can Cocoapods support using a shared framework in both an iOS app and iOS extension where the shared framework uses APIs that aren't extension-safe? -

Image
i support suite of related ios apps, of make use of extensions (watchkit , today widget). of these apps , extensions make use of shared private framework i've built on time handling workflows around authentication , common business logic. framework maintained private pod. recently, i've run problem i'd add method framework that's useful ios apps (extensions don't need it) uses apis unavailable extensions (such [uiapplication sharedapplicaion]). i'd usual benefit of shared code, implemented in 1 place (the shared framework) various apps leverage. however, can't find way conditionally include method apps , not extensions without getting compile-time error. normal recommendations around problem suggest use of preprocessor macro opt-out around problematic code if desired, doesn't work shared framework situation. macros applied @ compile-time, shared framework either going include method, or not, , there doesn't seem runtime solution option...

asp.net mvc - Export data to Excel template c# -

Image
i have report template : i should how export data excel files same image. you should not install excel on server seen solution. 1 straightforward way create download csv file. open in excel on client computer. following method shows how this: public actionresult downloadselectedreport(int reportid) { string filename = string.format("downloadlist{0:yymmdd}.csv", datetime.today); memorystream memstream = new memorystream(); unicodeencoding uniencoding = new unicodeencoding(); byte[] reportstring = uniencoding.getbytes(buildreportascsv(reportid)); memstream.write(reportstring, 0, reportstring.length); return file(memstream.toarray(), "application/vnd.ms-excel", server.urlencode(filename)); } use buildreportascsv(reportid) generate report downloading.

playframework - Scala Play 2.5 Turning an Action into A Result -

in play scala project, i'm returning object inside of controller type: play.api.mvc.action[play.api.libs.json.jsvalue however, play complaining expecting play.api.mvc.result . according docs, action function handles request , generates result. def mycontroller = myspecialfunction.asyc(prase.tolerantjson) { implicit request => { { ... stuff ... } yield { myfunction() } } } in case, myfunction has return type of play.api.mvc.action[play.api.libs.json.jsvalue . i want return result, , i'm not sure how correctly call function your action.async block expects function request future[result] . now, myfunction() inside yield block returning jsvalue return type. if comprehension on futures, output of for-comprehension becomes future[jsvalue] . play expects future[result] . transform result future[result] . final output type should future[result] . for example action.async { req => val resultfut...

How to Retrieve the Video ID from private videos within a public Playlist- YouTube API v3? -

i need help getting video id number , video title ( title "private video") private videos within public playlist. i'd need editing script below. script used able that, fear has changed youtube's api. want know if there way information , fix script. my script located here just month ago script (see above) able retrieve video id numbers , video names of private videos when fetching playlistitems playlistid (of course video titles renamed "private video" - info wanted). unfortunately when fetch same playlistid youtube hides info. acts if there no videos in playlist when playlist contains private videos. here question asked last year, shows can pull video id numbers , names playlist contained private videos. retrieve video ids contained in playlist - youtube api v3 here example of playlist want fetch video id , video name from. https://www.youtube.com/playlist?list=plag_-nsalzoolfxbx7egizfsbg21xavct i haven't tried can try playlistitems: ...

node.js - How to run nodejs inside container correctly? -

i have docker image consist of nginx server index.html file following config: server { listen 80; server_name mysite; root /var/www/application; index index.html; } no need add nodejs handle /api/ location following: upstream api_node_js { server 127.0.0.1:3000; } server { listen 80; server_name mysite; root /var/www/application; index index.html; } location /api { proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-nginx-proxy true; rewrite ^/api/?(.*) /$1 break; proxy_pass http://api_node_js; proxy_redirect off; } so need install , run nodejs server on 3000 handle api requests. question how should run correctly? i've tried add running via forever following command in dockerfile: workdir /var/www/application cmd ["forever", "start", "server.js"] but unfortunately after starting...

Swift generic completion handler -

i'm trying figure out how create generic completion handler. below example illustrating example "internal" generic completion handler , same generic completion handler want able create if in "external" form. problem don't know how write equivalent of internalcompletion<t: myenum>... in completion handler. i've written in externalcompletion function i'd imagine like: along lines of func externalcompletion(_ completer<t: myenum>: ((t) -> void) t: hashable)) , not correct. i'm trying possible? hunch swift won't let completion handler remain generic, requiring type casting @ function level, defeat purpose per example (i.e. func externalcompletetion<t: myenum>(_ completer: ((t) -> void)) t: hashable , problem being have choose between enuma, enumb, , enumc, not being able run completer on three.) typealias myenumkeyeddata<t: myenum> = [t: string] t: hashable // mark : - myenum protocol protocol myenum { st...

sprite kit - Swift 3: class doesn't function correctly -

so i've got class named flashypaddleeffect . mention in class, gamescene , doesn't apply effect should. paddle should flashing blue , white colors, stays white. paddle should lose physics body when blue. if need other information, don't hesitate ask. note: there might problems code gave (because of indents, it's quite tricky make code indenting 4 spaces every line, sorry). import spritekit import gameplaykit class flashypaddleeffect { var node = skspritenode() var ballnode = skspritenode() var updatetimer: timer? = nil var timer: timer? = nil @objc func changenodecolor() { switch node.color { case skcolor.blue: node.color = skcolor.white case skcolor.white: node.color = skcolor.blue default: _ = 1 + 2 } } @objc func update() //i used objc prefix silence warning selectors of timers produced. { let previousphysicsbody = node.physicsbody if node.color == skcolor.blue ...

php - How to manage sub-packages (just like Laravel does) with composer? -

looking @ composer.json file on laravel/framework on github, realize laravel utilizing replace property of composer allow user not have install same component twice. but every sub-package has own git repository on github, , version number matches main package laravel/framework . so main package , sub-package has same source code on github. for example: src/illuminate/pagination/ in laravel/framework has same code on illuminate/pagination . and sub-packages included within main package don't have .gitmodules . i'm confusing now... how maintainer sync source code individual sub-package main package? or perhaps sync main package's sub-package git repository of individual sub-packages?

sorting - Looking for error in C++ Quicksort / Insertion sort combo -

im trying build quicksort / insertion sort combo, fast, tackles larger subarrays quicksort , smaller arrays insertion sort, not correct. i've been testing sorting files generated. i'm using file of 1,000,000 numbers, range limit on each number being 1 1,000,000. prior adding insertion sort, able sort 1 million numbers in 0.2 seconds, after adding insertion sort conditional if statement, i'm lucky sort 100,000 numbers in less 4 seconds, know there's error in code, can't find it. code amalgam of different online references these types of sorting methods, don't claim code own , can provide links original if necessary. however, references used weren't written in c++ , class-oriented, had make changes, why think there's error. void modifiedquicksort(arrptr &arraypointer, int first, int last) { int firsttemp = first, lasttemp = last; int temp; int pivot = arraypointer[(first + last) / 2]; if((last - first) < 10) { ...

c++ - I am having trouble understanding why does the output change after removing a variable from a subclass -

hello in code below output "a", don't understand why output (the 'value' variable) changes "b" after removing value variable subclass b #include <iostream> #include <string> using namespace std; class { public: string value; a(){ value = "a"; } void display(){ cout<<value<<endl; } }; class b : public a{ public: string value; b(){ value = "b"; } }; int main(){ *c = new b(); c->display(); } when both classes have variable named value b constructor refers b::value . after removed b , started referring a::value , , assigning it. make variables a::value private, , you'll see compiler complain try access inaccessible member variable.

c# - How to attach jstree nodes in form using jquery and receive in MVC Model? -

i have form multiple jstree elements. gathered jstree nodes using code: var treedata = $('.jstree').jstree(true).get_json('#', { flat: false }); var jsondata = json.stringify(treedata); result array of objects. each node has array of children too. in server-side have model this: public class samplemodel { public int id { get; set; } public string name { get; set; } public list<jstreenode> products { get; set; } } and jstreenode this: public class jstreenode { public string id { set; get; } public string text { set; get; } public string icon { set; get; } public jstreenodestate state { set; get; } public list<jstreenode> children { set; get; } public jstreenodeliattributes li_attr { set; get; } public jstreenodeaattributes a_attr { set; get; } public string data { get; set; } public jstreenode() { state = new jstreenodestate(); children = new list<jstreenode>(); ...

mplayer - mplayer2 license whitelist on yocto -

i using dragonboard 410c + yocto, , i’m trying build mplayer2 . mplayer2 refuses compile due it’s commercial license: … skipped: because has restricted license not whitelisted in license_flags_whitelist i have tried adding local.conf: license_flags_whitelist = “commercial” license_flags_whitelist = “commercial_mplayer2” license_flags_whitelist = “mplayer2” (did not work) ant other idea? thanks! here information needed adding correctly components different licenses local.conf: http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#enabling-commercially-licensed-recipes the problem overwriting whitelist new values each time, takes las value. can either delete last 2 lines or add "+" before "=" in last 2 lines. way: license_flags_whitelist = “commercial” or license_flags_whitelist = “commercial” license_flags_whitelist += “commercial_mplayer2” license_flags_whitelist += “mplayer2”

javascript - AngularJS: The "best" way to bind a Factory variable to a $scope or a directive? -

i'm working on new angularjs project, , encountered problem annoys me more should... i have angular service containing data need access multiple views , controllers, , updated service receiving continuous data server, via socketio. something : angular.module('foo', []) .factory('datacontainer', function(){ var data = []; var o = {}; o.all = function() { return data; }; o.add = function(item){ data.push(item); }; return o; }) .factory('datareceiver', function(datacontainer){ var o = {} o.init = function(){ socket = io.connect() .on('data', function(item){ datacontainer.add(item); }; }; return o; }) .directive('datalist', function(datacontainer) { return { restrict: 'e', template: '<ul><li ng-repeat="item in data">{{item}}</li></ul>', replace: true, ...

c# - Unity.Mvc vs Unity.Mvc5 differences -

Image
i started learn asp.net mvc 5 , found lot of tutorials using unity ioc container dependency injection. i followed great video start: https://www.youtube.com/watch?v=e7voso411vs when looking package install, saw: i found this tutorial october 2014 shows how use unity.mvc framework. required is: adding package (automatically adding unityconfig.cs , unitymvcactivator.cs app_start. create interface ( iunitysample example) , implementation adding constructor homecontroller example takes iunitysample parameter. and finally, add unityconfig.cs in method registertypes register statement: container.registertype<iunitysample, unitysample>(); no need add in application_start method. that seems easy , works, more updated tutorials read, shows people using unity.mvc5 package , not unity.mvc. what should use learn asp.net mvc 5? differences between them? 1 better other? unity.mvc5 , unity.mvc created 2 different organizations , have different imp...

How to determine the execution time of a jQuery script? -

i found interesting script ( link ) runs once after document loaded, how run script every time see it? guys. jquery(document).ready(function($){ settimeout(function(){ $('.trans--grow').addclass('grow'); }, 275); }); you can wrap code function this: function yourfunction (delayms) { settimeout(function() { $('.trans--grow').addclass('grow') }, delayms) } and invoke function whenever want via yourfunction(275) .

linux - Get main color screen gnome -

exist possibility main color in screen in desktop gnome based??? idea control led strip , sync main color in screen... use gnome, if need change windows manager, can that... the idea make this: http://www.makeuseof.com/tag/build-your-own-dynamic-ambient-lighting-for-a-media-center/ automatic

How to retrieve radio stream URLs? -

my question simple still haven't found yet... i'm looking reliable source (and structured one, xml, rss, ...) dynamically list of digital radios , stream url (preferably french radios). goal know these informations @ moment , able refresh these informations if asked user. what found relevant website : http://fluxradios.blogspot.fr/p/flux...francaise.html such website stopped anytime , parsing seems difficult. if has idea... i use listenlive.eu , europe based radios. use radiosenlaweb.com worldwide list, has french ones, has latin / south american radios

c# - Getting InvalidOperationException when using PerformanceCounters -

Image
getting: exception thrown: 'system.invalidoperationexception' in system.dll additional information: category not exist. the code : using system; using system.collections.generic; using system.componentmodel; using system.data; using system.diagnostics; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace windowsformsapplication8 { public partial class form1 : form { performancecounter cpucounter; performancecounter ramcounter; public form1() { initializecomponent(); } int timex = 0; private void timer1_tick(object sender, eventargs e) { cpucounter = new performancecounter(); cpucounter.categoryname = "processor"; cpucounter.countername = "% processor time"; cpucounter.instancename = "_total"; float cpuusage = 0.00f; cpucounter.nextvalue(); cpuusage = cpuco...

r - Generating a legend in ggplot2 -

Image
i tried generate legend ggplot, want illustrate 5 different lines on time horizon of 2,5 months 11 datapoints. can generate graph, doesn't work legend comparing colors , names of lines. tried different commands, i.e. scale_colour_manual, scale_fill_discrete, opts, guides,... nothing works. don't know what's wrong.. can please me? here commands define data frame. spaß <- read.csv(file="spaßfaktor.csv", header = true, sep = ";", dec=",") svs <- ts(spaß$sehr.viel.spaß, deltat=1/52) vs <- ts(viel.spaß, deltat=1/52) n <- ts(normal, deltat=1/52) ws <- ts(wenig.spaß, deltat=1/52) sws <- ts(sehr.wenig.spaß, deltat=1/52) zp <- strptime(spaß$zeitpunkt, format="%d.%m.%y") zp df<-data.frame(zp, svs, vs, n, ws, sws) to generate graph, used example following command (which includes comman scale_colour_manual). including command, r doesn't create graph. if delete out of ggplot command, graph shwos up: ...

java - jtable selectionlistener doesn't work -

i have write little program table in it, i've tried , read many documentation , anwers don't understand doing wrong, because 4th column still editable , no event triggered when select rows... main public class main extends jframe{ /** * */ private static final long serialversionuid = 1l; private jlabel banner; private string[] tecnici; private string[] columnnames; private object[][] data; private jtable table; map<string,list<cliente>> clientilist; private container pane = getcontentpane(); grouplayout gl = new grouplayout(pane); main(){ init(); } private void init(){ imageicon webicon = new imageicon(constants.work_gui_logo); seticonimage(webicon.getimage()); settitle(constants.work_gui_title); setsize(300, 200); setlocationrelativeto(null); setdefaultcloseoperation(exit_on_close); banner=new jlabel("", webicon, j...

Regex to exclude certain error types from the log -

i relatively new need write regex exclude known error types log. 00:11:04 [0] 70-error: invalid index command: "/search.asp". 00:11:04 [0] 70-error: invalid index command: "/wingate-internal//boot.ini". 00:11:04 [0] 70-error: invalid index command: "/". and exclude this: 04:16:46 [8] 70-error: action failed - unencrypted communication not allowed (10.40.88.11): "action=getstatus". 04:14:17 [7] 70-error: action failed - unencrypted communication not allowed (10.40.88.11): "action=getstatus". i have other error types within same log fine reporting, example: 17:43:17.370 executerw: 957:error [2400] db matters - adddoctoworklist - dosqlcommand: error executing sql statement - cid ed83d1e0d in other words, regex report on errors except 2 types mentioned above. i tried creating regex doesn't seem work: /(?:)(?:[^error\:\ action\ failed\ \-\ unencrypted\ communication\ is\ not\ allowed]*)(?:[^error\:\ invalid\ index\ c...

html - Scaling Down Sprite Images in web pages -

i have web page. web pages references 1 image file called sprites.png. file has of images in 1 file. in side of file have image 48px x 48px; i'm referencing in css this: .cell-back { height:36px; width:36px; border-radius:18px; background-color:green; } .play { width:48px; height:48px; background: url('/img/sprites.png') -437px 234px; } in web page, have: <div class="cell-back"> <div class="play"></div> </div> as can imagine, "play" sprite larger space. i'd "play" image 24px x 24px centered within cell-back. but, haven't figure out how scale down sprite image. is there way that? thank you! you have add background-size it. way can scale shown image. .play { width: 48px; height: 48px; background-image: url('/img/sprites.png'); background-position: -437px 234px; background-size: 24px 24px; }

Python - Scrapy get date picker values [Selenium or Scrapy-Splash] -

disclaimer: have searched , tried work examples found on so, have been unable achieve result seek. i trying scrape values newspaperarchive.com, among these values dates(yeah, month & day) paper published. newspaperarchive uses date picker ui , loads content through javascript/ajax calls(not entirely sure). i trying dates, newspaperarchive provides date picker , loads , marks date paper published. what want find out , possibly understand is: if can achieved scrapy-splash. how can achieve selenium if scrapy-splash wouldn't work use case. a sample code can learn future cases more helpful. here example page on newspaperarchive.com http://newspaperarchive.com/us/hawaii/honolulu/hawaiian-gazette/ values are: year = 1895 month = february days = 1, 5, 8, 12, 15, 19, 22, 26 , continue loop through dates year , other years available in date picker news paper. class newspaperarchivespider(crawlspider): name = "newspaperarchive" allowed_domains = ["ne...

java - EmptyStackException when trying to implement Comparator -

i'm new here , have problem. i'm trying implement comparator compare 2 stacks top. code looks this class comp implements comparator<stack<integer>> { @override public int compare(stack<integer> st1,stack <integer> st2) { return st1.peek()-st2.peek(); } } i got java.util.emptystackexception @ st1.peek()-st2.peek(); , don't know why. maybe me better implementation problem. thanks! stack.peek throws emptystackexception when stack empty. need check if stack empty before calling peek on it, example, if want empty stacks come before non-empty ones: @override public int compare(stack<integer> st1, stack<integer> st2) { if (st1.isempty() && st2.isempty()) { return 0; } if (st1.isempty()) { return -1; } if (st2.isempty()) { return 1; } return st1.peek() - st2.peek(); } or if want empty stacks come after non-empty ones: @override public int compare(stack<integer...

android - ViewPager: set a different padding for first and last page -

i implemented "page peek" feature viewpager: mpager.setcliptopadding(false); mpager.setpadding(120, 0, 120, 0); mpager.setpagemargin(60); doing able view portion of previous , next page. first , last page show bigger white space because there's no other page in direction show. how can set different padding first , last page? i had solve same problem , solved setting custom pagetransformer . practically traslate pages when @ first , last position. let me know if works you. mpager.setcliptopadding(false); mpager.setpadding(120, 0, 120, 0); mpager.setpagemargin(60); mpager.setpagetransformer(false, new viewpager.pagetransformer() { @override public void transformpage(view page, float position) { if (mpager.getcurrentitem() == 0) { page.settranslationx(-120); } else if (mpager.getcurrentitem() == adapter.getcount() - 1) { page.settranslationx(120); } else { pag...

c# - How to change printer paper size to A6 or custom paper size in SAP Crystal reports? -

i'm making report of custom papersize printed through c# windows forms application using sap crystal report. while setting printer options code in c# before printing , don't find way set custom paper size within crystal report code. rpt.printoptions.papersize =crystaldecisions.shared.papersize.papera5 ; i wonder if there there way set custom paper size in print options rpt.printoptions.papersize =crystaldecisions.shared.papersize.mycustomsize; from printer preferences in control panel > create custom paper size need from crystal report > rt. click > design > page setup page options > uncheck dissociate formating page size , printer page size > choose custom paper size don't modify printer page size using code finally work without problems

How do I locate my new mySQL database where I want it? -

i'm on windows using mysql workbench when absolutely have to, otherwise ado. i'm experienced jet databases create mdb file, put wherever want whenever want, , open database ado connection string containing path database. now i've got wretched mysql thing ... reason don't understand there's data directory databases go , can't change when creating database(?). so create database shell (1 junk table deleted later, no records) , it's stuck in worthless data directory. want copy/paste shell want it, , start working on through ado create "real" database ... doesn't work; ado connection string contains new path , connection opens no errors, operations change copy in data directory. yes have searched topic, , "solutions" see change default data directory in ini file ... seems silly , unworkable; if want create database , put somewhere else? can please shed light here? once connect mysql database user can create database...

java - WildFly Swarm + War + local Jar dependencies in Gradle - NullPointerException -

i trying build web application server using wildfly swarm , application has able run java program inside (i don't want run external process). trying include external program .jar dependency web application, however, wildfly-swarm-package task fails following: :clean :compilejava :processresources up-to-date :classes :war :wildfly-swarm-package failed failure: build failed exception. * went wrong: execution failed task ':wildfly-swarm-package'. > java.lang.nullpointerexception (no error message) this gradle.build file: buildscript { version = system.getproperty('swarmversion') ?: '2016.10.0' repositories { mavenlocal() mavencentral() } dependencies { classpath "io.spring.gradle:dependency-management-plugin:0.5.6.release" classpath "org.wildfly.swarm:wildfly-swarm-plugin:$version" } } apply plugin: "io.spring.dependency-management" apply plugin: 'wildfly-swarm' apply plugin: ...

c - Scroll through 1d array and change specific values -

my question following. want scroll through 1-d array, check values 4th,5th,8th,9th aka: 0+4*n , 3+4*n. check if value of field 0 , if yes make 1 , stop. if not 0, go next value (0+4*n or 3+4*n) , make 1 , stop. , on.. have done far following. problem updates many values @ once.. { (i=0; i<nr; i++) { (n=0; n<((nr)/4); n++) if (i==(0+(n*4))) { if (array[i]==0) { array[i]=1; break; } } else if ((i==(3+(n*4)))) { if (array[i]==0) { array[i]=1; break; } } } } what doing wrong, , doesn't stop updates values @ once? your interpretation incorrect: 4th, 5th, 8th, 9th etc. correspond 4*n , 4*n+1 , not 4*n+3 here modified , simplified code: (i = 0; < nr; i++) { if...