Posts

Showing posts from May, 2011

Android Studio - automatically load support libraries -

i'm getting frustrated having load same support libraries on , on again each time start new project. there make sure they're loaded when starting android studio? thanks. [edit] found library jack wharton doing looking for. check sdk manager plugin : https://github.com/jakewharton/sdk-manager-plugin it exists libraries. have check on building projects graddle in android-studio : tips graddle app generator included libraries graddle test project loads automatically (for example only) buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:0.13.+' } } // manifest version information! def versionmajor = 1 def versionminor = 0 def versionpatch = 0 def versionbuild = 0 apply plugin: 'com.android.application' repositories { jcenter() } dependencies { compile 'com.android.support:support-v4:20.+' compile 'com.android.support:support-annotations:20.+' compile f...

ios - Can get NSInputStream data and play video -

i'm using nssinputstream & nsoutputstream send , receiver data, in server(i named it): open stream send data client - (bool)openstreams { //nslog(@"server: open stream"); [self.delegate callbackmessagefromserver:@"server: open stream"]; nsurl *url = [[nsbundle mainbundle]urlforresource:@"video.mp4" withextension:nil]; nslog(@"path %@",url); nsdata *data =[nsdata datawithcontentsofurl:url]; nslog(@"data %@",data); self.inputstream = [nsinputstream inputstreamwithurl:url]; [self.inputstream setdelegate:self]; [self.outputstream setdelegate:self]; [self.inputstream scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode]; [self.outputstream scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode]; [self.inputstream open]; [self.outputstream open]; return yes; } in - (void)stream:(nsstream *)astream handleevent:(nsstreamevent)e...

java - How to directly download a file from server,without saving it in any folder? -

if(!ermutil.isnull(listofactualfilepaths) && listofactualfilepaths.size()>0){ fileoutputstream fos = new fileoutputstream("/smiles/wrk/attachments/ermweb/taxation/testing.zip"); zipoutputstream zos = new zipoutputstream(fos); iterator itronfnames = listofactualfilepaths.iterator(); while (itronfnames.hasnext()) { stringbuffer actualpath = (stringbuffer) itronfnames.next(); addtozipfile(actualpath.tostring(), zos); } zos.close();//closing both streams fos.close(); } public void addtozipfile(string filename, zipoutputstream zos) throws filenotfoundexception, ioexception { system.out.println("writing '" + filename + "' zip file"); file file = new file(filename); int index = filename.lastindexof("/"); string filenameforzip = filename.substring(index+1); fileinputstream fis = new fileinputstream(file); zipentry zipentry = new zipentry(filenameforzip); zo...

android - Camera Preview is displaying a black screen -

protected void onresume() { super.onresume(); log.d("onresume", "camera has been resumed"); try { mcamera = camera.open(); log.d("onresume", "camera has been opened"); mcamera.startpreview(); log.d("onresume", "camera has started preview"); preview.setcamera(mcamera); log.d("onresume", "setcamera"); } catch (runtimeexception ex) { log.d("onresume", ex.getmessage()); } } getting error while mcamera=camera.open() called.it not able connect camera services. inspit of using permission in manifest file. error while opening camera , camera services d/onresume﹕ camera has been resumed. w/camerabase﹕ error occurred while connecting camera: 0. d/onresume﹕ fail connect camera service getting error in inside try block. have used camera permissi...

mysql - cake php custom query -

i have use custom query in cakephp dont understand how run custom join query. using code $arraytemp1 = $this->user->query('select distinct u.id,u.hunting_association ht_users u left join `ht_user_animal_prices` uap on uap.user_id=u.id uap.animal_type_id='.$this->request->data['user']['animal'].' '); user model ht_users , useranimalprice model ht_user_animal_prices . how combine query? please help. if want use custom queries , want data of useranimalprice model, have put fields in query. like: $arraytemp1 = $this->user->query('select distinct u.id,u.hunting_association, uap.* ht_users u left join ht_user_animal_prices uap on uap.user_id=u.id uap.animal_type_id='.$this->request->data['user']['animal'].' '); if prefer not use custom queries: $fields = array('user.id','user.hunting_association','useranimal...

different backend and frontend language files in a Joomla Module -

this first post on stackoverflow. apologize poor english. developed complex joomla 3+ module plenty of backend options. labels , long description every option stored in language file (more 600 rows...). problem module frontend needs load few of line (20 more or less) , not load others, instead appear loaded anyway. gets worse because of repeated use of module on frontend, causes, guess, unecessary delays. know plugins , components can manage different front , backend language files, not possible modules. i wonder if can load language strings backend or better have totally different files module front , backend thanks in advance help

java - What to do when I have to use 'isSomething' as name of a Boolean variable? -

the question have use 'is' name of boolean variable reasons, , don't know if it's better find way change it's name, or that's not big problem use 'issomething' variable , 'issomething()' getter? there no problem in having field private boolean issomething; , getter public boolean issomething() { return issomething; }

php - Is REST the same as RESTful? -

i have build own rest web service can provide output in either json or xml. when research online creating rest service, eem come across tutorials on how create restful service? have researched on stack overflow , yes there answers, none of them quiet clear enough? thanks yes, they're same thing. rest name of architecture/protocol (representational state transfer), while restful made derived adjective describes service built upon rest principles. it's wordplay, nothing more.

java - Read smart card information without PIN? -

i have java app can read certificates smart cards , use them log in user. app can track failed login attempts using other login methods (user name , password). i want know if possible read user information smart card without pin? mark failed pin entry failed login attempt, because need pin read alias certificate, can't know user attempting login. there anyway read information without pin in java? i tried loading keystore object based on suggestion thread: getting certificates pkcs11 smartcard without pin/password have no luck. don't know if possible. i can seen information activclient agent without entering pin, don't know if java can somehow retrieve this. how loading keystore: keystore keytest = keystore.getinstance("pkcs11",pkcs11provider); keytest.load(null,null); the above still asks pin though have not specified callback handler. pkcs11provider cfg containing activclient dll. load keystore using pin callback handler. after investigat...

java - Count All Permutations Where No Two Adjacent Characters Are the Same -

given sequence contains various amounts of numbers 1, 2, 3, , 4 (examples: 13244, 4442, etc), want count permutations such no 2 adjacent numbers same. believe o(n! * n) , want know if there better 1 out there. have ideas? class ideone { static int permutationcount++; public static void main(string[] args) { string str = "442213"; permutation("", str); system.out.println(permutationcount); } private static void permutation(string prefix, string str) { int n = str.length(); if (n == 0){ boolean bad = false; //check whether there repeating adjacent characters for(int = 0; < prefix.length()-1; i++){ if(prefix.charat(i)==prefix.charat(i+1)) bad = true; } if(!bad){ permutationcount++; } } ...

php - Get a specific key from first level in array only -

im trying value specific key in array. however, key(name) exists @ 2 levels, , not have control of. i need check array value of key 'totalweight' in multidimensional array. im receiving array , doing check this.... $json = file_get_contents('php://input'); $body = json_decode($json, true); if($body['eventname'] == 'shippingrates.fetch') { $shippingweight = $body['content']['totalweight']; // other logic code here... } the rest of code works fine, problem 'totalweight' exists @ 2 levels, , need first level (which total weight of cart, not individual items in cart...) the array receive looks this: { "eventname": "shippingrates.fetch", "mode": "live", "createdon": "2014-11-11t23:47:00.6132556z", "content": { "items": [ { "totalweight": 1000, "customfields": [ { ...

python - Cannot match regex with re.search on Twisted Framework ircbot -

i'll start "i'm not familiar python". i'm trying change default ircbot script twisted channel, cannot re.match or re.search working. for example, works: prompt = ("%s" % self.nickname) prompt1 = ("%s:" % self.nickname) prompt2 = ("%s," % self.nickname) if msg == (prompt1 + " whoareyou?") or msg == (prompt2 + " you?") or msg == (prompt1 + " whoareyou") or msg == (prompt2 + " you"): this 1 well if msg == (prompt1 + " help") or msg == (prompt2 + " help"): however these 2 conditions not work on bot (but work on local script): if re.search(r'%s[:,] help' % self.nickname, msg): elif re.search(r'%s[:,] ?are ?you?' % self.nickname, msg): a previous version of script not using re.search can found here i have found causing problem. twisted included logic handle nickname collision bot. adds ^ @ end of name: # fun, override method determ...

java - Generic interface implementation not working -

my interface is: public interface salesforcerecordservice<t extends salesforcerecord> { t update(t record) throws ioexception; } my implimentation class is: public class salesforcerecordserviceimpl<t extends salesforcerecordimpl> implements salesforcerecordservice { @override public t update(t record) throws ioexception { return null; } } @override gives error, method not override method superclass. i can't able understand problem. you have pass type super class because expects one. if want salesforcerecordserviceimpl generic posted, pass t salesforcerecordservice . try this: public class salesforcerecordserviceimpl<t extends salesforcerecordimpl> implements salesforcerecordservice<t> { @override public t update(t record) throws ioexception { return null; } } also judging name salesforcerecordimpl looks me concrete implementation, maybe want this: public class salesfo...

html - Javascript code won't work -

i want javascript code push text <td class='one'> . reason doesn't work. can give me hand here please? <table> <td class="one"></td> </table> <script> var freq =[2014,8,11]; //incidents & injuries frequency rate window.tdone = document.getelementsbyclassname('one'); tdone.innerhtml = countup(freq[0],freq[1],freq[2]); </script> getelementsbyclassname returns array of nodes ( array object honest). use tdone[0].innerhtml ... this insert html first find node. if want insert html found nodes use loop or array map.

javascript - Error: Undefined data -

i have function fetch new ads in every 10 seconds, im getting error function getnewads(){ var newer ; // fetches old value 'data-value' attribute var old_val = $("#new_data").data('value'); $.ajax({ type: "post", url: "users/process.php", data:{ getnewads: "getnewads" }, cache: false , datatype: 'json', async: false }).success(function(dat){ if(dat.status == 'success'){ $("#new_data").empty(); for(i = 0;i < dat.counts; i++){ newer = dat.counts + old_val; alert(old_val); /// problem att old_val alerts object object. if(newer > 0){ $("#new_data").html('<div class="added_ad">'+ newer +' new ads </div>'); // set 'data-value' attribute #new_data element ...

ios - Swift NSObject subclass get BAD_ACCESS -

i try persiste object nscoding bad_access error avoid multi multiple variable, class, put common variable in robject. think wrong the init don't know what. the error thow in function func parseinfo(allinfos : string) -> void { if let : json = json.parse(allinfos) json? { if let info = all.asarray { description in info { var track : rinfo = sctracks(js: description) self.arraytracks.addobject(track) } // therad 1: exc_bad_access(code=2, address=0x27...) } } } the log doesn't show thing my common class class robject : nsobject, nscoding { var id : int? = 0 var kind : string? override init() { super.init() } init(js :json) { self.kind = js["kind"].asstring self.id = js["id"].asint super.init() } required init(coder adecoder: nscoder) { se...

zend framework - Standalone page navigation problems in php and browsers back button issue -

standalone page navigation problems mean in project have more 5 pages. user compulsory follow order navigate pages(page 1 -> page 2 -> page 3....). if user directly hits the page 3 redirecting 1st page. doing in page 1 when user clicks submit button self added variable session (usernamespace-> navpage = 'page 2') and in page 2 checking if(usernamespace-> navpage == 'page 2') //nothing else redirecting page 1; i have problem when in 3rd page user clicks browsers button not redirect 2nd page because usernamespace-> navpage == 'page 3' in history. please suggest me change navigation's logic not related affected above browser issue. make session data array, , set keys according pages completed: //page1 $_session['pages']=[]; $_session['pages'][1]=true; //page2 if(!isset($_session['pages'][1]) //redirect $_session['pages'][2]=true; //page3 if(!isset($_session['pages'][2]) ...

php - One-To-Many relationship deletes foreign key in Doctrine -

this driving me crazy. a client can have many vehicle s. this 1 many relationship. when trying save entities error saying foreign key null. when remove doctrine relation , store vehicle separately working fine. this how created relation: class vehicle { ... /** * @orm\manytoone(targetentity="client", inversedby="vehicles") * @orm\joincolumn(name="client_id", referencedcolumnname="id") */ public $client; } class client { ... public function __construct() { parent::__construct(); $this->vehicles = new \doctrine\common\collections\arraycollection(); } /** * @orm\onetomany(targetentity="vehicle", mappedby="client", cascade={"persist"}) */ private $vehicles; } i try save entities this: $client = new client(); $vehicle = new vehicle(); $client->getvehicles()->add($vehicle); $em->persist($client); $em->flus...

Java ARP Scanner -

i need write java program, gets computer network interfaces , scans ip addresses , mac addresses within subnet. i'm not sure how that, found there's method called: arping.scan(devicename, network, mask, timeout); is i'm looking for? return? there aren't lot of comments, , i'm new this, can't figure out myself. please help! public void checkhosts(string subnet){ int timeout=1000; (int i=1;i<254;i++){ string host=subnet + "." + i; if (inetaddress.getbyname(host).isreachable(timeout)){ system.out.println(host + " reachable"); } } }

pex - How do I generate "Smart Unit Tests" with Visual Studio 2015 Preview? -

how generate "smart unit tests*" visual studio 2015 ultimate preview? *microsoft's s. somasegar announced "smart unit tests" (under heading 'productivity') visual studio 2015. feature, based on pex, uses code analysis generate unit tests. here's link msdn documentation: generate smart unit tests code

How to parse json with java language keywords -

is there away parse json java keywords class, case, default etc. java object using gson library? lines gson gson = new gson(); myobject myobject = gson.fromjson(json, myobject.class); simply parse json pojo, have key "class" in json , can't use field "class" in java classes. yes, annotate fields @serializedname , specifying name of field. @serializedname("class") private string classfield; or use custom typeadapter .

javascript - jQuery UI's Sortable update event not firing -

i'm using jquery ui's sortable , call function on update. here's code i'm trying now. $(".sortable").sortable({ handle: '.handle' , start: function (event, ui) { console.log('started sorting ' + $(event.srcelement).index()); prev_sortable_index = $(event.srcelement).index(); $('.sortable li:not(.ui-state-highlight)').each(function () { prev_list_elements.push($(this)); new_sort_order.push($(this).index()); }); console.log(new_sort_order); } , update: function (event, ui) { alert("testing"); } }); after sorting, not receive alert message. if move 'update' above 'start', have same results. have tried adding alert start event, stop event, , update event. not errors or warnings, update event not seem fire. made sure not have preventdefault or stoppropagation interfering targeted elements. edit: adding html <ul...

javascript - Jison: Getting parsed token instead of what is defined in Grammar -

i attempting generate parser related recipe ingredients. noticing order parser handles tokens seems follow token's line-item order in jison file, vs. whats defined in ebnf grammar. for example, parsing 6 tablespoons unsalted butter, cut 1-inch pieces yields: error: parse error on line 1: 6 tablespoons unsalted --^ expecting 'unit_name', 'number', 'slash', got 'word' i expect grammar see unit_name tablespoons before eats word . right grammar approach here? have been using interactive jison parser validate grammar states , didnt see gotchas far. jison grammer %lex %options flex case-insensitive unitname [teaspoons|teaspoon|tablespoons|tablespoon|fluid ounces|fluid ounce|ounces|ounce|cups|cup|pints|pint|quarts|quart|gallons|gallon|pounds|pound|milliliters|milliliter|deciliters|deciliter|liters|liter]\b word \w+\b number [1-9][0-9]+|[0-9] char [a-za-z...

c++ - QPainter crashed with QT 4.8.6 in iOS 10.6.8 -

as title, using qt4.8.6. i design ui paint on qwidget in ios 10.6.8. it works fine in ubuntu 14, same code crash in ios. i got following error message: wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsetlinedash: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsetstrokecolorwithcolor: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsetfillcolorwithcolor: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsetshouldantialias: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsetfontsize: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextgettextmatrix: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsettextmatrix: invalid context 0x0 wed nov 12 22:33:01 macbook1.local main[75787] <error>: cgcontextsett...

linux - Simulating Enter in Bash Script on CentOS 6 Minimal -

right using: echo -ne '\n' | alternatives --config java for enter keep current selection, or type selection number: i know there many ways this. looking correct way perform action. don't know if i'm doing right. probably use less interactive. alternatives --set java /your/favorite/version should work. or can use 'expect' command emulate user input.

python - Django queryset efficiency -

i have item object has foreignkey receipt object. class receipt(models.model): ... class item(models.model): receipt = models.foreignkey(receipt) name = models.charfield(max_length=255) cost = models.decimalfield(default=0, max_digits=6, decimal_places=3) ... i display receipts using generic view. class receiptview(detailview): model = receipt and on template, want show items on receipt. <ul> {% item in object.item_set.all %} <li>{{ item.name }}</li> {% endfor %} </ul> this works fine smaller data sets. 1 of receipt objects has 1600 items related it. loading page receipt incredibly slow. using django debug toolbar notice django executing 1 query per item. if alter list item in template rather displaying property of item, display item itself, django executes single query. <ul> {% item in object.item_set.all %} <li>{{ item }}</li> {% endfor %} </ul> unfortunately need display 10 of i...

How to read columns from a file and add each column in separate lists in python 3.4 -

i need dynamic code: if file data looks below, how can add each column of in 3 list separately in python 3.4.1? 0 4 5 1 0 0 1 56 96 i tried , read data file , stored in list like: scores = [['0','4', '5'],['1','0','0], ['1', '56','96']] . don't know how write code put each first letter of array 3 separate lists or arrays. like: list1 = [0, 1,1] , list2 = [4,0,56] , list3 = [5,0,96] thanks basically, have list of rows, , want list of columns. called transposing , can written concisely in python this: columns = zip(*scores) after doing this, columns[0] contain first column, columns[1] second column, , on. columns tuples. if need lists can apply list function result: columns = map(list, zip(*scores)) this dark-magic-looking syntax first uses * operator unpacks list of arguments . here means zip(*scores) equivalent to: zip(['0','4', '5'], ['1',...

68000 - 68k -- Why is this loading FF? -

i've been trying figure out why program loads ff d1. here code: org $1000 start: move.b pattern,d1 simhalt pattern equ $aa50 end start my thoughts pattern in hex. it's word. i'm moving least significant byte of pattern d1. least significant byte 50 in hex, 01010000 in binary. expect d1 contain $00000050 instead contains $000000ff. i'm @ loss. ff 11111111 in binary (obviously) not 01010000. any appreciated. i'm using easy68k. looks you're loading in ff address $0000aa50. that's guess, i'll try out see if case. **----------------------------------------------------------------------------- org $1000 start: move.b #pattern,d1 ;declare pattern ;hexadecimal using # simhalt pattern equ $aa50 ;errror:this exceed 8 bits ;else use move.w *pattern equ $50 ;this works using move.b end start **-----------------------------...

python 2.7 - How to write rejax and xpath for the below link? -

here link https://www.google.com/about/careers/search#!t=jo&jid=34154& have extract content under job details. job details team or role: software engineering // how write xapth job type: full-time // how write xapth last updated: oct 17, 2014 // how write xapth job location(s):seattle, wa, usa; kirkland, wa, usa //// how write rejax extract city, state , country separately each jobs. need filter usa, canada , uk jobs separately. here have added html code extract above content: <div class="detail-content"> <div> <div class="greytext info" style="display: inline-block;">team or role:</div> <div class="info-text" style="display: inline-block;">software engineering</div> // how write xpath 1 </div> <div> <div class="greytext info" style="display: inline-block;">job type:</div> <div class="info-text" styl...

mysql - List all php cli scripts running in the background -

i running background tasks php cli using nohup php app.php & .how can list scripts have sent background , how can forcibly close it?. my script looks like $dbh = new pdo('mysql:host=localhost;dbname=odesk', 'root', ''); $sth = $dbh->prepare("select id,msisdn new_r4 limit 44908,50000"); $sth->execute(); while($result = $sth->fetch(pdo::fetch_assoc)){ will script sent background stop once have processed rows?.

matlab - access and create new array from the array cell of struct -

in file .mat in matlab,there array cell 'channels' 1x1 struct. want create new array contains ['lag_01' 'lag_02' ... 'lpg_12']. is there method ? thanks, channels ans = x.lag_01.: 'lag_01' x.lag_02.: 'lag_02' x.lag_03.: 'lag_03' x.lag_04.: 'lag_04' x.lag_05.: 'lag_05' x.lag_06.: 'lag_06' x.lag_07.: 'lag_07' x.lag_08.: 'lag_08' x.lag_09.: 'lag_09' x.lag_10.: 'lag_10' x.lag_11.: 'lag_11' x.lag_12.: 'lag_12' x.lag_13.: 'lag_13' x.lag_14.: 'lag_14' x.lag_15.: 'lag_15' x.lag_16.: 'lag_16' x.lag_17.: 'lag_17' x.lag_18.: 'lag_18' x.lag_19.: 'lag_19' x.lag_20.: 'lag_20' x.lag_21.: 'lag_21' x.lag_22.: 'lag_22' x.lag_23.: 'lag_23' x.lag_24.: 'lag_24' x.lag_25.: 'lag_25' x.lag_26.: 'lag_26' x.lag_27.: 'lag_27' x.lag_28.: 'lag_28' x...

How to know selected spinner id in android creating programmatically -

i have 6 spinners , create dynamically. list<spinner>listspinner = new arraylist<spinner>(); spinner sp; for(int i;0;i<6; i++) { sp= new spinner(this); sp.setid(i); // load data on spinner listspinner.add(sp); } now concern is, how know particular id of clicked spinner. if click third spinner how of spinner. try this: sp.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> parent, view view1, int pos, long id) { (int d = 0; d < listspinner.size(); d++){ if (listspinner.get(d).getid()==(id)){ // not clear id spinnerstring =listspinner.get(d).getselecteditem().tostring(); log.i("spinn", "selected spinner value=" + spinnerstring ); ...

c# - Get the changes done by ExecuteNonQuery() -

when use dataset , dataadapter modification (insert, update, delete) on table use dataset.getchanges() method change information. but when using sqlcommand.executenonquery() modifications on table can modification information? , if yes, please tell me how access it. dataset , dataadapter work in whole different way sqlcommand . available information of later executenonquery return value: type: system.int32 number of rows affected. msdn

javascript - Babylon.js place a plane normal to the clicked surface -

just completed babylon.js tutorial on how detect click collision. scene setup similar this , have more objects , moving camera. this script moves plane click has occured. not rotate plane coplanar surface clicked on. i'm curious how orient plane normal surface clicked on. here's scene setup: var canvas = document.getelementbyid("rendercanvas"); var engine = new babylon.engine(canvas, true); var createscene = function () { var scene = new babylon.scene(engine); scene.clearcolor = new babylon.color3(0.5, 0.5, 0.5); var camera = new babylon.freecamera("freecamera", new babylon.vector3(0, 1, -15), scene); scene.activecamera = camera; scene.activecamera.attachcontrol(canvas); camera.inertia = 0; camera.speed = 50; var light3 = new babylon.hemisphericlight("hemi0", new babylon.vector3(0, 1, 0), scene); light3.diffuse = new babylon.color3(1, 1, 1); light3.specular = new babylon.color3(1, 1, 1);...

How to send an email through gmail using python? -

i'm trying send emails gmail account using python. i've read many questions here , around internet, none of them solved problem. the code i'm using following (thanks rosettacode ), similar many other code snippets can found topic: def sendemail(from_addr, to_addr_list, cc_addr_list, subject, message, login, password, smtpserver='smtp.gmail.com:587'): header = 'from: %s\n' % from_addr header += 'to: %s\n' % ','.join(to_addr_list) header += 'cc: %s\n' % ','.join(cc_addr_list) header += 'subject: %s\n\n' % subject message = header + message server = smtplib.smtp(smtpserver) server.ehlo() server.starttls() server.ehlo() server.login(login,password) problems = server.sendmail(from_addr, to_addr_list, message) server.quit() return problems my problem during login phase. returns following error message: smtpauthenticati...

.net - C# process.start not working on iis -

i'm trying run exe parameters web application. i'm using process.start() not seem run on iis! it works fine when running iis express. i'm publishing application local iis test nothing. i've tried setting iis admin service enable interactions desktop , ive told iis connect user credentials , set application pool use same user credentials still nothing works! is there else can advise working! cheers. update i got iis run process setting application pool identity local system , double checking credentials site. but expected applications not interact desktop, creating file command line simple, running application parameters not have application open. at moment iis admin service has interact desktop checked , using local system account. ok isn't answer in end got process.start work setting application pool identity local system. but expected commands not interact desktop, enough application needs do. sorry poor answer.

android - Extract GCM from google play services using proguard -

you don't have wanted to, it's simplier, answer below! i want extract gcm google play services using proguard (i've run out of 65k method limit, i dont want to split dex file). i'm not able rid of exception: java.lang.noclassdeffounderror: com.google.android.gms.r$string here proguard config: -injars sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar -outjars google-play-services-push.jar -libraryjars sdk/extras/android/support/v4/android-support-v4.jar -libraryjars sdk/platforms/android-21/android.jar -verbose -forceprocessing -dontoptimize -dontobfuscate -dontwarn com.google.**.r -dontwarn com.google.**.r$* -dontnote -keep public class com.google.android.gms.common.** { public protected *; } -keep public class com.google.android.gms.gcm.** { public protected *; } -keep class com.google.android.gms.common.internal.safeparcel.safeparcelable { java.lang.string null; } -keepnames @com.g...

r - Why are these sequences reversed when generated with the colon operator? -

i've noticed when try generate list of sequences : operator (without anonymous function), sequences reversed. take following example. x <- c(4, 6, 3) lapply(x, ":", = 1) # [[1]] # [1] 4 3 2 1 # # [[2]] # [1] 6 5 4 3 2 1 # # [[3]] # [1] 3 2 1 but when use seq , fine. lapply(x, seq, = 1) # [[1]] # [1] 1 2 3 4 # # [[2]] # [1] 1 2 3 4 5 6 # # [[3]] # [1] 1 2 3 and help(":") stated for other arguments from:to equivalent seq(from, to) , , generates sequence from to in steps of 1 or -1. why first list of sequences reversed? can generated forward sequences way colon operator lapply ? or have use lapply(x, function(y) 1:y) ? the ":" operator implemented primitive do_colon function in c. primitive function not have named arguments. takes first parameter "from" , second "to" ignorning parameter names. see `:`(to=10, from=5) # [1] 10 9 8 7 6 5 additionally lapply function passes it's value...

c - Upgrading Image analysis from 8->16 bit quanta; store calculations in Int32, Float or Double? -

i doing scientific calculations on images in c , use imagemagick read file , output 8 bit quanta raw rgb file analyze. seeing recurring squares in output , garbled, fuzzy regions. suspect integer truncation causing artifacts. after read entire 8 bit, rgb file memory, allocate parallel array of unsigned shorts hold intermediate results during analysis. calculations done doubles , stored unsigned shorts can used in other calculations. @ end, shorts dumped disk , read either photoshop or imagemagick raw, 16 bit rgb images. with 8 bits of input data, granularity chunky on darker areas single digit rgb values common. when working 8 neighboring data points in operation such averaging them all, can store full values of points , still have 16 - 8 - 3 = 5 bits left before overflowing unsigned shorts. experience, ugly, muddy, mangled areas when overflow causes loss of higher level bits. i plan on upgrading input full, 16 bit, unsigned short, tiff type quanta. upgrading parallel, workin...

mapreduce - Hadoop: Getting the input file name in the mapper only once -

i new in hadoop , working on hadoop. have small query. i have around 10 files in input folder need pass map reduce program. want file name in mapper filename contains time @ file got created. saw people using filesplit file name in mapper. if let input files contains million of lines every time mapper code called, file name , extract time file, obvious repeated time consuming thing same file. once time in mapper not have again , again assign time file. how can achieve this? you use mapper's setup method filename, setup method gaurenteed run once before map() method gets initialized this: public class mapperrsj extends mapper<longwritable, text, compositekeywritablersj, text> { string filename; @override protected void setup(context context) throws ioexception, interruptedexception { filesplit fsfilesplit = (filesplit) context.getinputsplit(); filename = context.getconfiguration().get(fsfilesplit.getpath().getparent().getname())); } @o...

Merging three numpy arrays as jpeg image in python -

i have split jpeg image r,g,b , converted them numpy arrays. changed pixel values of r,g,b. want merge these 3 1 jpeg , save it. original image 1024 * 500 image. if can give me idea, great help im =image.open("new_image.jpg") r,g,b=im.split() r=np.array(r) g=np.array(g) b=np.array(b) then changed values of pixels. want merge resulting r,g,b. in advance based on document (page 4 in end), can merge: r, g, b = im.split() im = image.merge("rgb", (b, g, r))

security - Why can't the Yesod session cookie be hijacked? -

the yesod book says the encryption prevents user inspecting data, , signature ensures session can neither hijacked nor tampered with. it's not clear me why case. if eavesdropper gets hold of cookie sent server , uses before legitimate user makes request, won't session end being hijacked? it seems me way prevent session hijacking use ssl throughout. if signing , encryption done yesod ends being unnecessary overhead (edit: overhead far preventing hijacking concerned. @sr_ points out in comments, still useful otherwise). that's catch. used more accurate, when include ip address of client in cookie prevent hijacking. combined anti-tampering protections, made impossible mitm attack work unless nated behind same router or using same proxy. unfortunately, had disable protection due concerns proxies well. it's possible single user's requests come multiple ip addresses due intermediate proxy servers. don't have data tell how happens, there e...

scope - Common Lisp the Language: "dynamic shadowing cannot occur" -

near end of chapter 3 of common lisp language, steele writes "constructs use lexical scope generate new name each established entity on each execution. therefore dynamic shadowing cannot occur (though lexical shadowing may)". confused means "dynamic shadowing cannot occur". example of "dynamic shadowing" like? here example of might have meant: (defun f (g) (let ((a 2)) (funcall g a))) (let ((a 1)) (f (lambda (x) (- x a)))) this returns 1 in common lisp because lexical binding of a in f not affect binding of a in top-level let , so, when f calls g , subtracts 1 2 because lambda gets a top-level binding. contrast dynamic binding in emacs lisp, return value 0 . you might find instructive work out contorted-example , try in cl , elisp.

javascript - Strip content of specific tags -

i can strip html correctly out of string doing this: htmltotext = function(html){ return jquery(html).text(); }; but there cases html string containing styling like: <style type="text/css"> .button:hover { background-color: #6b6d71; } </style> the function strip <style> tags text end with .button:hover { background-color: #6b6d71; } i'll know if jquery able strip styles , how. you can use .clone() , remove style tags using .remove() . var $foo = $('.foo'), $fooclone = $foo.clone(); $fooclone.find('style').remove(); $('#output').text($fooclone.text()); here small demo: http://jsbin.com/lamasabapu/1/edit?html,css,js,output

how to show high level overview of a slideshow presentation in powerpoint or google slides -

i attended lecture speaker's slide show had header through entire presentation showing high level grouping of slides , dot representing how far through overall presentation were. liked style lot , trying emulate cannot seem find tutorials or come right keywords search on this. there specific name , how accomplish in powerpoint or google slides preferably. try searching on powerpoint breadcrumb

android - How to reduce app data usage? -

i have android app sends http post every 5 minutes gps data. size of post (including header , body) less 1kb. response less 1kb. however, i'm noticing app consuming 40kb every post. after experimenting , eliminating other factors contribute data usage, i'm post thing that's consuming 40kb. normal http post consume data? or way android os handles network calls adds overhead? below code i'm using post. i'm using apache http library. public string callwebmethod( context pocontext, string psresturl, string psmethodnamewithgetparameters, jsonobject pspostparameters, long pntimeout) { string shttpposturl = ""; stringentity paramentity = null; httpclient httpclient = new defaulthttpclient(); httppost httppost = null; httpresponse httpresponse = null; string sconvertedresponse = ""; httpparams httpparams = new basichttpparams(); try { // set entity parament...

One canvas , multiple layered content -

Image
i have built banner multiple canvas (position: absolute, different z-idexes) but... i'd liek re-create teh whole thing 1 canvas , proves problem. banner's animation quite complex here brief question taht me understand how works. i'd "cut" hole in black rectangle red 1 becomes visible here code: red.beginpath(); red.fillstyle = '#af0000'; red.fillrect(33, 33, 200, 60); // drawing red rectangle red.closepath(); red.beginpath(); red.fillstyle = '#000'; red.fillrect(77, 66, 120, 60); // drawing black 1 red.clearrect(110, 80, 20, 20); // cutting 20x20 pixels rectangle red.closepath(); i know why both rectangles affected. illustrate i'd achieve. make 2 canvas - draw red rectangle on 1 , black on another, , cut black 1 - i'd 1 canvas only. - know re-draw red part doubt that's wise solution. here fiddle: http://jsfiddle.net/hej11px9/ thanks in advance! i know quite amateurish questio...

Arduino PWM LED's not fading in or out -

i attempting make arduino haunted pumpkin using pir sensor trigger led's lights , mouth. want mouth led's shut off immediately, want eyes fade away. i've been working on hours , can't figure out why eye led's not fade in or out, though same code snippit works in it's own program fine. missing small , easy, cannot seem find it. be gentle. know code messy. i've tried numerous different things , tend comment them out rather deleting in case need them later. //uses pir sensor detect movement. //randomly selects number corresponds set of led's //lights led's //author: //date: 11/12/2014 int inputpin = a1; // choose input pin (for pir sensor) int pirstate = low; // start, assuming no motion detected int val = 0; // variable reading pin status //int randnumber; //variable holding random number //int eyeblue =6; //variable blue eye led's //int eyered =9; ...

c# - How to receive a plain web response in the format of a photo and show it in a picture box? -

there website sends photos of users in plain text. link pages follows: http://example.com/getphoto.asp?id=0123456789 how can implement windows forms application in c# or vb.net receives plain data , shows image in picturebox ? var url = "http://example.com/getphoto.asp?id=0123456789"; using (var wc = new webclient()) { picturebox1.image = image.fromstream(wc.openread(url)); }

rubygems - ruby gem not found although it is installed (Ubuntu 14) -

i know question has been asked before, yet i've not been able remedy existing advice. my gem environment follows: gem environment rubygems environment: - rubygems version: 1.3.7 - ruby version: 1.9.3 (2014-10-27 patchlevel 550) [x86_64-linux] - installation directory: /usr/lib/ruby/gems/1.9.1 - ruby executable: /usr/bin/ruby1.9.1 - executable directory: /usr/bin - rubygems platforms: - ruby - x86_64-linux - gem paths: - /usr/lib/ruby/gems/1.9.1 - /home/egge/.gem/ruby/1.9.1 - gem configuration: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - remote sources: - http://rubygems.org/ i installed gem: gem list --local | grep active activesupport (4.1.7) activesupport-inflector (0.1.0) but when run ruby, can't find it: /usr/bin/ruby1.9.1 -e 'require "active_support/inflector"' -e:1:in `require': cann...

php - Laravel Mysql Table Joins -

i have 2 tables in database, 1 called ticket , 1 called status(status of ticket new or completed)...every time user adds ticket want status table updated ticket id , status message. is way mysql table joins? public function usersubmitticket() { $validator = validator::make(input::all(), ['subject' => 'required', 'message' => 'required']); //if 1 or more of text boxes dont contain data, validator fails , user returned backa redo form if ($validator->fails()) { return redirect::back()->withinput()->witherrors($validator->messages()); } $user = auth::user(); $userid = $user->id; $subject = input::get('subject'); $message = input::get('message'); $date = new datetime(); $ticket = ticket::insert(array('id' => null, 'date_in' => $date, 'originator_id' => $userid, 'assigne...