Posts

Showing posts from March, 2010

java - Trouble Importing Resources with Eclipse -

i'm setting jlabel show icon. public icon geticon(string type) throws ioexception { string avatar = "academic.jpg"; switch(type) { case"academic": avatar ="academic.jpg"; break; case"alchemist": avatar ="alchemist.jpg"; break; case"assassin": avatar ="assassin.jpg"; break; } classloader classloader = thread.currentthread().getcontextclassloader(); inputstream input = classloader.getresourceasstream(avatar); image logo = imageio.read(input); icon icon = new imageicon(logo); return icon; } "input" still null on 3rd line, when "avatar" contains string "pic.jpg". resources folder in src folder? have done wrong? how eclipse know how find images? you passing file name no path of kind unless file located @ root of project, , or classpath not found. need add path details of file located. sounds @ least start with: /sr

wordpress - How to install missing woocommerce pages from tools menu in woocommerce 2.1.5 -

i new wordpress , have installed woocommerce 2.1.5 skipped logout , change password links during pages install. in woocommerce documentation woocommerce team mentioned there feature add missing pages tools menu when go tools menu cannot see button install missing pages. wonder how can this. there step have missed or need install other plugin button inside tools menu? thanks, aisha this can done by: go "system status" tab on woocommerce click on "tools" tab @ top of page on page, sixth option down called "install pages". clicking "install missing woocommerce pages. pages defined , set not replaced."

ruby on rails - Delete an element in a hash without deleting the model -

i want delete element hash in rails. delete method looks promising, , works 1 unintended consequence... deletes model. # users. @search = user.all # unset yourself. id stored in current_user.id @users.delete(current_user.id) the resulting @users hash in fact have own id removed... deletes model. correct way unset key in ruby / rails? the behaviour describe isn't accurate on many counts. first, user.all returns array, not hash, assuming you're using activerecord here, premise of question flawed. secondly, deleting item array using array#delete not invoke delete on item itself. isn't true. wouldn't hash either. thirdly, also won't delete item array @ all, unless index happens match index of item in array, isn't likely. you're wildly misinterpreting experiment. you don't delete things array passing field belonging object (like id) array#delete . need pass array index. need figure out index of record matching current user, ,

c# - An entry with the same key already exists? Gridview -

i have gridview control on page , time try use delete button comes it, gives me error mentioned above. here code: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datakeynames="id" datasourceid="accessdatasource1"> <columns> <asp:commandfield showdeletebutton="true" showeditbutton="true" /> <asp:boundfield datafield="id" headertext="id" insertvisible="false" readonly="true" sortexpression="id" /> <asp:imagefield dataimageurlfield="picpath" dataimageurlformatstring="placeimages/{0}" headertext="picture" controlstyle-cssclass="editphotogridformat"> <controlstyle cssclass="editphotogridformat"></controlstyle> </asp:imagefield> <asp:boundfield datafield="pi

android - Changing background color of a selected List item -

i have menu drawer list has custom arrayadapter. wish change background color of selected list item i'm not sure how to. tried changing in getview of adapter, how others have suggested, didn't work, background color still unchanged. here's tried: public view getview(int position, view convertview, viewgroup parent) { view myview = getitem(position).getview(minflater, convertview); if (myview.isselected()) myview.setbackgroundcolor(color.black); return myview; } where should doing this, , how? thanks. you can using selector below... <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="#ffffff" android:state_activated="false"/> <item android:drawable="#000000" android:state_pressed="true"/> <item android:drawable="#000000" android:state_activated

javascript - Bootstrap/bootflat and jQuery progress bar -

i trying progress bar display , animate while loading html page div jquery. my progress bar comes bootstrap (bootflat) , looks this: <div class="progress" style="visibility:hidden;"> <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">60%</div> </div> my script looks this: $(document).ready(function(){ $("#btnticker").click(function(){ var ticker = this.form.txtticker.value; $("#progress-bar").show(); $("#info").load('info.php?t=' + ticker, function() { success: $("#progress-bar").hide(); } ); }); }); i can't figure how progress bar displayed , moving; need bit of guidance did google search , couldn't find tutorials beginners (which am). thanks $("#progress-bar&qu

Avast android anti-virus detected "Android:Looter-Z" [PUP], in my app -

i have app " networking cables ", sent me email, say: "avast android anti-virus detected "android:looter-z" [pup]" in app, when check app no virus. what mean????? i suggest checking post avast . appears there issue in detection whatever definitions user using. recommend updating definitions , trying again. suggest user.

jsf 2 - What is an alternative of a4j:JsFunction in JSF 2.0? -

i new jsf 2.0. my current project build on jsf 1.3 , richfaces 3.3. trying migrate jsf 2.0. there limitation not use richface 3.3 or 4.0 in current project or third party tool/library. our goal use jsf 2.0 functionality/feature. in project there lot of use of <a4j:jsfunction data="action" oncomplete="javascriptfunction(data); > <a4j:actionaram name="nm" assignto="#beanname.methodname"> </a4j:actionparam> </a4j:jsfunction> i want remove type of a4j:jsfunction h:commandbutton or jsf 2.0 standard mechanism. i not able find out best way call bean function return value , assign return value javascript function. jsf 1.3? thought 1.2 latest? on question. idea use jsf 2.x invalid , should have decision maker reconsider because skimping on omnifaces impede productivity , general code quality. the way see have 3 choices: omnifaces click button display:none using javascript. said button can have f:ajax c

java - Camel: Implementing Polling and Non-Polling Consumer within the same component -

i implementing own custom component , have found going need 2 use cases consumers: the first 1 trying n number of available messages every (polling consumer) the second 1 subscriber consumer gets messages when available. my main question if possible implement these 2 types. have been trying write code, seems if developing pollingconsumer cannot implement type. also, if possible, there example, article or guide how this? have been looking for nothing came up. thanks! there 2 consumer kind in camel (eg eip book) consumer pollingconsumer its former used in camel routes. , latter used when use explicit or when using consumertemplate, use receive methods. a camel component able adapt consumer pollingconsumer out of box. so depends if want build camel component used in routes, can create consumer. , have able both poll , subscribe. when have data, create exchange , call processor route it. for documentation check camel website, and/or chapter 11 in camel

single sign on - Using Reverse Proxy with IIS / ARR / URLRewrite with Office 365 authentication layer to access internal applications -

i have been able create asp mvc application authenticates using office 365 sso. i looking way have office 365 sso layer before accessing internal applications (apache) have on network. we have setup reverse proxy arr / url rewrite discussed in document: https://confluence.atlassian.com/display/jirakb/integrating+jira+with+iis+using+arr the issue having url-rewrite happening high execution stack , bypassing modules. i looking guidance on how implement office 365 authentication layer on iis internal non asp.net applications sits behind firewall. any ideas? i have experience arr , wif. had become familiar how iis 7.5 handles native vs. managed code. assuming running app pool in integrated mode otherwise rest of won't applicable. it's hard know due not knowing details on issue have configuration issue related managed vs. native/unmanaged code. arr native http module. used in conjunction urlrewrite http module allow content served end web server. by defaul

javascript - open the file upload dialogue box onclick the image -

i want open image upload file dialogue box if click button tag.is possible.if how can in php while{ echo "<td><button><img src='".$cfet['productimage']."' width='50' height='40'></button></td>"; } include input type="file" element on html page , on click event of button trigger click event of input type file element using trigger function of jquery the code like: <input type="file" id="imgupload" style="display:none"/> <button id="openimgupload">image upload</button> and on button's click event write jquery code : $('#openimgupload').click(function(){ $('#imgupload').trigger('click'); }); this open file upload dialog box on button click event..

jquery - Dialog loads on page before it disappears -

i'm using jquery ui dialog pops when user clicks button (otherwise, should hidden). when page loads, dialog seen on page few seconds before disappearing (because dialog embedded onto page). there anyway prevent appearance when loading? when set dialog box html , set dialog box css {display:none} or if want jquery onpageload apply $(document).ready(function(){ $("#dialgboxid").hide(); }); now if load page problem not appear , when open dialog box click appear correctly

jquery - Responsive slides - How to Add button to slides -

i using responsive slides client project. need add "read more" button on slider images links. have searched through google , stackoverflow expecting answer. have decided ask question. below have added code have done slider. new javascript , jquery. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="responsiveslides.min.js"></script> <link rel="stylesheet" src="responsiveslides.css"></link> <div class="rslides_container"> <ul class="rslides" id="slider"> <li><img src="1.jpg" alt=""></li> <li><img src="2.jpg" alt=""></li> <li><img src="3.jpg" alt=""></li> </ul> </div> <script> $(function () { $("#slider").responsiveslides({ au

hibernate - unidirectinal @OneToMany without join table -

i using hibernate. parent class company. company has many activities. need load activities when company loading. need save company , activities separately. in company class have: @onetomany(fetch = fetchtype.eager, targetentity = activity.class) private set<activity> activityreuslts; in activity not have join company table. when try run gives 'ora-00972: identifier long' exception. can't this? appreciate help. i think when use target entity gives exception since wrong mapping. select this_.company_id y0_, this_.a ttempt_id y1_ mel_company this_ inner join mel_company_mel_company_activ ity_out_put activityre3_ on this_.company_id=activityre3_.mel_company_company_id , this_.attempt_id=activityre3_.mel_company_attempt_id inner join mel_company_activity_out_put activityre1_ on activityre3_.activityreuslts_company_activity_re sult_id=activityre1_.company_activity_result_id. according there 2 joins same activityresults. 1 wrong. 'mel_company_mel_c

arrays - C# - store strings in List -

Image
only working on c# 2 weeks. i've been searching on problem few days , cannot find simple answer, or answers don't want. here goes. i reading text file line line (no problems). example: a line msh line 2 b line msh b line 2 b line 3 i want store lines in list following ; list lstore[0,0] = line msh lstore[0,1] = line 2 lstore[1,0] = b line msh lstore[1,1] = b line 2 lstore[1,2] = b line 3 i've been using : list<string[]> lstore = new list<string[](); to define list. i'm looping through file read while ((sfilecontents = srfile.readline()) != null) { boolean bmsh_start = sfilecontents.contains("msh"); if (bmsh_start) { // every time msh found want start new record in list lstore.add(sfilecontents); } else { ????? //if not msh append current record in list } } there can number of lines in group, distinguishing 'msh' appear on first line of every new

c - Can you increase text limit of program output? -

im running program,in codeblocks,that associates numbers in arrays , finds mean average. have 25 samples , copy output , put word print it.however, output window cuts off samples 1-11 , shows 12-25. added getch() can copy , paste need, wondering if there way increase output text limit. thanks. code below if helps understand int main() { int x,high=1,low=0; (x=0;x<25;x++) { calcpercent(low,high); high++; low++; getch(); } return 0; } void calcpercent(int low,int high) { int x,y; float valid,mean,total=0; (x = low ;x < high;x++) { ( y = 0; y < 20; y++ ) float percent[500] int sample[25][20] //this top part of function why not write output text file? you're using printf anyway , call fprintf has same syntax (except give file handle first parameter. link has short example on how write file: http://www.cplusplus.com/reference/cstdio/fprintf/

R generate triangle table based on a vector -

i automatically generate following triangle table using vector c(1,3,5,12,24,60,120) determine length/height of sides [1] [2] [3] [4] [5] [6] [...] [120] [1.1] 1 [3.1] 1 [3.2] 1 1 [3.3] 1 1 1 [5.1] 1 [5.2] 1 1 [5.3] 1 1 1 [5.4] 1 1 1 1 [5.5] 1 1 1 1 1 [....] [120.120] 1 1 1 1 1 1 1 vec <- c(1,3,5,12,24,60,120) library(plyr) ## make triangle matrices of each size matrices <- sapply(vec, fun = function(x) { as.data.frame(lower.tri(matrix(rep(na,x^2), ncol = x), diag = true)) }) out <- 1 * rbind.fill(matrices) out[is.na(out)] <- 0 note: done c(1,3,5) provide example ## > out ## v1 v2 v3 v4 v5 ## 1 1 0 0 0 0 ## 2 1 0 0 0 0 ## 3 1 1 0

grails - unit test on delete operation -

this delete operation want unit test and def deleteroutinetable() { def deleteroutinetableid=params.id; def routinetable=routinetable.get(deleteroutinetableid); routinetable.delete() redirect(action: "routinetable") } and test code...but shows error..as def newroutintable=new routinetable(id:1,name: "routine",institution:1,endtime: new date(),starttime: new date()) newroutintable.save(flush:true) newroutintable.list().size()+1 when: controller.deleteroutinetable() then:newroutintable.list().size()-1 } failure: | testdelete(routine.routinetablecontrollerspec) | java.lang.nullpointerexception: cannot invoke method delete() on null object @ routine.routinetablecontroller.deleteroutinetable(routinetablecontroller.groovy:54) @ routine.routinetablecontrollerspec.testdelete(routinetablecontrollerspec.groovy:60)

Anonymous Inner Class in Java not working. Why? -

the class in question this. can see, it's simple. learn workings of anonymous inner classes. in case getting 4 errors saying symbols waterlevel , chlorinelevel cannot found. can see wrong this? public class pool { public waterlevel level() { return new waterlevel() { private string level = "empty"; public string litrestofull() { return "3000"; } }; } public chlorinelevel chlorine(final int amt){ return new chlorinelevel() { private int level = amt; int addchlorine() { level += amt; return level; } }; } } rohit jain said true, anonymous inner classes subclass of waterlevel , chlorinelevel respectively. you've have classes. this lead me realize have define interface each anonymous inner class i'm using. wanted post it's obvious solved.

ruby on rails - active admin, formtastic with nested attributes, undefined method `call' for nil:NilClass -

i trying implement form many many association (with :through) using active_admin. receiving undefined method `call' nil:nilclass error message. i new ruby , rails. my models: article.rb class article < activerecord::base has_many :tagged_articles has_many :tags, :through => :tagged_articles, :source => :tag, :class_name => taggedarticle accepts_nested_attributes_for :tags end tagged_article.rb class taggedarticle < activerecord::base belongs_to :article belongs_to :tag end tag.rb class tag < activerecord::base has_many :tagged_articles has_many :articles, :through => :tagged_articles end view _form.html <%= semantic_form_for @article, :html => {:id => "new_article", :novalidate => "novalidate"} |f| %> app/admin/article.rb (active_admin file) activeadmin.register article form partial: 'form' form |f| f.has_many :tags, headi

yii - User Access Level Error 403 Although Accessed by Admin -

i wanted make user access level, have problem admin (whose id_level = 1) still cannot access specified page. here have ewebuser.php <?php class ewebuser extends cwebuser{ protected $_model; protected function loaduser() { if ( $this->_model === null ) { $this->_model = user::model()->findbypk($this->id); } return $this->_model; } function getlevel() { $user=$this->loaduser(); if($user) return $user->id_level; return 100; } } ?> then here accessrules method in usercontroller.php public function accessrules() { return array( ....... array('allow', // allow admin user perform 'admin' , 'delete' actions 'actions'=>array('index','admin','delete'), //'users'=>array('admin'), 'expression'=>'$user->getlevel()<=1', ), ....... ); } i c

troubled passing data from asynctask to fragment -

i seek receive data asynctask inside fragment. i'm aware achieve activity having difficulties in fragment. getresult class public interface getresult { void getdata(arraylist<string> result); } myfrag class public class myfrag extends fragment implements getresult{ public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view = inflater.inflate(r.layout.myfrag_layout, container, false); button mybtn = (button) view.findviewbyid(r.id.button1); mybtn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { myasync obj = new myasync(); obj.setlistener(getactivity()); } }); } } myasync class public class myasync extends asynctask<void, void, string>{ getresult interfaceobj = null; public void setlistener( getresult interfaceobj ) { this.interfaceobj =

wpf - Animation does not stop on Trigger Exit -

i try change animation when triggers changes - old animation doesnt stop: <tabcontrol> <tabitem header="dummy"></tabitem> <tabitem> <tabitem.header> <path margin="20,0" width="40.3295" height="32.775" stretch="fill" data="m 300 100 l 500 400 100 400 z" fill="gold"> <path.style> <style targettype="path"> <style.triggers> <datatrigger binding="{binding relativesource={relativesource findancestor, ancestortype={x:type tabitem}}, path=isselected}" value="true"> <datatrigger.enteractions> <beginstoryboard> <storyboard storyboard.targetproperty="fill.(solidcolorbrush.c

android - Refresh an imageview in a listview, on click listener -

i have custom listview layout contains imageview , 2 buttons; set primary , rotate image. what expect behave when user clicked set primary, set primary button invisible. rotate button, refresh imageview rotating 0, 90, 180, 270 degrees. all of these processes being done server. so, have request web service , response change state of ui. here listview adapter: @override public view getview(int i, view view, viewgroup viewgroup) { ... itemimagemodel iim = items.get(i); if (iim.getprimary().equals("0")){ vh.btnprimary.setvisibility(view.visible); } else { vh.btnprimary.setvisibility(view.invisible); } vh.btnrotate.setvisibility(view.visible); picasso.with(context) // .load(iim.getimage50()) // .placeholder(r.drawable.placeholder) // .error(r.drawable.error) .into(vh.ivphoto); vh.btnprimary.setonclicklistener(new view.onclicklistener() { @override publi

php - Field Collection no respond -

my drupal field collection having no respond issue after created 3 fields using field collection , try add more. edit page or create new page have same issue. can't add more 3 fields. double checked setting in content type field, set "unlimited" values field. the blue loading icon keep load few minutes , nothing happens. ss: http://imageshack.com/a/img34/3180/hc5u.png the system drupal 7.26 php 5.2.17 (tried max_input_vars in php.ini/.htaccess not working) field collection 7.x-1.0-beta5 there 3 fields in field collection: boolean, 2 long text fields.

java ee - How to connect oracle 10g using android in API 19 -

need how connect oracle 10g using android in api 19. developing in api 19. can't connect oracle database. please give me solution or source code. thanks. it out of box use oracle db directly can of web connections need write web services connect oracle db , use web services in yours program example use given tutorial learn more, can "normal" way access database put restful server in front of , use https protocol connect restful front end. need following purpose 1) webserver 2) database stored in webserver oracle db in yours case 3) webservices (json ,xml...etc) whatever comfortable with 4) http connection android client access web services. for example , tutorials visit http://www.coderzheaven.com/2011/07/27/android-phpmysql-connection-redone/#comment-7736 http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/

html - Can't place iframe directly beneath h1 -

i'm trying create profile site use lot. have figured out, exception of placement of iframe . i'd positioned double-space distance beneath h1 . here h1 positioned such: style="position:absolute;top;75; align=center ... i'd iframe positioned right below it. suggestions? <div> <h1>something</h1> <iframe href="#"></iframe> </div> h1{your-style-here} iframe{ position: relative}

matlab - Propose Fixed-Point Data Types Using an Instrumented Mex Function -

this matlab function: function [mask] = computemask (i, threshold, win_var, borderx, bordery) coder.extrinsic('imfilter'); %-- compute variances of rgb , ir patches mean_i = imfilter(i,ones(win_var)/win_var/win_var,'same','symmetric','conv'); mean2_i = imfilter(i.^2,ones(win_var)/win_var/win_var,'same','symmetric','conv'); std_i= real(sqrt(mean2_i-mean_i.^2)+1e-5); mask= std_i>threshold; % add border of image mask % (filters not complete @ border) mask(1:((bordery-1)/2),:)=0; mask((end-(bordery-1)/2):end,:)=0; mask(:,1:((borderx-1)/2))=0; mask(:,(end-(borderx-1)/2):end)=0; % add area vignetting strong cy=floor(size(mask,1)/2); cx=floor(size(mask,2)/2); [x,y]=meshgrid(1:size(mask,2),1:size(mask,1)); mask(((x-cx).^2+(y-cy).^2)>8e4)=0; %mask(((x-cx).^2+(y-cy).^2)>1.3e4)=0; return when trying build build "instrumented mex function" these errors: ??* ? expected either logical, char, int, fi, single, or doub

single sign on - Joomla and simplesaml -

i have been researching issue while , didn't answer it. have implemented simplesaml open directory (for authentication credentials), moodle , google. right stuck in adding joomla single sign on process. have used: https://github.com/openconextapps/openconextapps-joomla add login menu item authenticate simplesaml page , works after entering credentials in simplesaml login page being redirected joomla login page. using joomla access levels protect resources after login. thanks help. take in saml plugin joomla: https://onelogin.zendesk.com/entries/20066026-configuring-saml-for-joomla this plugin not use simplesamlphp, instead use onelogin php saml toolkit. related problem, session conflict issue. try configure simplesamlphp sp use memcache session storage (so never gonna conflicts joomla session storage). https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance#section_2

change highcharts detetime label -

i have looked @ highcharts api , came across datetimelabel haven't been able set label properly. here code, options var options = { chart: { renderto: 'graph', defaultseriestype: 'line' }, title: { text: 'kwh per phase' }, xaxis: { title: { text: 'time period' }, categories:[], type: 'datetime', datetimelabelformats: { day: '%e %b' } }, yaxis: { title: { text: 'kwh per phase' } }, series: []

getting int variable value from another servlet -

i have question regarding calling int number servlet. lets have 2 servlets. servlet 1 gives me variable number database. im servlet 2 have function can print out variable. how can that? the servlets interact return value database called allay_hours_sum. number, fx 35.5. in servlet 2 have function can call number. have not made servlet 2 yet. this code retrieve number mysql database: string sql = "select *, (day_hours + (day_minutes / 60)) allday_hours workdata "; //where startdate='?' , enddate='?' preparedstatement pst = connection.preparestatement(sql); resultset rs = pst.executequery(sql); float allday_hours_sum = 0; while (rs.next()){ allday_hours_sum += rs.getfloat("allday_hours"); } res.setcontenttype("text/html;charset=utf-8"); res.getwriter().print(a

Merge duplicates and assign value of highest frequency (except neutrals!) in R -

i posted similar question need change conditions. have data.frame full multiple entries. columns "no", "article", , "class" ("p"=positive, "n"=negative, "x"=neutral). looks this: no <- c(3, 3, 5, 5, 5, 24, 24, 35, 35, 41, 41, 41) article <- c("earnings went up.", "earnings went up.", "massive layoff.", "they moved offices.", "mr. x joined company.", "class action filed.", "accident in warehouse.", "blabla one.", "blabla two.", "blabla three.", "blabla four.", "blabla five.") class <- c("p","p","n","x","x","n","n","x","p","p","n","p") mydf <- data.frame(no, article, class) mydf # no article class # 1 3 earnings went up. p # 2 3

android - does the facedook-sdk physically download the user profile image? -

i need file of image of user profile. need upload server. im using facebook-sdk , know facebook passes url , profilepictureview , need file ! thanks i think can download profile image facebook graph api call. https://graph.facebook.com/ " + fbid+ "/picture?width=" + size + "&height=" + size fb id form facebooksdk , make call download image. did.. hope helps.

java - Camel response from bean back onto ActiveMQ queue -

i'm using camel (with camel-ejb dependency) route messages activemq bean's method. far i've got receiving message in requesthandler bean. <amq:connectionfactory id="amqconnectionfactory" brokerurl="tcp://localhost:61616" /> <bean class="org.springframework.jms.connection.cachingconnectionfactory" id="connectionfactory"> <constructor-arg ref="amqconnectionfactory" /> <property name="sessioncachesize" value="100" /> </bean> <bean class="org.springframework.jms.core.jmstemplate" id="jmstemplate"> <constructor-arg ref="connectionfactory" /> </bean> <camel:camelcontext id="camelcontext"> <camel:route> <camel:from uri="activemq:queue:inqueue" /> <camel:setexchangepattern pattern="inout"/> <camel:to uri="bean:requesth

bash - Displaying a script's stdin within Java -

at moment, have java program executes script input.sh external process. script echos line user has entered, added history functionality. here code input.sh : #!/bin/sh ifs="" while read -e line echo $line history -s $line done and here java code program main.java : public class main { static public void main(string[] args) { try { processbuilder pb = new processbuilder().redirectinput(processbuilder.redirect.inherit); process script = pb.command("/bin/sh", "-i","input.sh").start(); bufferedreader br = new bufferedreader(new inputstreamreader(script.getinputstream())); string line = null; system.out.println("starting"); while ((line = br.readline()) != null) { system.out.println(line); } } catch (ioexception e) { } } } now, when execute ./input.sh in terminal, script behaves

javascript - Using Digest Auth in meteorjs -

hello im working on prototype using digest authentication other server in meteor. can body please me how this? have tried , searched threads discussion using nodejs. can please me of meteor code? var options = { host: 'http://some-api-link/', port: 3000, path: '/path', // authentication headers headers: { 'authorization': 'basic ' + new buffer(username + ':' + passw).tostring('base64') } }; //this call request = http.get(options, function(res){ var body = ""; res.on('data', function(data) { body += data; }); res.on('end', function() { console.log(body); }) res.on('error', function(e) { console.log("got error: " + e.message); }); }); why not use http package in console: meteor add http then can do: var result = http.get( "http://some-api-link/path", {auth: 'username:p

php - Why pass variables to a class instead of method -

i wondering benefit of passing parameters class rather method. in terms of code, what's benefit of doing this: $books = new books($book_id, $book_name); instead of $books = new books; $books->setbook($book_id, $book_name); thanks! "passing class" not thing. new foo($bar, $baz) instantiating new object , passing parameters constructor method : class foo { public function __construct($bar, $baz) { ... } } there's no difference such between passing parameters regular method , constructor. difference constructor called when object instantiated, , other methods called anytime later. you should pass parameters constructor object requires @ construction time. typically means pass parameters required object work @ all. constructor can throw exception if doesn't parameters, means object fail instantiate @ all. guarantees object in known, consistent state. compare: $api = new fooapi($id, $password); $api->dosomething()

java - Get request body of my request -

how actual body of request do? invocation = webtarget.path("somepath") .request(mediatype.application_json) .buildput(entity.entity(account, mediatype.application_json)); log.debug(i.... ); // want log request you try wrap outputstream entity. first, using javax.ws.rs.client.clientrequestfilter add custom outputstream clientrequestcontext. client client = clientbuilder.newclient().register(myloggingfilter.class); public class myloggingoutputstreamwrapper extends outputstream{ static final logger logger = logger.getlogger(...); bytearrayoutputstream mybuffer = new ... private outputstream target; public myloggingoutputstreamwrapper(outputstream target){ ... // smarter implement write(byte [], int, int) , call here public void write(byte [] data){ mybuffer.write(data); target.write(data); } ... // other methods delegate target, other write method public void close(){ // not sure, if converting buffer string e

erlang - Reverse a list using recursion -

i'm doing examples book on erlang. here task: write reverse function without using bifs. here's did: reverse([h | t]) -> [reverse(t) | [h]]; reverse([]) -> []. here's function returns: (emacs@localhost)3> examples:reverse([1, 2, 3]). [[[[],3],2],1] i can't understand how can make return flattened list [3, 2, 1] . possible @ all? in syntax [h|t], h element , t list (at least proplist), in code [reverse(t) | [h]] creates list first element result of reverse(t) , , tail single element list [h] . if want achieve function way, should use syntax proposed fenollp. if want write efficient code, should avoid make multiple intermediate copy of partial results, , avoid non tail recursive calls (in order limit size of call stack: reverse(l) -> reverse(l,[]). % use accumulator create tail recursive function reverse([],r) -> r; reverse([h|t],r) -> reverse(t,[h|r]). % [h|r] can evaluated before recursively calling reverse

ios - How do I wait in a flattenMap block for a signal to complete before the next event is consumed? -

here pseudo code : [[[@[ctx1,ctx2]rac_sequence]signalwithscheduler:racscheduler.immediatescheduler] flattenmap:^racstream *(id ctx) { // first flatten map return [racsignal createsignal:^(id <racsubscriber> subscriber) { [executerequestasynch ondone:^{ [subscriber sendnext:ctx]; [subscriber sendcompleted]; } ] }] flattenmap:^racstream *(id ctx) { // second flattenmap }]; } now here want happen upon subscribe: 1) ctx1 should fed first flattenmap block 2) server request "executerequestasynch" should called 3) on completion of serverrequest second flattenmap should called ctx1 4) ctx2 should fed first flattenmap block 5) server request "executerequestasynch" should called 6) on completion of serverrequest second flattenmap should called ctx1 but instead scenario happens: 1) ctx1 gets fed first flattenmap block 2) server request "executerequest

html - Syntax of JavaScript contains <%..%> -

i'm building project on top of existing code written developer. it's javascript project build chrome extension. 1 of html files has code written in following format: <% $.each(this, function(index, value) { %> <% var valpart = value.from_mail.split('<'); %> <% var name = valpart[0]; %> <% var ma_name= name; %> and of html tags on page contain elements like <a class='view_name' title='<%= value.filename %>' href='<%= getviewurl(value.viewurl) %>'><%= value.filename %></a> getviewurl function defined in code. main query code between <%...%> now, have fair idea embedded ruby html files use <% ... %> creating code elements inside html file. know fact ruby isn't being used in project or erb files matter. idea be? looks underscore template: http://underscorejs.org/#template

r - Plotting multiple frequency polygon lines using ggplot2 -

i have dataset records have 2 variables: "time" id's of decades, , "latitude" geographic latitudes. have 7 time periods (numbered 26 32). i want visualize potential shift in latitude through time. need ggplot2 do, plot graph latitude on x-axis , count of records @ latitude on y-axis. need seperate time periods , plot in 1 graph. i understood need function freqpoly ggplot2, , got far: qplot(latitude, data = lat_data, geom = "freqpoly", binwidth = 0.25) this gives me correct graph of data, ignoring time. how can implement time? tried subsetting data, can't figure out if best way.. so i'm trying graph 7 lines showing frequency distribution in each decade in order latitude shift. thanks!! without sample data hard answer try add color=factor(time) (where time name of column time periods). draw lines each time period in different color. qplot(latitude, data = lat_data, geom = "freqpoly", binwidth = 0.25,

php - How to handle Multiple select for file Upload -

i need upload multiple files @ single select button.selected files not overwrite while more 1 time select files using same button.its not <input type="file" multiple> by using can select multiple files @ once, have select multiple files multiple times using same button before submitting form. try this, http://www.w3bees.com/2013/02/multiple-file-upload-with-php.html this simple multi-upload script using php , html

c# - Binding CheckBox.Visibility and CheckBox.IsChecked -

i'm developing windows phone 8 application listbox datatemplate: <phone:phoneapplicationpage.resources> <datatemplate x:key="localizationitemtemplate"> <border borderbrush="black" borderthickness="2" cornerradius="8" background="#ff003847" height="80"> <stackpanel x:name="contentgrid" margin="4" orientation="horizontal"> <checkbox x:name="selectedcheck" visibility="{binding checkboxvisibility}" ischecked="{binding ischecked}" horizontalalignment="left" margin="10,0,0,0" verticalalignment="center" isenabled="false"/> <textblock x:name="locationname" textwrapping="wrap" text="{binding content}" verticalalignment="center" fontsize="24" horizontalalignment="

javascript - SyntaxError: JSON.parse: unexpected character with youtube api search -

i'm using google api search javascript code searching videos in webpage, bit modified. leave codes use searching: search.js /*global gapi*/ // after api loads, call function enable search box. function handleapiloaded() { $('#search-button').attr('disabled', false); } // search specified string. function search() { var q = $('#query').val(); var request = gapi.client.youtube.search.list({ q: q, part: 'snippet' }); request.execute(function(response) { var str = json.stringify(response.result); $('#search-container').html('<pre>' + str + '</pre>'); }); } // search specified string. function searchget() { var q = $('#query').val(); var url = "https://www.googleapis.com/youtube/v3/search?part=snippet&q="+q+"here_my_api_key"; $.get(url, function(response) { var str = json.stringify(response.result);