Posts

Showing posts from September, 2010

c# - Java how to discovery WCF service? -

please visit http://www.codeproject.com/articles/31285/ws-discovery-for-wcf,i have download source code , written wcf service in .net framework 3.5 using related wsdiscovery, , published service web page same configuration in source code. runs correct, wcf client can discovery service too.now problem comes, can java client discovery service ws-discovery or others? lot! first thing google returned java-ws-autodiscovery . there 'axis' framework used java people , think includes of ws* interoperability. should supported can see. never used them read on them.

c# - Removing duplicate entries from arralist -

i have arraylist "templist" after point of time saw lot of duplicate values added arraylist, thought of remove duplicates.when googled found solutions of them confusing.some telling sort arralist , find , remove duplicates telling use distinct, somewhere telling use hashlist. way dont want replace arraylist other structures. can provide me logic prevent duplicates arraylist? the code having public class templist : arraylist { //some logic behind arraylist } templist items = new templist(); if (!(obj testobject) && !(obj leafobject)) { items.add(obj); } if (items.count > 0) { ssendobjectcollection(items); } static public void sendobjectcollection(templist col) { try {

ruby on rails 3 - Order of execution for identical Active Record callbacks -

i have model 5 after_create callbacks. these callbacks executed top bottom? if not, order of execution? i know docs list precedence each callback method, don't order in multiple callbacks of same type executed. yes, callbacks of same type being executed top bottom - can check without digging activerecord code or searching documentation, example way: class city < activerecord::base after_create -> { log(1) } after_create -> { log(2) } after_create -> { log(3) } private def log(s) file.open("/tmp/logger.txt", "a") { |f| f.puts s } end end now if create city , inspect file, output be 1 2 3

java - Safe way to delete pdf files while showing on the screen -

i have method calls method opens saved pdf file screen swingutilities thread mechanism. while opens pdf file given client path, rest of method deals cleaning pdf files folder. my problem if call method numerous times open several pdf files @ same time, best way clean path contains pdf files in terms of memory management. my code snippet looks like: public void filesavefinished(string filepath){ openpdfreport(filepath); //display pdf screen cleanfoldercontent(folderpath, filepath); // cleans folder contents except given filepath} public void opendpdfreport(string filepath){ swingutilities.invokelater(new runnable(){ pdffilelauncher.open(filepath); } } here question related shared resources. read pdf , delete same. must go method pooling , use wait , notify method manage working. wait till file read operation not completed , notify same delete file. more details of wait , notify please tutorials. surely solve problem.

javascript - HTML5 - building an iPad address bar magnifier with map area highlight -

i trying build example highlight multiple image map areas on html page ipad. idea similar magnifier feature notice when tap , hold mobile safari address bar. can pan magnifier around go particular character. trying leverage same user experience highlight image map "poly" areas. when pan magnifying glass, want scroll through areas highlighting them , making them active. i thinking of using jquery maphighlight plugin alongwith css/js magnifier sample http://persistent.info/files/20040508.magnifier/ http://davidlynch.org/projects/maphilight/docs/ the place i'm stuck actual scrolling between areas , highlighting them automatically. i wondering if has done similar i'm trying achieve. cheers! sameer i couldn't quite conceptualise wanting, may in case. use pseudo class :active in css , in tag add in demo i've used css transform simulate zooming, replaced whatever want. think find pure css option faster javascript. http://jsfiddle.net/thu

ruby on rails 3 - How to update datatime attribute? -

i want update last_clicked_on:datetime attribute current time. class feedentriescontroller < applicationcontroller def show @feed_article = feedentry.find(params[:id]) @feed_article.update_attributes(is_to_read: 'false') @feed_article.update_attributes(last_clicked_on: time.now) @way = @feed_article.url redirect_to @way end end but above code not working. please me resolve issue. i guess can try @feed_article.is_to_read = 'false' @feed_article.last_clicked_on = time.now @feed_article.save! anyway it's hard info. issue might in type of columns, can misspell name of column... else... ps each update_attributes issue transaction in db, so, have 2 transactions instead of one... code above have 1 transaction

java - Authentication app engine using google apps domain -

i created new application, set authentication users of specific google apps domain. i've created accounts , added app myexampledomain.mygbiz.com i'm using java eclipse. when upload app gae, no login request. can access... how can request users login before visit app? i think need set login required app.yaml file: handlers: - url: .* login: required for more info: https://developers.google.com/appengine/docs/java/configyaml/appconfig_yaml#requiring_login_or_administrator_status

android - How to return the result returning from asynctask on background -

i running task in ground, , returning result out of it.the result coming null returned before async task completes.how can resolve it public result callserver(string zobjectnamep, string zmethodnamep, string querystringp) { aresultm=new result(); mainaynsctask asynctask = new mainaynsctask(); try { asynctask.execute(zobjectnamep,zmethodnamep,querystringp); } catch(exception ex) { } return aresultm; } the 4 steps when asynchronous task executed, task goes through 4 steps: onpreexecute(), invoked on ui thread before task executed. step used setup task, instance showing progress bar in user interface. doinbackground(params...), invoked on background thread after onpreexecute() finishes executing. step used perform background computation can take long time. parameters of asynchronous task passed step. result of computation must returned step , passed last step. step can use publishprogress(progress...) publish 1 or more units of progress. these values published on

jQuery mouseenter toggle -

Image
i have 3 'tabs' using images follows:- for each tab there 3 images:- bookaccount.png (default - orange) bookaccount-a.png (active - white) bookaccount-h.png (hover - blue) the same bookcash.png , bookguest.png. by default wanting 'guest' stay active tab , other tabs in orange have: <div id="main-online-user"> <a href="javascript:void(0)" onclick="changesrc('main-online-frame','http://www.marandy.com/one2oneob/login-guest.php')"><img alt="one 2 1 guest" id="img-onlinebooking-guest" class="left" src="images/bookguest-a.png" /></a> <a href="javascript:void(0)" onclick="changesrc('main-online-frame','http://www.marandy.com/one2oneob/login.php')"><img alt="one 2 1 account" id="img-onlinebooking-acc" class="left" src="images/bookaccount.png" /></a&g

Cordova Angularjs ask for GPS -

Image
i program app need gps. if gps off, how can ask user turn on gps, google maps? after while of googleing found nothing compareable... other question is, why "use location? - 2", when gps off? thought, if gps off, $window.navigator.geolocation false? controller.js if ($window.navigator && $window.navigator.geolocation) { function success(pos) { $rootscope.position = { x: pos.coords.latitude, y: pos.coords.longitude }; } function fail(error) { alert("use location? - 2"); } $window.navigator.geolocation.getcurrentposition(success, fail, { maximumage: 500000, enablehighaccuracy: true, timeout: 6000 }); } else { alert("use location? - 1"); } there many plugins promess if gps enable. can ask user change location settings. 1 of them diagnostics plugin https://www.npmjs.com/package/cordova.plugins.diagnostic . using it. (al least call location settings).

asp.net mvc 3 - Background Registration MVC3 -

working on mvc4 application users first fill in form starting point. form there field provide user email , unique 9 digit number , other details. want achieve after submitting form want user silently registered using unique 9 digit number username, , auto-generated password hashed , saved password in membership(extended simplemembership) database. email password sent user afterwards. grateful hints or in regards. after form filled, make following redirection return redirecttoaction("autoregister", new routevaluedictionary(new { controller = "account", action = "autoregister", uname= viewbag.uname, uemail = viewbag.uemail })); and have following code in account controller [allowanonymous] public actionresult autoregister() { return view(); } [allowanonymous] [httppost] public actionresult autoregister(registermodel model,string uname, string uemail) { //if (modelstate.isvalid) if(uemail!

statistics bootstrap - Bootstrapping multiple columns with R -

i'm relatively new @ r , i'm trying build function loop through columns in imported table , produce output consists of means , 95% confidence intervals. ideally should possible bootstrap columns different sample sizes, first iteration working. have sort-of works, can't way there. code looks like, sample data , output included: #cdata<-read.csv(file.choose(),header=t)#read data selected file, works, commented out because data provided below #cdata #check imported data #sample data # wall nrpk cisc whsc lkwh ylpr #1 21 8 1 2 2 5 #2 57 9 3 1 0 1 #3 45 6 9 1 2 0 #4 17 10 2 0 3 0 #5 33 2 4 0 0 0 #6 41 4 13 1 0 0 #7 21 4 7 1 0 0 #8 32 7 1 7 6 0 #9 9 7 0 5 1 0 #10 9 4 1 0 0 0 x<-cdata[,c("wall","nrpk","lkwh","ylpr")] #only select relevant species i&

node.js - Why can't Travis CI create a directory during an npm install? -

my recent commit has somehow caused travis ci stop working when tries run npm install . change correcting typo calling javascript file (from foobar/foo-bar.js foo-bar/foo-bar.js ), i'm not sure if commit cause. error receive travis ci follows: bower eacces eacces, mkdir '/public' stack trace: error: eacces, mkdir '/public' @ error (native) console trace: error @ standardrenderer.error (/home/travis/build/myworkplace/mysite/node_modules/bower/lib/renderers/standardrenderer.js:83:37) @ logger.<anonymous> (/home/travis/build/myworkplace/mysite/node_modules/bower/lib/bin/bower.js:110:26) @ logger.emit (events.js:107:17) @ logger.emit (/home/travis/build/myworkplace/mysite/node_modules/bower/lib/node_modules/bower-logger/lib/logger.js:29:39) @ /home/travis/build/myworkplace/mysite/node_modules/bower/lib/commands/index.js:48:20 @ _rejected (/home/travis/build/myworkplace/mysite/node_

iphone - How to erase lines drawn in drawrect ? -

i have uiview boardview in draw lines. when push cell in table view, draw line in boardview. when push first cell ok, lines drawn. now, if push second cell, erase first line , draw second line. i have boolean know if have draw lines or not. in viewcontroller : - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if(self.boardview.drawline) { self.boardview.drawline = no; [self.boardview setneedsdisplay]; //redisplay context without lines } path * path = [self.grid.sommespatharray objectatindex:indexpath.row]; [self.boardview drawpath:path]; self.boardview.drawline = yes; [self.boardview setneedsdisplay]; // display context line } in boardview.m : - (void)drawrect:(cgrect)rect { if (self.drawline) { for(line * line in lines) [self drawlinewithcontext: uigraphicsgetcurrentcontext() andline:line]; //draw lines } } my problem lines aren't deleted.

javascript - Does Firebase limitToLast() take increasing longer as a child's record count grows? -

i have firebase child named lines . lines contains 500k records, each 8 key/value pairs. when app loads, tries grab last 128 records in lines using following: fb = new firebase("https://myapp.firebaseio.com/lines"); fb.limittolast(128).once("value", function(snapshot) { // }); i'm finding app's initial load time getting slower , slower. thing that's changing how many records there under lines . should expect limittolast() take increasingly longer number of records under lines goes up? if so, can try , cull records on time, under impression limittolast() query grab specified. should expect limittolast() take increasing longer number of records under lines goes up? yes. keep reading why is. if so, can try , cull records on time that indeed recommended solution. but under impression limittolast() query grab specified. it send children matching query client. know children send needs consider of them. while li

html - Semantic ui left menu taking too much space -

Image
i trying make dashboard structure using semantic-ui. i have no other css semantic-ui, , don't load javascript (not semantic-ui), since use react manage lifecycle of elements. i trying have : the "about" page occupies orange part of screen, , more (instead of menu taking orange part well). a footer sticks bottom here structure of page (react data removed) : <link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css" rel="stylesheet"/> <div class="app-wrapper" id="app"> <div> <div> <div id="header"> <div class="header page"> <div class="container ui"> <div href="#" class="floated icon menu right text ui">user</div> <div class="menu text ui">

r - Strange numeric behaviour with paste function -

can explain strange decimal behavior reproduced below? , how avoid it? use rounding suppose, don't see should need to. x <- 200.10 y <- 200.96 paste("difference", x - y, sep = ":") # [1] "difference:-0.860000000000014" # not here! 200.10-200.96 # -0.86 there nothing strange going on. precision in both case same printed differently. sprintf("difference: %.2f", x - y) # prints -0.86 in last output options(digits=15); 200.10-200.96 # prints -0.860000000000014 in first output the precision in both case determined type (which double in case). see https://stat.ethz.ch/r-manual/r-devel/library/base/html/double.html , https://stat.ethz.ch/r-manual/r-devel/library/base/html/zmachine.html

postgresql - Reassociate all related models in rails -

ok, f&^%$**&ed up. we lost bunch of user records. @ point, integration file ran re-inserted of lost records. the problem new users have different id original user, existing related content old user id has been orphaned. need go in , reassociate orphaned stuff new user id. won't enough give new user old id backup, because there new content associated new user id. we know reflect_on_all_associations method, hard use finding stuff. however, starting point script of kind. any clues on how have method return models related particular model based on associations, without having specify or know associations? here's way use reflect_all_associations: can iterate through associations, select has_many , has_one, , update records. here's helper class job can execute calling associationfixer.new(user_to_destroy, original_user_id).fix_associations: class associationfixer user_associations = user.reflect_on_all_associations def initialize(user_to_de

GWT Shared Entry Point with iPhone UIWebView -

i have app works fine @ moment , uses geolocation. have method calls com.google.gwt.geolocation.client.geolocation. i extended existing entry point , overriden method use native geolocation library don't have permission popups. how can avoid having 2 modules takes twice long compile? in gwt have entry-point per application, or perl .html page, can have other scenarios: have module file (.gwt.xml) multiple entry-points, or page loading multiple modules (.cache.js), or load same module (.cache.js) in different pages. so, in case, maintain 1 entrypoint , 1 module file , include same compiled module in both pages. in case have write code in entry point know in each page: public void onmoduleload() { if (window.location.getpath().matches(".*page_1.html.*")) { // } else { // thing } } think in case have compiled stuff in both pages, take advantage of gwt code-splitting , make each page load stuff needs: public void onmoduleload() {

python - Apache 2.4 proxy requests to web app not working -

we migrated our web hosting newer server running apache 2.4.6, plesk 12.5, , centos7.2. web app written in python pylons framework. utilizes paster serve web application. have verified paster running on port 28178 on localhost , shows when use top . have been using documentation in setting along comparing old server files application still running fine: using apache proxy requests pylons i have gone domain's vhost_ssl.conf added servername, serveralias, etc. , made sure pointing @ port app running on , app's production.ini specified port. indicates paster server , apache should talking 1 another, when go new server, not serving web app. i should point out, haven't changed on dns have go new server using it's ip address. not sure if interfering it, check out. any suggestions or further information needed? , have restart httpd since made updates conf file. turns out needed add new ip , domain local hosts file overwrite dns pointing domain @ old

javascript - HTML div value not showing -

i have variable when show in alert shows values 1 when assign value div not show value on page. <html> <head> <script src="jquery-1.6.2.min.js"></script> <script > var ad = ['a', 'b', 'c', 'a', 'd', 'e', 'a']; var con=document.getelementbyid('data'); var inds = $.map(ad, function(v, i) { //$("data").html(v); return v == 'b' ? : null; }); //con.innerhtml=inds; alert(inds); // 0,3,6 var avr1=inds; con.innerhtml=avr1; </script> </head> <body> <div id="data"></div> </body> </html> <html> <head> <script src="jquery-1.6.2.min.js"></script> </head> <body> <div id="data"></div&

database - Convert like America/New_York in MySQL server 2008 R2 server -

13:30:00 friday april 19, 2013 in america/new_york converts 09:30:00 friday april 19, 2013 in america/anchorage convert in sql server 2008 r2. using select query. please me on this. thanks, we convert in java wright "america/new_york" america/anchorage way need select query convert est time other time zones..please not time zone cannot given met,gmt , all... please note:- time zones plain text america/anchorage you looking function: convert_tz(dt,from_tz,to_tz) convert_tz() converts datetime value dt time zone given from_tz time zone given to_tz , returns resulting value. time zones specified described in section 10.6, “mysql server time zone support”. function returns null if arguments invalid. https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_convert-tz

javascript - checking query arguments for loopback ACLs to allow `find`ing the user's data only -

i have 2 loopback services running independently in docker containers , talk each other. one handles users , other handles userdata associated user. connected via remote connector on both servers point other server. when current user updates details on server needs update userdata on server b. auth done using jwt tokens, , managed server forward token given server b. the problem having user.data() on server gets passed remote connector , turned query /api/userdata/find?filter[where][userid]=2 on server b, acls on server b not allow queries on find because everyone's data changing clause. is there way create dynamic role lets user filter own data? (ie, can check query params in role resolver somehow?) the way did create role checks arguments in context.remotingcontext.req , verifies current user included in arguments.

unix - How to password protect a shell script -

we need password protect shell script 1)opening 2)editing 3)executing. also know if same can done sudo /root user,i.e root user requires password above said operations . thanks vivek another approach compile shell script executable obfuscates strings. (protection "strings" comnmand) shc shell script compiler, tutorial: http://www.thegeekstuff.com/2012/05/encrypt-bash-shell-script/ i go additionally still kid's idea password well. if compile script becomes human unreadable. means can still have permissions normal users run (now compiled) script. cannot read it.

Function in gcc source code -

can 1 tell me function in gcc source code responsible finding macro in c file , repalce actual value ? i want know function have take log making changes it, @ end log file contain macro used , line number . it's done preprocessor, prior generating output file. if want see doing, try gcc -e from man gcc: -e stop after preprocessing stage; not run compiler proper. output in form of preprocessed source code, sent standard output.

iphone - is there a way to define a variable thats accessible to some classes and not others? -

in objective-c, access variables limited 3 types @public , @private , @protected (default) , @package .. these access modifiers allow access variable through 4 situations in order : 1- access variable anywhere. 2- access variable inside class. 3- access variable anywhere in class , subclasses. 4- access variable anywhere in framework. my question is: there way define variable accessible classes , not others ? (i.e. customised scope variables) what you're asking c++'s friend keyword. friend classes in objective-c discusses topic.

c# - DockPanel Suite DockContent all appearing at top left of DockPanel -

Image
sometimes when program starts fails place dockpanel dockcontent in correct places assigned in configuration file. the config file looks this: <?xml version="1.0" encoding="utf-16"?> <!--dockpanel configuration file. author: weifen luo, rights reserved.--> <!--!!! automatically generated file. not modify !!!--> <dockpanel formatversion="1.0" dockleftportion="0.25" dockrightportion="0.25" docktopportion="0.25" dockbottomportion="0.25" activedocumentpane="-1" activepane="-1"> <contents count="5"> <content id="0" persiststring="imogen3.forms.dockable.frmlogging" autohideportion="0.25" ishidden="false" isfloat="false" /> <content id="1" persiststring="imogen3.forms.dockable.frmtimers" autohideportion="0.25" ishidden="false" isfloat="false"

java - Hazelcast: distributed execution and local member info -

i'm looking way lookup local hazelcast member in task execution. version i'm working 2.5-snapshot. snippet tutorial doesn't seem working: public class echo implements callable<string>, serializable { public string call() { return hazelcast.getcluster().getlocalmember().tostring() + ":" + input; } } calling getcluster() deprecated triggers new member created , connected. at moment managed via hazelcastinstance.getcluster().getlocalmember() not complicate callables kind of injection. could please suggest proper way lookup local member? the callable should implement hazelcastinstanceaware. here example: public class echoexample { public static void main(string[] args) throws executionexception, interruptedexception { config config = new config(); hazelcastinstance instance1 = hazelcast.newhazelcastinstance(config); hazelcastinstance instance2 = hazelcast.newhazelcastinstance(config);

c# - WPF: Additional Red Box around TextBox when ValidationError -

Image
i can't work out why i'm getting additional red border around textbox when validationerror! want border colour around border set in style, there rectangular border around can't figure out how rid off! see image: this textbox style: <style x:key="defaulttextbox" targettype="textbox" xmlns:helpers="clr-namespace:photomanagement.helpers"> <setter property="helpers:watermarktexthelper.ismonitoring" value="true"/> <setter property="helpers:watermarktexthelper.watermarktext" value="{binding relativesource={relativesource self}, path=tag}" /> <setter property="background" value="#ff22252c" /> <setter property="foreground" value="white" /> <setter property="borderbrush" value="#ff22252c" /> <setter property="width" value="200" />

In google cloud windows instance running startup script with administrator privilege -

i trying create google cloud windows instance standard public image windows server 2012. having script needs run @ startup through metadata. script invoked script ran normal user standard privilege created google cloud while instantiating windows image. need run script administrator spent 2 days breaking head solutions elevate user's privilege not helping though tried : have tried elevate privilege of user thats not working. there workaround here . thanks in adv! this solution. create windows task schedule admin privilege want. , execute schtasks /run /i /tn "taskfolder\taskname" in startup script.

php - Get youtube download link url_encoded_fmt_stream_map -

i using preg_match_all youtube video links youtube video page, , put them in array, don't result. preg_match_all('/url_encoded_fmt_stream_map\=(.*)/', $html, $matches); is there problem in syntax of first parameter? thanks don't use ' = ', need use ' : ' instead (if @ souce, see: "url_encoded_fmt_stream_map": ) so can use this: preg_match('/url_encoded_fmt_stream_map(.*?);/', $html, $matches); $matches= substr($matches[0], 30, -1); here delete last ' ; ' , first ' "url_encoded_fmt_stream_map": '.

How can we make exact index as case insensitive in springdata neo4j -

with neo4j core api can create exact index , make case_insensitive below here’s example of how create exact index case-insensitive: index index = graphdb.index().fornodes( "exact-case-insensitive", stringmap( "type", "exact", "to_lower_case", "true" ) ); node node = graphdb.createnode(); index.add( node, "name", "thomas anderson" ); assertcontains( index.query( "name", "\"thomas anderson\"" ), node ); assertcontains( index.query( "name", "\"thomas anderson\"" ), node ); i know fulltext default in springdata neo4j. want make exact index case insensitive in springdata neo4j. but didn't find attribute @indexed() make exact index case_insensitive. please me if mechanism there.. thank you,,

php - Fatal error: Call to a member function result() on a non-object in MVC/MsSql -

Image
i using codeigniter framework , mssql db, have question json script because first time use it. whenever load page table showing "processing..." , when search database, error in image appears. i don't know if stored procedure not executing. dbo.search_gen048,'asc',1,10,1,'3/11/2016' fatal error: call member function result() on non-object in /home/development/public_html/rmt/application/models/navi_model.php i didn't codes involving module, can ask here? controller function search_gen048() { $data['fdate']=$this->input->post('datedata'); $this->load->model('navi_model'); $this->navi_model->get_gen048($_get); } function get_gen048(){ $this->load->model('navi_model'); $this->navi_model->srch_gen048($_get); } model function srch_gen048($data){ $secho = intval($data["secho"]); $idisplaystart = intval($data["idisplaystart"]); /

r - Intentional Infeasible Linear Program in Rsymphony -

i using rsymphony package in r mixed integer program. able iteratively relax 1 of constraints until problem becomes feasible. so, i'd able to: send milp's constraint matrix, objective function, etc. symphony solver via rsymphony_solve_lp if rsymphony_solve_lp returns feasible solution (or states there is feasible solution) terminate solve, rebuild constraint matrix tighter constraint, re-send solver via rsymphony_solve_lp if rsymphony_solve_lp says problem infeasible, backtrack last feasible constraint matrix , solve there. any tips/tricks on how without manually watching solver verbosity on? a poster on different board gave approach. reformulated milp constraint want iterate, multiplied 'tuning parameter' continuous decision variable. put penalty term associated decision variable objective function relax constraint little possible. effect should constraint relaxed enough feasible, not beyond that.

jsf - How to render a p:panel, triggered from the choice of a p:selectonemenu? -

i using primefaces 3.4 , jsf 2.1 , trying have p:panel item appear , dissapear regarding choices of p:oneselectmenu . have p:datatable inside panel want appear , populated dynamically , why using panel. datatable thing works panel no. tried linking "rendered" option on panel variable changes change of every selection of menu nothing happened. tried p:outputpanel nothing happened. tried using button same actions again failed. code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"> <h:body> <ui:composition template="/template.xhtml"> <ui:define name="title"> #{msg.teaching}: #{msg.socialsecurity} </ui:define> <ui:define name="body"> <h:form id=&

jquery - retrieving video from database using php -

i trying figure out how retrieve video_link database after users select video using html form. 2 videos uploaded database, original video , compressed video, depending on user connection. appropriate video embed in html 5 video tag in viewvideo.php because ajax expecting response in $( "#speed" ).val( html ); dun think can embed video in viewvideo.php so question should now? should retrieve video_link , embed video? this coding now. i have html form retrieve user connection speed , video_id user wish watch , using ajax post form data html form <form action="viewvideo.php" method="post" > <br/> please select video <br/> <select name="video_id"> <?php while($row = mysqli_fetch_array($result)) { ?>

multiple instances of python in separated windows -

i'm using pyuserinput , want run multiple python scripts in separate windows possible make script run inside of window while still allowing me other things mouse , keyboard simultaneously? i'm using latest version of ubuntu , python 2.7.3 how can attach python code window? if access website, yes. sites disable ability enter data text fields, such login, careful that. research on python's urllib2 module. here's example: python urllib simple login script also, when comes working scripts handle these processes, isn't typically "pushing buttons", that's when dealing gui's. rather working gui's themselves, want work underlying processes serve.

c - sqrt() function link error -

the following code throwing undefined symbol error on linux. $ cat rms.c /* sqrt example */ #include <stdio.h> #include <math.h> int main () { double param, result; param = 1024.0; result = sqrt (param); printf ("sqrt(%lf) = %lf\n", param, result ); return 0; } $ gcc rms.c /tmp/ccawecfp.o(.text+0x24): in function `main': : undefined reference `sqrt' collect2: ld returned 1 exit status if replace argument sqrt() (double)16 program compiling , executing. why throwing error in first case. this linker error. the linker missing implementation of sqrt() . resides in library libm . tell gcc add applying option -lm .

ruby on rails - Why does the JSON returned from my Sinatra App give a syntax error? -

i'm developing sinatra app, returns json, e.g. '/clients' # stuff response = { "success" => "true", "msg" => "clients retrieved", "data" => {"clients" => @current_user.clients} } return response.to_json end the returned json looks this: {"success":"true","msg":"clients retrieved","data":{"clients":[{"client":{"created_at":"2013-03-31t22:50:18z","email":"test@test.com","first_name":"marge","gender":"f","hairdresser_id":2,"id":1,"surname":"simpson","updated_at":"2013-03-31t22:50:18z"}}]}} when copy , paste json parser, works fine. http://json.parser.online.fr/ but when fire irb , try use it, bunch of errors: 1.9.3-p286 :001 > = {"

java - Same initial context for multiple wars in tomcat -

i have 3 separate wars in tomcat , each war contains restful services, there different clients in wars calling services example servlet maping in war1 is <servlet-mapping> <servlet-name>servlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> access url localhost:8080/projectname/services/someservice similarly in war2 <servlet-mapping> <servlet-name>servlet2</servlet-name> <url-pattern>/postprocessorservices/*</url-pattern> </servlet-mapping> access url localhost:8080/differentprojectname/postprocessorservices/someotherservice i want know there way provide common initial context same initial context used in different client example localhost:8080/commoncontext/services/someservice localhost:8080/commoncontext/postprocessorservices/someotherservice any appreciated.

How to get resource as byte array in c#? -

Image
i added image c# project project settings -> resources how can image @ runtime? trying this: public byte[] getresource(string resourcename) { system.reflection.assembly asm = assembly.getentryassembly(); // list resources in assembly - test string[] names = asm.getmanifestresourcenames(); //even here testimg.png not presented system.io.stream stream = asm.getmanifestresourcestream(resourcename); //this return null of course byte[] data = new byte[stream.length]; stream.read(data, 0, (int)stream.length); return data; } i call function way: byte[] data = getresource("testimg.png"); but see image in resources folder in project explorer. could tell what's wrong there? you need set file testimg.png "embedded resource." resource name resources/testimg.png .

java - Can I reference a file from within a Spring Boot project? -

Image
i writing spring boot program should populate xlsx template data , trying read template inside project. directory structure follows: i trying access file using following code: try { inputstream fis = this.getclass().getresourceasstream("xlstemplates/billingreview.xlsx"); xssfworkbook billingreviewtemplate = new xssfworkbook(fis); } catch (filenotfoundexception e) { e.printstacktrace(); } unfortunately have yet find way read xlsx file inputstream. comes null. have pointers on how can reference file included in project?

Retrieving cookies in Python using urllib2 -

i trying retrieve cookie page running on localhost own python script, having trouble understanding urllib2 documentation. tried looking around examples of retrieving cookies , couldn't find answer. along lines of: url = "http://localhost:8080" request = urllib2.request(url) sock=urllib2.urlopen(request) after don't know how fetch cookies, , don't understand code does. also, there way use urllib2 send cookie back? thanks!

c# - Converting date to DOS date -

i having trouble dos date formats. need convert: from: 29th june of 2011 to: 16093 i know 16093 correct result, how can result? i can convert dos date integer value recognized datetime don't know how reverse process. how conversion dos date datetime : var number = 16093; var year = (number >> 9) + 1980; var month = (number & 0x01e0) >> 5; var day = number & 0x1f; var date = new datetime((int)year, (int)month, (int)day); this works. need reverse it. let me teach how fish, , in process fix problem. what have? a datetime .net object represents date/time combination. datetime datetime = new datetime(2011, 6, 29); what want? a dos date/time according specification, 16-bit date component. time component ignored. what need? the day of month, month number, , year since 1980. let's them unsigned integers , ensure in proper range. uint day = (uint)datetime.day; // between 1 , 31 uint month = (uin