Posts

regex - use grep/sed/awk to extract string corresponding to certain field -

on fedora system, following: $ cat /proc/net/arp ip address hw type flags hw address mask device 130.48.0.1 0x1 0x2 80:4b:c7:10:3e:41 * wlp1s0 how can pipe result of device (in case answer wlp1s0) using screen editor such sed or grep or awk? thanks! $ awk '/^[0-9]/{print $6}' /proc/net/arp wlp1s0 /^[0-9]/ selects lines start digit, ip print $6 prints 6th colum being device

algorithm - NP-Complete reduction -

the problem states want show independent set poly-time reduces relative prime sets, more formally independent set <p relative prime sets . i need provide reduction f ind.set rel. prime sets, where - input of f must graph g , integer k, k denotes size of independent set. - output of f must set s of integers , integer t, t denotes number of pairwise relative prime numbers in set s. definition of relative prime sets (decision version): it takes set p of n-integers , integer t 1 n. returns yes if there's subset of p, t-many pairwise relative primes. is, a, b in a, must true gcd(a, b) = 1. returns no otherwise so far have come-up believe reduction, not sure if valid , want double check knows how this. reduction: let g graph.let k indicate size of independent set. want find-out if there exists independent set of size k in g. since problem np-complete, if can solve np-complete problem in poly-time, know can solve independent set in...

animation - button click not working after view rotation android -

i have 1 relative layout, inside added 3 image button dynamically. when layout first appear 3 button action click event working properly, rotate whole layout per sensor changed, after rotation of layout button's postion changed can't click event of buttons again @ new postion instead got click event on button's previous positions. please suggest me proper solution. any appreciated. below code how added button , apply roation it's parent view. imagebutton mimage = new imagebutton(context); mimage.setx(x); mimage.sety(x); mimage.setid(id); mimage.settag(id); mimage.setimageresource(r.drawable.dot); this.addview(mimage); rotation code, rotateanimation ra = new rotateanimation(currentdegree, -degree, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); ra.setduration(210); ra.setfillafter(false); view.startanimation(ra);

c - How to convert SOCK_DGRAM to SOCK_RAW? -

i'm working on open source sock_dgram used send rtp packets. like this: int sock = socket(af, sock_dgram, 0); but i'm supposed use same socket sock_raw send udp packets prepare. is possible convert udp socket raw socket? if possible how can done? thanks in advance i don't know why said need use same socket , otherwise, can follow below steps transfer packet on raw socket. create socket using sock_raw . define , populate ip header [ struct ipheader ] define , populate udp header [ struct udphdr ] set socket not use system (kernel) provied header [ setsockopt() ip_hdrincl as 1 ] send buffer [ sendto() ] you can find nice tutorials (and maybe sample codes, too) here .

angularjs - Text in Textarea is not scrolling with ng-repeat with ionic- angular js -

when using textarea below ng-repeat in angular js - ionic . text area not working , time lost focus also. please provide me solution code : <div class="title">comments</div> <ul class="comment_list"> <li ng-repeat="x in comments "> <a><img no-image ng-src="{{profile_img_path.image_url_tiny+x.user.image}}" alt="" class="pro_img"></a> <div class="pro_deatil" > <h2> {{x.user.name}} </h2> <p>{{x.commentdish.comment}}</p> </div> <div class="pro_like" > </div> <div class="clearfix"></div> </li> </ul...

Apache2 restart failed on ubuntu -

when trying restart apache server ubuntu, showing fail... typed command as, $service apache2 restart it shows, restarting web server apache2 [fail] when checked in log file, in var/apache2/errorlog description provided is, [mpm_prefork:notice] [pid 1263] ah00163: apache/2.4.7 (ubuntu) php/5.5.9-1ubuntu4.5 configured -- resuming normal operations it because not using sudo when running command, try: sudo service apache2 restart

php - Can't make Xdebug work with Eclipse PDT -

i have eclipse pdt , xdebug installed xampp . although there various solutions on web couldn't find solution problem . here phpinfo() xampp shows xdebug installed : xdebug xdebug support enabled version 2.2.6 ide key xdebug_eclipse supported protocols revision dbgp - common debugger protocol $revision: 1.145 $ directive local value master value xdebug.auto_trace off off xdebug.cli_color 0 0 xdebug.collect_assignments off off xdebug.collect_includes on on xdebug.collect_params 0 0 xdebug.collect_return off off xdebug.collect_vars off off xdebug.coverage_enable on on xdebug.default_enable on on xdebug.dump.cookie no value no value xdebug.dump.env no value no value xdebug.dump.files no value no value xdebug.dump.get no value no value xdebug.dump.post no value no value xdebug.dump.request no value no value xdebug.dump.server no value no value xdebug.dump.session no value no value xdebug.dump_globals on on xdebug.dump_...