Posts

Showing posts from February, 2015

javascript - Inexplicable MVC model data alteration -

i have model object contains list of objects have 3 numeric fields , 1 string field, similar following: public class datamodel { public list<dataitemmodel> dataitems { get; set; } } public class datamodel { public string comment { get; set; } public decimal value { get; set; } public int id { get; set; } public int integervalue { get; set; } } the view has table allows user set each item's value , comment fields ( id generated data layer , integervalue derived value ). user can add , delete items collection via ajax, using jquery post() method, webpage being partially updated using html() . the issue i'm seeing if have list of comment/value pairs so: item 1, 1.00 item 2, 2.00 item 3, 3.00 item 4, 4.00 item 5, 5.00 and delete third item via webpage, controller correctly changes data to: item 1, 1.00 item 2, 2.00 item 4, 4.00 item 5, 5.00 and returns new html using partialview() . when webpage updated, model somehow transformed be

scrapy - Scraping large amount of heterogenous data into structured datasets -

i have been evaluating science of web scraping. framework use python/scrapy. sure there may many more. question more around basics. suppose have scrape news content. so, crawl page , write selectors extract content, images, author, published date, sub description, comments etc. writing code no big deal. the question how can optimize scalable large number of data sources. instance, there may thousands of news sites, each own html/page structure, inevitably need write scraping logic each 1 of them. although possible, require big team of resources working large duration of time create , update these crawlers/scrapers. is there easy way this? can somehow ease process of creating different scraper each , every data source (website)? how sites recordedfuture it? have big team working round clock claim extract data 250000+ distinct sources? looking forward enlightening answers. thanks abhi

jquery - Mod_rewrite causes AJAX requests using a relative URL to fail -

even though i'm aware there have been posts similar questions before, i'd present issue i've been struggling many hours , can't seem resolve. on website has urls rewritten mod rewrite module: www.domain.com/index.php?page=one becomes www.domain.com/one/ i'm making ajax request using jquery , relative url >>>> $.get('views/ajax_page.php', { }, function(data) { alert(data); }); obviously no problem long url in browser's address bar www.domain.com, when variable 'page' not null, script fails find file ajax_page.php , throws ajax error "404 not found". i know around using absolute url in ajax request, since same-origin policy causes browser throw http error 0 when visitor omits protocol when typing website's address in address bar, not watertight too. what best way tackle either 1 of aforementioned problems or, better, both? many support. is folder views @ root of site? if so, add slash

indexing - Calculate Scrabble word scores for double letters and double words MATLAB -

my goal here create code takes letters in string , gives out score in scrabble. has account double words scores (dictated !) , double letter score (dictated #). example: if input 'hel#lo!', first 'l' played on double letter score space, , final 'o' played on double word score space. output score 18. thanks rayryeng got read off score value if there no double words or double letters, can't seem figure out those. if have guidance in how go it, appreciate it. doubleword = '#'; %// here labeled things doubleletter = '!'; doublew = strfind(word, doubleword-1); %// want find double words doublewb = 2; trouble = strfind(word, doubleletter-1); %// want find double letters troubleb = letterpoints*2; convert = word; stringtoconvert = lower(convert); ascii = double(stringtoconvert) - 96; origscore = (sum(values(ascii))); score = doublewb*(sum(origscore)+troubleb); the last line gives me trouble. array , nice clean number. further

c# - ViewBag.Title not working in my code ASP.NET MVC 4 -

i new visual studio , having difficulty making viewbag.title function correctly. here code viewbag.title not working , gettin printed on screen in incorrect position , full string "viewbag.title = "home page";" @model ienumerable<employees.models.employee> @{webgrid grid = new webgrid(model);} { viewbag.title = "home page"; } @section featured { <section class="featured"> <div class="content-wrapper"> <hgroup class="title"> <h1>@viewbag.title.</h1> <h2>@viewbag.message</h2> </hgroup> @grid.gethtml(columns: new[] { .... .... i'm pretty sure need prefix code block assign viewbag.title @ @{ viewbag.title = "home page"; } this rendering straight html

ios - swift documentation for an override func -

there great here how document func in swift using /// but how override func? when option-click original documentation of animationdidstop (declared in caanimation). here code. (taken viewcontroller.swift uiviewcontroller declared delegate animation created in function) /// called when dripstreamstart() finishes /// in order continue animation /// override func animationdidstop(anim: caanimation!, finished flag: bool) { dripstreamsoscillate() } thanks help.

architecture - Hosting Audio Files -

i'm considering building website helps musicians collaborate remotely. this, need share large (uncompressed) audio files. for solution i'm considering, i'd able perform following functions: upload/download uncompressed audio files stream uploaded audio my concern large bandwidth demand. should perform these actions on own (hosted) server space, or there service apis can use? i've checked out amazon's s3 allows me host files, can't find suggests can stream services. i'm not sure s3 right i'm trying achieve. can provide high-level architectural advice? thanks in advance. what paul mentioned in comments true... s3 not designed cdn. however, if audio files aren't intended used on thousand people @ time, don't need cdn. can put them on s3 , stream directly there (over http) without difficulty. sounds you're going have bunch of tracks accessed handful of people. s3 fine this. when comes publishing finished work m

linux - Bash shell commanding to vpn connection from command line -

i trying write bash shell (very first time) can auto connect vpn server. have never written bash script before. can tell me command syntax need this? #!/bin/bash echo "hi connect vpn labs? yes or no" sleep 2 read answer $connect = "rdesktop -u offsec -p ******** 192.168.***.***" if $ answer != "no" $connect else exit for right command connect vpn, read following. https://askubuntu.com/questions/57339/connect-disconnect-from-vpn-from-the-command-line . first, run in terminal , see if works. rdesktop -u offsec -p ******** 192.168.***.***" then want watch syntax bash script. #!/usr/bin/env bash read -e -p "hi connect vpn labs? yes or no " answer sleep 2 if [ $answer != "no" ]; rdesktop -u offsec -p ******** 192.168.***.*** else exit fi

Concise way to destroy user's session in Rails -

ok, there appears few approaches 'destroying' user's session , there may subtleties between them , how app handles user sessions. first, why examples don't use session.delete(:current_user_id) delete :current_user_id value (and hash key!)? typical example looks below (i added deleting :return_to since if signing out, why there need track return_to value). def sign_out self.current_user = nil session[:current_user_id] = nil session.delete(:return_to) end if app needs delete session variables , values, isn't safer use session = nil or session.destroy ? destroy hash entirely. make sense keep current_user_id in session hash if app supports... tracking of anonymous users ?!?! thoughts? by setting session nil you're losing information session (that may included except current_user or used rails) + putting risk of using hash method (like #[]) on nil raise exception won't expect it.

java - Launching Minecraft via Python subprocess doesn't work -

today i've tried start minecraft client via command line on windows 7. works! code: java -xmx1024m -djava.library.path="%appdata%\.minecraft\versions\1.7.10\1.7.10-natives" -cp "%appdata%\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;%appdata%\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;%appdata%\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;%appdata%\.minecraft\libraries\com\mojang\authlib\1.3\authlib-1.3.jar;%appdata%\.minecraft\libraries\io\netty\netty-all\4.0.10.final\netty-all-4.0.10.final.jar;%appdata%\.minecraft\libraries\java3d\vecmath\1.3.1\vecmath-1.3.1.jar;%appdata%\.minecraft\libraries\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;%appdata%\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;%appdata%\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;%appdata%\.minecr

python - How to get circles into correct subplot in matplotlib? -

i trying recreate https://www.youtube.com/watch?v=lznjc4lo7le i able plot circles want in matplotlib , want have 2 subplots next each other circles in left subplot. guess don't understand ax1 , ax2 variables, because lines wind in left subplot, , circles in right subplot. i need them both in left subplot can put sinusoids in right subplot. think mistake simple trying ax1.circle crashes because circle callable plt . ideas? here code: def harmonics( branches, colors, t, dotsize=2, blur=true, circles=true,save=false, newdir=false, prefix='',path='',note=''): txt='' ds=[] f, (ax1, ax2) = plt.subplots(1, 2, sharey=true) # ax1.plot(x, y) # ax1.set_title('sharing y axis') # ax2.scatter(x, y) ct2, b in enumerate(branches): d,p,l,k,n = b[0],b[1],b[2],b[3],b[4] ds.append(sum([np.absolute(val) val in d])) col = colors[ct2] = ramify(b,t) r = [0+0j] coll=np.array([]

ios8 - How to integrate splash screen for all types of iPhones in XCode 6.1? -

Image
i need create , app run on iphone 4s, 5,5s, 6, 6+ , depoloyment target ios 7.1. saw apple introduced lauchscreens.xib creating launch screen (splash screen) , there image assets in can provide launch images screens. see image below: so questions how can use splash screen iphones? or should say, standard way to when using xcode 6? i have been looking answers , reading blogs , apple's documents didn't find anything. singing own song not answer. in xcode6 devices splash screen need make splash image each device size retina , non retina. best way of done thng use asset catalog target-->general following screenshot: when tap right small arrow near of launchimage (->) can see following window: currently there empty because right side there no target selected if deployment target 6.0 need set check mark following screenshot can see image need box : see when add wrong dimension image in catalog can warning @ top right corner , when tap on warning

c++ - OpenGL 3.3 Projection Matrix Error -

i trying tutorial on opengl 3.3 presented : http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/ it says projection matrix can created glm : glm::mat4 projection = glm::perspective(45.0, 4.0/3.0, .1, 100.0 ); however, try compile code, it, following error: error: conversion ‘glm::detail::tmat4x4<double>’ non-scalar type ‘glm::core::type::mat4 {aka glm::detail::tmat4x4<float>}’ requested make: *** [src/main.o] error 1 what wrong? you passing double try passing float arguments instead. glm::mat4 projection = glm::perspective(45.0f, 4.0f/3.0f, .1f, 100.0f );

asp.net mvc - Getting null value instead of Id from View to Edit action method -

getting 'null' list view edit/details/delete action method instead of id. in list view, in id column shows corresponding id without issues. in all.cshtml file, <td> @html.displayfor(modelitem => item.modifiedon) </td> <td> @html.actionlink("edit", "edit", new { id = item.categoryid }) | @html.actionlink("details", "details", new { id = item.categoryid }) | @html.actionlink("delete", "delete", new { id = item.categoryid }) </td> and edit method is, public actionresult edit(int? id) { if (id == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); return view(); } var editcategory = new petapoco.database("defaultconnection"); var category = editcategory.single<categoryviewmodels>("select * category categoryid=@0 , isactive = 1", id); return view(category); } the url in browser is, /cate

blackberry java media file is distorted when download is resumed -

i'm developing blackberry app , having issue while resuming download. code works if download isn't interrupted, if interrupted , download re-started, media file distorted. to allow resuming of download, request file in chunks server , persist last downloaded/written chunk. if i'm restart download, check last downloaded , written chunk, increment , use determine range request server. code listed below..: public final class downloader extends thread { private string remotename; private string localname; private string parentdir; private string dirname; public string filename; private int chunksize = 512000; public boolean completed = false; public boolean failed = false; public cacheobject cacheobject = null public downloader(string remotename, string localname, string musictitle, string parentdir, string dirname) { this.remotename = remotename; this.parentdir = parentdir; this.dirname = dirname; this.localname = local

printing - Common input method to support different Brand's Bluetooth Printers in Android -

i doing r&d on supporting different company's bluetooth printers. able make connection printers paired android device via bluetooth , able print text also. but input string format varying 1 printer another. printers not behaving same, yes wont. currently have separate api each printers, there way same thing in single api? if not suppose achieve single api, please suggest way approach this. i using bluetoothadapter paired devices , using bluetoothsocket make connection. as of now, using bixolon , zebra , intermec printers please let me know if need of further information.

visual studio 2010 - How to retrieve large amount of image from resources and randomly assign to different Picturebox? -

i need retrieve 25 images resources , put them 25 picturebox randomly without repetition happening. process should done automatically when page loaded beginning. had named picture 1-25 , suppose process. do have way complete process. sorry poor language expression. please me, thanks. one way (could not best in performance): need generate random numbers , store in list. if generated number present in list, one... @ end... have numbers this 1 better: dim rand new random() dim new_list new list(of image) while pictures.count > 0 ' move random image new list. dim integer = rand.next(0, pictures.count) new_list.add(pictures(i)) pictures.removeat(i) loop "pictures" collection of images. code taken here: http://www.vb-helper.com/howto_net_random_picture_forms.html

java - Morphia can't insert class into DB -

i want strore object mongodb morphia. but got bunch of exceptions: exception in thread "main" java.lang.illegalargumentexception: can't serialize class com.aerlingus.ta.models.b2b.faresearch.airsearchprefstype$cabinpref @ org.bson.basicbsonencoder._putobjectfield(basicbsonencoder.java:270) here save() : public void create(model model) { object keyvalue = get(model); if(datastore.find(this.model).field(keyfield.id()).equal(keyvalue).get() == null){ datastore.save(model); } else { throw new runtimeexception(string.format("duplicate parameters '%s' : '%s'", keyfield.id(), keyvalue)); } } here airsearchprefstype class : @embedded @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "") public static class cabinpref { @embedded @compare @xmlattribute(name = "preferlevel") protected preferleveltype preferlevel; @embedded @compare @xmlattribute(name = "ca

download - python FTP error when dowloading all files in a list -

does know why python not downloading files in list below? first file downloads , 'error2' second file. fdnload1 = ['aaa092214.txt', '092214 report totals.txt'] try: # download files fdn in fdnload1: ftrans1 = open(fdn,'wb') ftp.retrbinary('retr ' + fdn, ftrans1.write) print 'downloading...' + fdn except: print 'error2' results: downloading...aaa092214.txt error2 when run program without downloading files, iterates through files: try: # download files fdn in fdnload1: print 'downloading...' + fdn except: print 'error2' results: downloading...aaa092214.txt downloading...092214 report totals.txt [finished in 0.3s] e d t # 1: able files in fdnload1 download creating separate function download files, still getting errors, , coming actual download process (see results printing 'error in download1() function'. know why? also, checked f

c# - WaitForControlEnabled() throws UITestControlNotFoundException -

i'm waiting control enabled this: control.waitforcontrolenabled(60000); // timeout in 60 seconds however, ten seconds in method throw uitestcontrolnotfoundexception : test method mytest threw exception: automation playback engine not able find button &next > in - window &next >. additional details: technologyname: 'msaa' name: 'next >' controltype: 'button' microsoft.visualstudio.testtools.uitest.extension.uitestcontrolnotfoundexception @ microsoft.visualstudio.testtools.uitesting.playback.mapcontrolnotfoundexception(comexception ex, iplaybackcontext context) @ microsoft.visualstudio.testtools.uitesting.playback.mapandthrowcomexception(comexception innerexception, iplaybackcontext context) @ microsoft.visualstudio.testtools.uitesting.playback.mapandthrowexception(exception exception, iplaybackcontext context) @ microsoft.visualstudio.testtools.uitesting.playback.mapandthrowexception(exception exception, string query

javascript - Proportionately increasing columns width -

let's have number of columns of different width e.g.: | 100 | 200 | 55 | 450 | empty space and need adjust width of every column way entire row fits in container, , takes 100%. i of course set .row { max-width: 100% } , set widest column 100%, want make way every column takes available space proportionally. ideas? you can use both display: table , display: table-cell . as example: * { box-sizing: border-box; } html, body { width: 100%; } div { width: 100%; min-width: 100; display: table; } div > div { min-width: auto; width: auto; display: table-cell; border-right: 1px solid #000; text-align: center; } div > div:first-of-type { border-left: 1px solid #000; } <div> <div>abcde</div> <div>fg</div> <div>hijklm</div> <div>n</div> <div>opq</div> <

ios - Strip out html tags from a string -

i'm trying remove html tags string can output clean text. [actually works] let str = string.stringbyreplacingoccurrencesofstring("<[^>]+>", withstring: "", options: .regularexpressionsearch, range: nil) print(str) edit: swift 3 let str = string.replacingoccurrences(of: "<[^>]+>", with: "", options: .regularexpression, range: nil) print(str) hmm, tried function , worked on small example: var string = "<!doctype html> <html> <body> <h1>my first heading</h1> <p>my first paragraph.</p> </body> </html>" let str = string.stringbyreplacingoccurrencesofstring("<[^>]+>", withstring: "", options: .regularexpressionsearch, range: nil) print(str) //output " first heading first paragraph. " can give example of problem?

perl - How to print result with maximum value under each header? -

i have data , perl code following. trying find letter combination maximum score (last column) under each header (>dna1, >dna2) , print it. wrote code in perl following: use strict; use warnings; ($line); $max = 0; @prediction; foreach $line (<data>) { chomp($line); if ($line =~ /^>/) { print "$line"; } else { @split = split(/\s+/,$line); $score = pop @split; if ($max < $score) { $max = $score; @prediction = @split; push @prediction, $max; } #print "$domain\n"; } print "@prediction\n"; } __data__ >dna1 d 124.6 d t 137.5 g -3.4 g t 9.5 t 12.9 >dna2 196.3 k 186.5 k h 192.7 h m 206.2 m 200 the output >dna1 d 124.6 d t 137.5 d t 137.5 d t 137.5 d t 137.5 >dna2d t 137.5 196.3 196.3 196.3 h m 206.2 h m 206.2 could please me figure out how can output final combination max score following: >dna1 d

ios - Change title of Photo editing extension -

is possible change title of photo editing extension? currently takes name of main app, want tweak slightly. is possible? doesn't appear possible, though the documentation doesn't explicitly state so. 2 points in conflict each other, might provide insight. the displayed name of app extension provided extension target’s cfbundledisplayname value, can edit in extension’s info.plist file. if don’t provide value cfbundledisplayname key, extension uses name of containing app, appears in cfbundlename value. this not case photo extensions — try yourself. changing either (or both) of these values in extension's info.plist not change name of extension. extension retains name of containing application. there's this: embed no more 1 photo editing extension each media type (photo, video) in containing app. photos app displays user, @ most, 1 extension of each type given containing app. while not explicit, may indicate why aren't able change

sql - Getting result from db using WHERE ALL -

him need writing sql sql query. example have 2 tables. students , marks. first table consist of student_id ,name,address, phone .... second table include such columns : mark_id,student_id, subject_id , mark_value , date so need information students have marks of 1 type (for instance or c). example student stuart has got 5 marks , of them need information student. i must use or statement. please explain how this. in advance. assuming mysql. select * student s <grade > = ( select mark_value marks m m.student_id = s.student_id )

r - How can the page size in shiny be adjusted to accommodate more number of plots? -

i have multiple tabs multiple graphs in of tabs. graphs implemented small in size, information in graph difficult analyze. i guess shiny automatically resize graphs in order adjust page size. how fix this? using fluidpage. thanks you can set image size plotoutput() or imageoutput() functions in ui.r file. has 2 arguments, height , width can set determine image size. can set size in terms of pixels or percentage, e.g. height = "50%", width = "100px" edit in response comments had imageoutput rather plotouput , have corrected that. plot can sent ui using either renderimage or rednerplot renderplot has height , width arguments. if there 3 different plots, consider making them 3 different plots , own renderplot , plotoutput . may give more flexibility. regardless height , width arguments increase size of plot.

html - Checkbox not firing -

here code: http://jsfiddle.net/raficsaza/mgukxouj/ the problem cannot use checkbox, it's stuck on false value , not moving @ all. can go through "input" tag, because cannot remove it... <div class="toggler"> <input class="toggler-checkbox" data-val="true" data-val-required="the isok field required." id="isok" name="isok" type="checkbox" value="true" /><input name="isok" type="hidden" value="false" /> <label class="toggler-label" for="mytoggler"> <span class="toggler-inner"></span> <span class="toggler-switch"></span> </label> </div> the adjacent sibling selector isn't working because have hidden input after checkbox , before label. change html move before so: <input name="isok

javascript - Spreadsheet Script Validation: The data validation rule argument "=Employees!B1:B1000" is invalid -

i'm trying validate employees based on spreadsheet following code: function validation() { var globals = spreadsheetapp.openbyurl('https://docs.google.com/myurl'); var globalsheet = globals.getsheetbyname('employees'); var validate = spreadsheetapp.newdatavalidation(); var cell = spreadsheetapp.getactive().getrange('a1:a'); var range = globalsheet.getrange('b1:b'); var rule = spreadsheetapp.newdatavalidation().requirevalueinrange(range).build() cell.setdatavalidation(rule); } the error message receive data validation rule argument "=employees!b1:b1000" invalid. idea issue might be? in advance help. apps script , google sheets don't allow use data other spreadsheets define data validations. error getting result of apps script looking in current spreadsheet 'employees' sheet , not finding it. instead of attempting use data in other spreadsheet directly, can have apps script function copy data cu

Routing Apache to JBoss production Server -

we have jboss production on our java application running. have configured apache server(dmz) route traffic jboss production server , increase security. have used apache's mod_jk module routing production , apache version 2.2. working fine few months time having error: bad gateway proxy server received invalid response upstream server. my worker.property on apache is: worker.list=ws worker.ws.port=8009 worker.ws.host=192.168.56.102 worker.ws.type=ajp13 my httpd.conf file has following virtual host worker: <virtualhost *:443> errorlog "logs/dmz-error.log" customlog "logs/dmz-access.log" common jkmount /ws/ ws jkmount /* ws jklogfile logs/mod_jk_prod.log jkloglevel error jklogstampformat "[%a %b %d %h:%m:%s %y]" jkoptions +forwardkeysize +forwarduricompatunparsed -forwarddirectories jkrequestlogformat "%w %v %t" rewriteengine on rewritecond %{request_method} ^(trace|track) rew

XML Document traversal in java -

which preferable xml document traversal method in java ? using getelementsbytagname or using treewalker . i've 1 treemodel . dom node root of treemodel . there 2 thread s adding nodes it. 1 thread adding nodes according nodes added other thread . e.g. one thread adding node s named app . other thread adding nodes according name attribute of node s named app . nodes not added correctly. treemodel shows details in elements traversing through nodes. note: adding app node according name attribute of node . currently second thread , node s taken calling getelementsbytagname . there advantage changing treewalker ? i xpath. w3schools link here , javadocs here . tedious started factories , builders, imo write own utility class save on tedium. syntax traverse around expressive , powerful, , "standard" documentation. if brave, check out beta groovy-like xpath-like project , not propose "the preferable". :-) added : xpath query l

cassandra - How to read SSTables -

i newbie cassandra , want read sstables generated incremental backups ways read sstables.tried open source tool hadoop-sstable mention in link support cassandra-1 , not cassandra 2.0.what different way read cassandra sstable.

knockout.js - How to access outer function observable in inner function in viewmodel? -

i having main function , sub function inside that, this: var main= function () { var self = this; self.value1 = ko.observable(""); var data = self.value1(); self.revaluate = ko.computed(function(){ data = self.self.value1(); // overwriting }); function inner(i1,i2) { var self= ; self.id1=ko.observable(i1); self.id2=ko.observable(i2); self.value2 = ko.observable(""); self.visibility = ko.computed(function() { if (data == 1) {return true;} else {false;} }); } } ko.applybindings(new main()); i need value1 value inside inner function should dynamic. i tried storing in variable , accessing it, it's not gonna solve case there scenario self.visibility won't fire @ , update dynamically. onload updated value1 work, have button "goto next stage", , onclick of button updating status, i.e self.value1(2) . @ point self.visib

java - Dereferencing possible? -

consider following code: public class test { static private volatile integer number1 = 42; static private volatile integer number2 = 42; public static void main(string[] args) { test test = new test(); test.changeinteger(number1); system.out.println(number1); } public void changeinteger (integer number) { number = new integer(3); } } i change value of either number1 or number2 depending on argument pass method changeinteger . doesn't work. there way make work in java without using reflection? to clarify: want call changeinteger(number1) change field number1 . just add @margus's answer. in books, if variable name ever contains number, number1 , that's sign aren't doing right. use array. on other hand, if variables named , may better of using hashtable . names of fields in class meant hard-coded. if ever need non-hard-coded "field names", aren't fields. data! hashtable / di

java - How to check a radio button with Selenium WebDriver? -

i want check radio button, didn't know how. html is: <div class="appendcontent"> <div> id="contentcontainer" class="grid_list_template"> <div id="routemonitoroptions"></div> </div> <input id="optionstopgrid" type="radio" name="gridselector"/> <label for="optionstopgrid">paradas</label> </div> import java.util.list; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.firefox.firefoxdriver; public class answer { public static void main(string[] args) throws interruptedexception { webdriver driver = new firefoxdriver(); driver.get("http://www.example.com/"); //if u want know number of radio buttons use list list<webelement>radiobutton = driver.findelements(by.tagname(&q

Avoid buffering when parsing stdout with Perl -

i want parse output of external program (some shell command) line line using perl. command runs continuously, put thread , use shared variables communicate main routine. up code looks similar to #!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; $var :shared; $var=""; threads->create( sub { # command writes stdout each ~100ms $cmd = "<long running command> |"; open(readme, $cmd) or die "can't run program: $!\n"; while(<readme>) { $line = $_; # extract information line $var = <some value>; print "debug\n"; } close(readme); } ); while(1) { # evaluate variable each ~second print "$var\n"; sleep 1; } for commands works fine , lines processed come in. output similar to: ... debug debug ... <value 1> ... debug debug ... <value 2> ... however, other c

How to measure total memory usage of all processes of a user in Python -

i use these commands see memory usage on servers: ps -u $username -o pid,rss,command | awk '{print $0}{sum+=$2} end {print "total", sum}' what best way collect total sum in python script? had psutil module collects global memory information , there no way filter down user. it's pretty simple using psutil . can iterate on processes, select ones owned , sum memory returned memory_info() . import psutil import getpass user = getpass.getuser() total = sum(p.memory_info()[0] p in psutil.process_iter() if p.username == user) print('total memory usage in bytes: ', total)

r - Filter of rhs with arules/apriori is not working -

i'm using arules::apriori binary matrix , want create rules have 1 particular column on rhs. specified in documentation doesn't seem work. easy enough filter post hoc waste lot of computational time calculating rules in first place. example: library(arules) data = data.frame(matrix(rbinom(10000,1, 0.6), nrow=1000)) for(i in 1:ncol(data)) data[,i] = as.factor(data[,i]) dsrules = as(data, "transactions") rules = apriori(dsrules, parameter=list(support = 0.1, minlen = 3, maxlen = 3, target= "rules", confidence = 0.7), appearance = list(rhs = c("x1=1"))) rules contains 3378 rules rules.sub = subset(rules, subset = (rhs %pin% "x1=1")) rules.sub contains 172 rules in actual data go millions of results ~4000 huge difference. nsfy, there easier way this. need add default='lhs' , in appearance=list(rhs='x1=1',default='lhs') . limit rhs x1=1 .

html - Why JQuery is not updating the hidden field -

i have divs inside updatepanel: <asp:updatepanel runat="server" id="upadddays" updatemode="conditional"> <contenttemplate> <div class="adddayssection"> <div class="leftdiv2">task name: </div> <div class="rightdiv2" style="overflow: hidden;"> <asp:label id="lbltname" runat="server" text="" clientidmode="static"></asp:label> </div> </div> <div class="adddayssection"> <div class="leftdiv2">current due date: </div> <div class="rightdiv2"> <asp:label id="lblcurrdd" runat="server" text="" clientidmode="static"></asp:label> </div> </div> <div class="a

html - Perspective 3D animation flickering in Firefox -

i'm trying create 3d css effect of door swinging opening , shutting. have codepen animation work it: http://codepen.io/caleuanhopkins/pen/dslpv here's css: .frame--realistic { perspective: 20em; } .door { height: inherit; background: darksalmon; } .frame { margin: .5em auto; border: solid 1em saddlebrown; width: 500px; height: 6.5em; } .door--open { -webkit-transform-origin: 0 0 /*whatever y value wish*/; -moz-transform-origin: 0 0 /*whatever y value wish*/; -ms-transform-origin: 0 0 /*whatever y value wish*/; -o-transform-origin: 0 0 /*whatever y value wish*/; transform-origin: 0 0 /*whatever y value wish*/; -webkit-transform: rotatey(-45deg); -moz-transform: rotatey(-45deg); -ms-transform: rotatey(-45deg); -o-transform: rotatey(-45deg); transform: rotatey(-45deg); } @-webkit-keyframes doorani { { -webkit-transform: rotatey(0deg); } { -webkit-transform: rotatey(20deg); } } .frame:hover .door--ani { -webkit-transform-origin: 0 0; -moz-transform-origi

c# - Application requires version 4.0 full or other compatible .Net framework -

i getting error application requires version 4.0 full or other compatible .net framework i have below mentioned prerequisite- windows installer 4.5 microsoft .net framework 4 client profile (x86 , x64) sql server compact 3.5 sp2 sql server 2008 express windows installer 3.1 please let me know why throwing such error when have mentioned microsoft .net framework 4 client profile (x86 , x64). it appears need microsoft .net framework 4 full version, not client profile. installing microsoft .net framework 4.5 should satisfy requirement.

android - google play services not found on device -

i'm android newbie. i'm using android studio, device 4.0.4, api 14. when run on device, error message. looks google play services missing on device. can see google play store on device. activated using gmail account. device not setup verizon. on i'm missing? 09-23 10:16:44.642 19251-19251/com.noatta.www.noatta_14 d/dalvikvm﹕ late-enabling checkjni 09-23 10:16:45.263 19251-19251/com.noatta.www.noatta_14 w/signinbutton﹕ sign in button not found, using placeholder instead 09-23 10:16:45.533 19251-19251/com.noatta.www.noatta_14 w/googleplayservicesutil﹕ google play services missing. 09-23 10:16:45.543 19251-19251/com.noatta.www.noatta_14 w/googleplayservicesutil﹕ google play services missing. 09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 d/androidruntime﹕ shutting down vm 09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 w/dalvikvm﹕ threadid=1: thread exiting uncaught exception (group=0x40ab0228) 09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_