Posts

printing - How to take printout from android app? -

hi in application want take printout webview page i.e html page.can tell me did mistake.my problem code running in emultor not in other devices. mainactivity.java: package com.example.print1; import android.os.build; import android.os.bundle; import android.annotation.suppresslint; import android.annotation.targetapi; import android.app.activity; import android.webkit.webview; import android.webkit.webviewclient; import android.print.printattributes; import android.print.printdocumentadapter; import android.print.printmanager; import android.content.context; @suppresslint("newapi") public class mainactivity extends activity { private webview mywebview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.web_print); webview webview = new webview(this); webview.setwebviewclient(new webviewclient() { public boolean shouldoverrid...

running multiple FFmpeg instances to encode udp stream gives error -

please me fix problem below i trying encode multiple udp streams in hls format. run 1 one instance (process) of encoding on system. application working fine , able encode, receive , play streams using player running on stb (set top box). encoding ok till running 5 th instance. when started running 6th encoding instance on system, stream output starts freezing in 6 encoded outputs. i using intel xeon based server 24 cores , 32gb of ram. here ffmpeg build info. ffmpeg ffmpeg version n-61057-gec6d043 copyright (c) 2000-2014 ffmpeg developers built on mar 4 2014 05:33:48 gcc 4.6 (debian 4.6.3-1) configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-i/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-l/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --ena...

ruby on rails - where to define name of s3 bucket for different env while using fog gem -

i uploading paperclip attachment s3 in model using fog credentials this... problem need have different bucket name different env, defining bucket in model gets specific every env, else can define it. has_attached_file :news_logo, :storage => :fog, :fog_credentials => "#{rails.root}/config/s3.yml", :fog_directory => "s3-bucket-name" config/s3.yml development: provider: aws aws_access_key_id: xyz aws_secret_access_key: xyz path_style: true you can use rails.env in order customize bucket name, like: has_attached_file :news_logo, :storage => :fog, :fog_credentials => "#{rails.root}/config/s3.yml", :fog_directory => "s3-bucket-name-#{rails.env}" you can like: has_attached_file :news_logo, :storage => :fog, :fog_credentials => "#{rails.root}/config/s3.yml", :fog_directory => (case rails.env when 'production' 'my-production-bucke...

c# - Register All Classes Manually or there is an automatic way? -

i using asp.net mvc 5. new autofac. have lot of classes , each class have do, builder.registertype<authenticationservice>().as<iauthenticationservice>(); builder.registertype<iauthenticationrepositry>().as<authenticationrepositry>(); ............................................................................... ............................................................................... registering each type time-consuming , quite forget-able. there automatic way register components in autofac? if want automatically register types as interfaces , can use registerassemblytypes : builder.registerassemblytypes(typeof(mvcapplication).assembly).asimplementedinterfaces(); or asself , if want resolve concrete implementations.

jquery - start and stop ajax auto refresh -

am developing school e-learning- forums module. posts loaded in <div id="posts"></div> using function: var refreshcon = setinterval( function() { $('#postcontainer').load('new/posts.php', function() { }); },5000); a text box -add new response- inside <div id=""></div> and refreshed rest of data. have added function <input type="text" onfocus="stopcounter()"/> [stop counter clearinterval(refreshcon); , working]. problem is. can't start autorefresh again onsubmit of form. jquery , not friends. please show me simple function start , stop auto refresh @ will. in advance you can use these functions:- to start:- function start(){ refreshcon = setinterval(function(){ $('#postcontainer').load('new/posts.php', function(){ }); }, 5000); } to stop:- function stop(){ try{ clearinterval(refreshcon); }catch(err)...

c++ - Draw ArcCtg ( x ) plot -

i don't how draw graph function: y = arcctg( x ).. i'm not @ math that's i've done far: void drawgraph() { double x,y,z; float xmin=0, xmax=m_pi, ymin=0, ymax=m_pi; // glpushmatrix(); glbegin (gl_line_stipple); (x = xmin; x <= xmax; x+=0.1) { (y = ymin; y <= ymax; y+=0.1) { y = atan(x); y = m_pi_2 -y; //that transform arctan( x ) actan (x ) guess.. glvertex3f (x, y, -1); } } glend (); //glpopmatrix(); } when run program it's not responding : - (... appreciated. thanks! you following: for (y = ymin; y <= ymax; y+=0.1) { y = something; } this create endless loop (unless something > ymax , not in case). imagine following: for (a = 0; <= 10; a++) { = 5; } use variable inside loop instead of y, , you'll fine.

camera - Android name image programatically -

i want give custom name image captured through camera programatically. have used snippets of codes given here how control/save images took android camera programmatically? still doesn't work , image stored default name. idea why? i'd grateful. public class mainactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button camerabutton = (button) findviewbyid(r.id.takepicture); camerabutton.setonclicklistener( new onclicklistener(){ public void onclick(view v ){ //intent intent = new intent("android.media.action.image_capture"); //startactivityforresult(intent,0); intent intent = new intent(mediastore.action_image_capture); uri muri = uri.fromfile(new file(environment.getexternalstoragedirectory(), "pic_...