Posts

Showing posts from April, 2013

testing - How to test the case that HTML <object> (or a similar feature) is unsupported? -

i'm writing web page has html <object> in it, like <object [...]>your browser not support this.</object> on machines have up-to-date browsers installed , don't want clutter machines old browsers (this not possible in cases without depending on third-party-software and/or doing hours of configuration tweaking). i know of pages https://www.browserstack.com/ let render websites, rather time consuming when need check loads of small changes. , don't want give data external companies simple rendering. how can check how page on old browsers? just found out. content between <object></object> tags not triggered in unsupporting browsers, when data attribute holds invalid target (like unavailable file). so, test how looks on unsupporting browsers, 1 can set data -attribute unavailable. keep in mind webdesigner has define more meaningful message "your browser not support svg", has consider object display missing (for ex...

javascript - Dynamic website-navigation (one file for all pages) in a filesystem - without webserver -

hello have website without webserver in windows-filesystem. refactor old navigation , plan use 1 navigation-file in seperate folder. in navigation-folder links should set links in dependency root folder. root folder have no specific name, in root folder there start.html. for e.g. c:\test\start.html root file c:\test\foo\foo.html file c:\test\bar\bar.html file c:\test\bar\foobar\foobar.html file all files include navigation.js links defined. 'text' : 'start', 'a_attr' : { 'href': 'start.html'} 'text' : 'foo', 'a_attr' : { 'href': 'foo/foo.html'}, 'text' : 'bar', 'a_attr' : { 'href': 'bar/bar.html'}, 'text' : 'foobar', 'a_attr' : { 'href': 'bar/foobar/foobar.html'}, that works fine when include navigation in start.html . links have correct relation. but when include in...

java - Why does crawling a folder in Linux gets faster with each iteration? -

i have program in need crawl specific folder delete contents. using files.walkfiletree method achieve same. on ubuntu 14.04, 64bit 4gb ram, although program runs fine, first time start crawling folder, takes long time. however, on subsequent crawls of same folder, time decreases drastically, , settles down. here output of simple system.currenttimeinmillis() calls check time spent: key : deletion tells time took crawl folder called 'output' , delete contents(around ~5000 files). copy tells time took copy contents of small folder on place. crawl tells time took crawl directory called 'content', parse ~5000 files create corresponding objects + deletion + copy [see above]. parse tells time took write contents of these ~5000 objects separate files. times in milliseconds. folder a on first time: deletion: 100100 copy: 53 crawl: 143244 parse: 4307 on second time: deletion: 486 copy: 3 crawl: 1424 parse: 4581 on third time: deletion: 567 copy: 16...

Echo the basename in shell -

i have path directory , need extract filename out of can use further in shell script. #!/bin/sh dir=/var/tmp/file1 fname= basename $dir echo $fname echo "the script executes:" $fname echo $fname here fname gets printed once. in other cases, comes blank. where going wrong? this below working. #!/bin/sh dir=/var/tmp/file1 fname=`basename $dir` echo $fname echo "the script executes:" $fname echo $fname output $: ./tt.sh file1 the script executes: file1 file1

encryption - Is there any way to use RSA in the Oracle/PL SQL? -

i need encrypt/decrypt data in pl/sql rsa (public/private key) not found way it. checked dbms_crypto package seems doesn't support rsa algorithm. is there way use rsa in pl sql? or asymmetric algorithm suggest use instead? problem description in case, generate random keys (few millions in each iteration) needs stored encrypted in db. then, when requested need decrypt keys , export file. also, not allowed store duplicate keys in db. rsa seems perfect case not supported in free version of oracle cryptography package. need suggestion handle requirements. my open source oracle pl/sql program crypto4ora can encrypt , decrypt messages using rsa public , private keys. see project page installation details. steps download, run loadjava , , run sql script. below full example of generating keys, encrypting, , decrypting: --generate keys. store private , public key later. select crypto.rsa_generate_keys(key_size => 1024) dual; --encrypt , store encrypted tex...

ImageJ - compare original and resized image on similarity -

dear colleagues. me please next question. want resize huge amount of images , substitute original images resized saving disk space. before substitution want sure, resized image same original image different dimensions (not white list, not malevich's square , on). there way check such similarity sure resizing successful? thanks. one idea might downscale image tentative down-resed version, scale original size , compare original. if seem pretty similar, overwrite original tentative conversion, if not, report error. here's how might in bash comments. can rehashed other languages of course, or can use system() shell out , use command line version language. #!/bin/bash # downscale image , check if correct # supply image name parameter original="$1" tentative="t-$$-$original" echo debug: tentative filename=$tentative # size of original can resize size origsize=$(identify -format "%g" "$original") echo debug: origsize=$or...

java - time series of xy-plots -

does know java library supports graphics shown below on photo(i program in java). want create multiple xy-plots in time sieries 3d view ? in principle have got no idea how create such thing. know jfreechart not support kind of graphic output , visualisation. http://www.imgbox.de/show/img/i59uk1tosy.gif you can use googlevis it's data source lib

javascript - External script to trigger _postback for icon button on a webpage using keyboard shortcut extension -

i'm using keyboard shortcut extension in chrome (latest version) save time on repetitive browser actions. one such action: #'s in form, hitting "enter", icon button appears when clicked triggers hreference=_postback .. , takes me different page. how create external script uses "enter" keyboard shortcut submits form & triggers postback (or creates click event that) on generated icon button take me page clicking do? screenshots , names follow in 8 hours.

c# - fill dropdownlist from onselectindexchanged -

im using asp.net , c# im using 2 dropdownlist dd1,dd2 how fill 2nd dropdownlist dd2 dd1 onselectindexchanged my code is, <asp:dropdownlist id="ddmedtype" runat="server" cssclass="drop" autopostback="true" onselectedindexchanged="ddmedtype_selectedindexchanged"> <asp:listitem value="0">-select-</asp:listitem> <asp:listitem value="tablet">tablet</asp:listitem> <asp:listitem value="tonic">tonic</asp:listitem> <asp:listitem value="capsules">capsules</asp:listitem> <asp:listitem value="dispotab">disposable tablet</asp:listitem> </asp:dropdownlist> <asp:dropdownlist id="ddmedname" runat="server" cssclass="drop" > <asp:listitem value="0">-select-</a...

Cannot start container on docker compose -

once removed tiger machine config file. everything go well. don't wrong tiger. each machine share same image when ran docker-compose up , got cannot start container 38c203136f645a62451fbbc19bcdae0b1c31a45495e3e02588bc8182397f0e2e: [8] system error: open /proc/self/fd: no such file or directory - docker-compose 1.2.0 jetstar: mem_limit: 512m image: newbike/firefox-standalone volumes: - "./:/project-bird" ports: - 5902 peach: mem_limit: 512m image: newbike/firefox-standalone volumes: - "./:/project-bird" ports: - 5903 scoot: mem_limit: 512m image: newbike/firefox-standalone volumes: - "./:/project-bird" ports: - 5904 tiger: mem_limit: 512m image: newbike/firefox-standalone volumes: - "./:/project-bird" ports: - 5905 vanilla: mem_limit: 512m image: newbike/firefox-standalone volumes: - "./:/project-bird" ports: - 5906 chances 38c203136f645a62451fb...

How to get method level variable declarations using javaparser? -

am trying method level variables using visit(fielddeclaration n, object arg) , it's not working. on appreciable. first of need use javaparser on source code compilationunit (which represents single file). @ point can use visitor. can create anonymous class extending genericvisitoradapter , override public r visit(final variabledeclarator n, final arg) . take compilation unit , run compilationunit.accept(myvisitor, null); . in method override can parent of variabledeclator see if method or else. as alternative can take compilation unit, access classes in there, access methods of classes , body of methods looking variabledeclarators. disclaimer: javaparser contributor.

access paypal response in ruby on rails 4 -

i have abort abort(response.payment_info.inspect) and response [#<paypal::payment::response::info:0x007f25f62a8410 @ack="success", @currency_code="usd", @error_code="0", @order_time="2015-07-01t13:30:54z", @payment_status="completed", @payment_type="instant", @pending_reason="none", @protection_eligibility="ineligible", @protection_eligibility_type="none", @reason_code="none", @receipt_id=nil, @secure_merchant_account_id="xpn8gak2pgvcq", @transaction_id="63h82632fa7502700", @transaction_type="expresscheckout", @request_id=nil, @seller_id=nil, @exchange_rate=nil, @amount=#<paypal::payment::common::amount:0x007f25f629f400 @total=5, @item=0, @fee=0.5, @handing=0, @insurance=0, @ship_disc=0, @shipping=0, @tax=0, @gross=0, @net=0>>] how can transaction_id or other variables amount? please me out this. thanks i have found. can this...

sql - Alternative to case statement -

i need suggestions on writing sql query other using case statement in oracle.i have table named system_specs following data customer_id disk_space_allocated c001 44g c002 1300g c003 1503g c004 1780g i wrote following sql query using oracle case statement count of customer_id based on ranges disk_space_allocated select case when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 300 '1-300' when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 500 '300-500' when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 700 '500-700' when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 900 '700-900' else '900+' end diskallocated, count(*) number_of_customers system_specs group ...

Python Azure SDK: create multiple VMs in the same cloud service -

i trying create multiple vms in same cloud service (but in unique deployments within cloud service). below produces 1 machine have name mycluster-master-3 (given self.nummasters == 3). in other words, last machine created , can seen in azure management portal. note there no errors when execute code self.nummasters == 3: for node in range(self.nummasters): logger.info('deploying virtual machine "%s"...' % (self.clustername + '-master-' + str(node + 1))) logger.info('creating linuxconfig...') linuxconfig = azure.servicemanagement.linuxconfigurationset( host_name=self.clustername + '-master-' + str(node + 1), user_name='auser', user_password='auser123!', disable_ssh_password_authentication=true ) # destination storage account container/blob vm disk # created media_link = 'http...

multithreading - c# - How to stop a timer Immediately -

i have system.timers.timer 100 interval. question if set enable = false in timer, current working process in timer method stop immediately? or after method finished. private void watchtags(object obj, elapsedeventargs handler) { for(int i=0 ; i<10000;i++){ // works } } private void stop_button(){ watcher.enabled = false; } is loop stop or after finish? doing timer.enabled = false stop timer. same timer.stop(); timer.enabled = false = system.threading.timer or system.timers.timer timer.stop(); = system.windows.forms.timer

javascript - Angular js TextField validation -

i working on angular js project, need validate data entered before submiting form. <select class="form-control" id="offertype" ng-model="addoffer.discount"> <option value="buy x y free">buy x y free</option> <option value="basket level offer - 100$ 5">basket level offer - 100$ 5</option> <option value="basket level offer - product free">basket level offer - product free</option> <option value="discount %">discount %</option> <option value="discount $">discount $</option> </select> <input type="text" required class="form-control" id="" placeholder="enter discount value" ng-model="addoffer.value"> this select box (which select type of offer need given) , textfield (with sets value above selected offer). when s...

ios - UIButton not reacting to first press in Swift -

i working on simple (ok, should simple) calculator estimates risk based on few inputs (toggle on/off) everything working properly, except uibuttons need tapped 2 times toggle initially. after that, uibuttons work expected. here code (contained within viewdidload()) @iboutlet weak var confusionbutton: uibutton! var counter = 0 var confusiontoggle = 0 and here action @ibaction func pressconfusion(sender: uibutton) { if confusiontoggle == 0 { confusionbutton.backgroundcolor = uicolor.clearcolor() confusionbutton.alpha = 1; confusiontoggle++; counter++; } else { confusionbutton.backgroundcolor = uicolor.graycolor() confusionbutton.alpha = 0.5; confusiontoggle = 0 counter--; } } any thoughts on one? swift skills limited (my first attempt swift) think getting confused. use print statements first understand happening, fancy button ui c...

node.js - accessing files in meteor -

Image
i have use case create documents on fly inside meteor app. have template document stored in meteor folder , static images embed in documents in app. users take pictures using camera inside , app , upload them folder in meteor app, these embedded in document created. storing these files in .uploads folder inside app , accessing it. when in local have no problem not sure how getting copied deployed app , how access these files. i using windows development process.env.pwd not working in local dev. using below code working in local doesn't work in server. var base = process.cwd(); console.log("base path:", base); var afterresolvefind = base.split('.meteor')[0]; var path = meteor.npmrequire('path'); var inputpath = ".uploads//templates//input.docx" filepath = path.join(afterresolvefind, inputpath);

c# - How to submit the browser type when download a web stream -

my code : string result = new webclient().downloadstring("https://www.facebook.com/profile.php?id=123456789"); the result giving me supported browser. body class=\"unsupportedbrowser what intend do: download source code facebook particular page. problem encounter : stream facebook, facebook block me since access apps due not valid browser. expectation : how can submit browser type chrome cheat facebook valid browser. you can add headers webclient object. however, prefer go httpwebrequest/httpwebresponse method of scraping since believe gives more options. headers.add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); headers.add("accept-encoding", "gzip, deflate"); headers.add("accept-language", "en-us,en;q=0.5"); headers.add("cookie", "has_js=1"); headers.add("dnt", "1"); heade...

java - unexpected multiple execution of mapper intended to run once -

i tried write simple job 1 mapper , no reducer write data hbase. in mapper tried open connection hbase, write few rows of data table , close connection. in job driver using jobconf.setnummaptasks(1); , jobconf.setnumreducetasks(0); specify 1 mapper , no reducer executed. setting reducer class identityreducer in jobconf. strange behavior observing job writes data hbase table after see in logs continuously tried open connection hbase , closes connection goes on 20-30 minutes , after job declared have completed 100% success. @ end when check _success file created dummy data put in outputcollector.collect(...) see hundred of rows of dummy data when there should 1. following code job driver public int run(string[] arg0) throws exception { configuration config = hbaseconfiguration.create(getconf()); ensurerequiredparametersexist(config); ensureoptionalparametersexist(config); jobconf jobconf = new jobconf(config, getclass()); jobconf.setjobn...

bash - Deleting files older than 10 days in wildcard directory loop -

i delete old files multiple directories there wild card 1 of path attributes. i'm trying loop through each of directories without specifying each one. think i'm there i'm not sure how cd specific directory delete relevant files. #! /bin/bash delete_search_dir=/apps/super/userprojects/elasticsearch/v131/node*/elasticsearch-1.3.1/logs/ entry in `ls $delete_search_dir`; find $path -name "*super*" -type f -mtime +10 -print -delete #find . -type f -name $entry -exec rm -f {} \; done any ideas on how specific directory , apply delete? find can search in multiple directories. can this: delete_search_dir=/apps/super/userprojects/elasticsearch/v131/node*/elasticsearch-1.3.1/logs find $delete_search_dir -type f -name '*super*' -mtime +10 -print -delete

powerpoint - Opening Presentation with python pptx -

i have got code in python open .pptx -files libreoffice: from pptx import presentation prs = presentation('tes.pptx') if run code on raspbian, error message: file "bukappt.pt", line 1, in <module> pptx import presentation file "/usr/local/lib/python2.7/dist-packages/pptx/_init_.py", line 15, in <module> pptx.api import presentation # noqa file "/user/local/lib/python2.7/dist-packages/pptx/api.py", line 14, in <module> ppx.package import package file "/usr/local/lib/python2.7/dist-packages/pptx/parts/image.py", line 13, in <module> import image pil_image importerror: no modulenamed image how can fixed? this caused not having pillow imaging library installed. work you'll need install pillow. https://pypi.python.org/pypi/pillow/2.9.0

php - Included File Gets Me Undefined Variables -

couldn't find answer solves codes issue. file.php: if(isset($_get['season1'])) { $season1 = $_get['season1']; $url = 'http://www.imdb.com/title/'.$season1.'/episodes?season=1'; $imdb_content = file_get_contents($url); $html = str_get_html($imdb_content); //grabbed content $resultarray = array(); foreach($html->find('strong a[itemprop="name"]') $results) { $resultarray[] = $results; } echo $resultarray[0]; echo $resultarray[1]; } else { header("location: ../"); } index.php: include("http://example.com/file.php?season1=".urlencode($imdbid)); (...) <div class="row"> <div class="tech-spec-element col-xs-20 col-sm-10 col-md-5"> <span title="episode 1"></span>1 - <?= $resultarray[0]; ?> <div></div> </div> <div class="tech-spec-element col-xs-20 col-sm-10 ...

bdd - Ambiguous step in Python Behave -

my business user likes use sentence "it should created", determined context of scenario. example: given have gift certificate "<name>" when enter gift certificate should created or given customer order return order "<order_no>" when create customer order return should created in "then should created", retrieve either created gift certificate or customer order return comparison. however, have different api , object. firstly, there way in python behave without getting "exception ambiguousstep:"? if not, best practice in bdd world without forcing user have repeat saying "then gift certificate should created" or "then customer order return should created"? thanks. in specific case giving here, write steps more verbosely avoid "it". write "then gift certificate should created", etc. prefer avoid having steps depend on state passed through context . however... ...

asp classic - Templatefield in gridview -

how can values stored in 1 column of gridview? code: <asp:templatefield headertext="document code" headerstyle-backcolor="#000099" headerstyle-width="150px"> <itemtemplate> <asp:linkbutton runat="server" id="doc_code" text='<%# eval("doc_code")%>' commandargument='<%#eval("doc_id") %>' oncommand="editdocument" causesvalidation="false"> <span class='glyphicon glyphicon-remove'></span> </asp:linkbutton> </itemtemplate> </asp:templatefield> i blank value column dont know how values. please help. thanks use bind in place of eval shown in below solution. <asp:linkbutton runat="server" id="doc_code" text='...

excel - Access a variable of a module in another module after running the program which calls that module? -

Image
i have excel file 2 buttons access 2 different modules. can access variable of module in module after running program calls module? my modules 1st module.. public sub directory_path() dim directory string directory = inputbox("enter directory path contains folders ""this quarter"",""last quarter"",""second_last_quarter"".") if right(directory, 1) = "\" directory = left(directory, len(directory) - 1) end if end sub i called the first module in 2nd module using public sub directory_path() . want directory variable in first module used variable in 2nd module... in 1st module - declare directory public @ top of module outside of sub/function. it's available every module in project: public directory string sub directory_path() directory = inputbox("enter directory path contains folders ""this quarter"",""last quarter"...

raspberry pi - python GPIO pins won't cleanup -

i beginer python , decided give go on raspberry pi. learned python small book covers basics, combined demo change tkinter window background color toggle button , lighting led code: #! /usr/bin/env python import rpi.gpio gpio gpio.setmode(gpio.board); gpio.setup(7, gpio.out) gpio.output(7, false) tkinter import* window = tk() window.title("relay button") window.configure(bg= "green") btn_end= button(window, text = "close", command=exit) def tog(): if ( gpio.input(7) == true ): gpio.output(7, false) else: gpio.output(7, true) btn_tog=button( window, text="switch", command=tog) btn_end.pack(padx=100, pady=20) btn_tog.pack(padx=100, pady=20) window.mainloop() gpio.cleanup() i error : relaybutton.py:3: runtimewarning: channel in use, continuing anyway. use gpio.setwarnings(false) disable warnings. gpio.setmode(gpio.board); gpio.setup(7, gpio.out) i have no clue why error, have @ end gpio.c...

facebook - Graph API: event's RSVP check -

i'm trying idea of getting facebook's rsvp event, stuck on part: as see now, user's rsvp have make 3 requests following logic: request eventid/attending/userid -> if "data" array count == 0 -> request eventid/maybe/userid -> if "data" array count == 0 -> request eventid/declined/userid else -> means user didn't make choice previously. so here looks have make 3 requests facebook's graph api users's rsvp single event. the question if there way rsvp status event doing single request? i'm using latest facebook sdk , latest graph api. many in advance. so best solution here far is: one request /eventid/attending/userid one request /eventid/maybe/userid one request /eventid/declined/userid (if needed know if event invitation declined) call eventid/attending(maybe/declined)/userid lets filter rsvp single user, avoid downloading , processing large amount of data here. after call hav...

python - Adding Models to Django Foreign Key -

Image
i have model foreign key, allowing me reference arbitrary amount of other models. can add , remove using admin interface, how can equivalent programatically? class json(models.model): data = models.textfield() class dweet(models.model): name = models.charfield(max_length = 300) data = models.foreignkey(json) in order use models can following: >>> app.models import json, dweet >>> = json(data="asdf") >>> a.save() >>> b = dweet(name="test", data=a) >>> b.save() >>> c = dweet(name="test2", data=a) >>> c.save() after end 1 json object , 2 dweet objects both point said json object. that's interesting gets 2 models you've shown us. can add more json objects if of course, each dweet can point 1 json (not sure if asking different in question).

sqlalchemy - TypeError: __init__() got an unexpected keyword argument 'nullable' when initializing database. Pyramid/Python -

getting stacktrace below when attempting init database. i'm new python/pyramid , appreciate in sorting error out. my code: import sqlalchemy sa ... def foreign_key_column(name, type_, target, nullable=false): fk = sa.foreignkey(target) if name: return sa.column(name, type_, fk, nullable=true) else: return sa.column(type_, fk, nullable=true) class entry(base): ... user_id = foreign_key_column(none, sa.integer, "users.id", nullable=false) foreign_extra = sa.column(sa.unicode(100, nullable=false)) ... error: traceback (most recent call last): file "/home/username/pycharmprojects/.virtualenvs/application_env/bin/initialize_application_db", line 9, in <module> load_entry_point('application==0.1', 'console_scripts', 'initialize_application_db')() file "/home/username/pycharmprojects/.virtualenvs/application_env/lib/python3.4/site-packages/pkg_resources.py", line 356...

c# - Cannot get LDAP connection working - always "Unknown error" -

i'm researching need build active directory search tool used in c# asp.net web app. i know little ad (and don't particularly want know more necessary) i've asked our tech ops set dummy instance on server. they've done giving domain dummy.local i need work out ldap connection string. here i'm stuck. i'm using user account member of domain admins. after loads of hunting round web i've tried sorts of things work out various components of ldap connection string. example, if run following in cmd.exe domain admin user on server... dsquery user -samid "username" | dsget user -memberof -expand ...this gives me following information: "cn=domain admins,cn=users,dc=dummy,dc=local" "cn=remote desktop users,cn=builtin,dc=dummy,dc=local" "cn=users,cn=builtin,dc=dummy,dc=local" "cn=administrators,cn=builtin,dc=dummy,dc=local" "cn=domain users,cn=users,dc=dummy,dc=local" "cn=denied rodc password ...

c# - foreach loop to fetch JSON value -

i trying fetch latitude , longitude of json result. json result (have many records): "results" : [ { "geometry" : { "location" : { "lat" : 28.637255, "lng" : 77.05202800000001 } }, "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png", "id" : "aef56d078ec3fcab6f4a966bd944d3d59973bd72", "name" : "homeopati kendra", "opening_hours" : { "open_now" : false, "weekday_text" : [] }, "place_id" : "chijqavdfrwfdtkrmrahjcbioni", "reference" : "cnrjaaaawcobegdvsl4keqnpyt2osvf82b7fchipuhrfqvgg8b1er7fcv9i1nupn0lff50ovg9ug1pevkczg813lq9aae1dk5gcgn99ajpq1it9lafcwx3sauwtiinliepgptdhnz3ngdzhpvix70a2d1kzcchiqvd4os73_jmr2wyqg4jtrjxoujcngt2m4xzdixadjotga-lgrnr4", "scope" : ...

KDE taskbar and desktop break -

it's happened few times desktop , taskbar break, , don't know how restore them. how break? well, taskbar (i'm not sure it's called that, 1 in bottom applications , notifications , kickoff button) disappears. i'm missing desktop background , widgets. i can operate okay because can move through windows , desktops, , use f2-other command prompt applications. way i'm restoring though restart computer, figure there's better way. thank you. the system application deals plasmashell . had open krunner , run there.

xml - xmlstarlet selecting a node with a specific attribute value -

i new of please forgive me if answer totally obvious! have xml document downloaded ncbi , trying extract host information each entry, looks little (but more nested): <orgname_mod> <orgmod> <orgmod_subtype value="strain">2</orgmod_subtype> <orgmod_subname>mvs/jiroft.irn/14.15/1[b3]</orgmod_subname> </orgmod> <orgmod> <orgmod_subtype value="nat-host">21</orgmod_subtype> <orgmod_subname>homo sapiens</orgmod_subname> </orgmod> </orgname_mod> i've had success using following: xml sel -t -v //orgname_mod/orgmod[2]/orgmod_subname -n file.xml but problem there more or less information in orgmod nodes , host isn't in second position. i've tried every version of try , select host node specifically: xml sel -t -m //orgmod/orgmod_subtype[@value=nat-host] -v ../orgmod_subname -n file.xml i want select orgmod_subtype node...

python - How does the regex "\" character and grouping "()" character work together? -

i trying see statements following pattern matches: \(*[0­-9]{3}\)*-­*[0-­9]{3}­\d\d\d+ i little confused because grouping characters () have \ before it. mean statement must have ( , ) ? mean statements without ( or ) unmatched? statements: '404­678­2347' '(123)­1247890' '456­900­900' '(678)­2001236' '404123­1234' '(404123­123' context important: re.match(r'\(', content) matches literal parenthesis. re.match(r'\(*', content) matches 0 or more literal parentheses, making parens optional (and allowing more 1 of them, that's bug). since intended behavior isn't "0 or more" rather "0 or 1", should written r'\(?' instead. that said, there's whole lot regex that's silly. i'd consider instead: [(]?\d{3}[)]?-?\d{6,} using [(]? avoids backslashes, , consequently easier read whether it's rendered str() or repr() (which escapes backslashe...

javascript - AngularJS won't let me load another page -

i want have link goes page , nothing has visible effect on page. have tried: <a href="url"> <a href="url" target="_self"> <a ng-click="register()"> where register controller function, function bodies i've tried: $window.location.href(url) $window.location.href = url $window.location = url all followed $window.location.reload() (which not refresh page after failing change url). every single method accepted valid answer other people asking same question. using angular 1.2 old. edit: sorry not beign more specific avoid confusion; url placeholder inline string , elements closed properly. trying list methods i've seen other pages on site (which failed). in html5mode $location. this how it. in html: <a href="javascript:" ng-click="register();">register here!</a> and in controller, have function this: $scope.register = function() { $window.location = ...

java - Selenium looping sendKeys -

so have gotten far enough locate textbox on facebook, , send person message. want see if can create loop send multiple messages @ once. current problem have loop: for (int = 0; < 20; i++) { messagebox.sendkeys("my friend's name " + + " "); messagebox.sendkeys(keys.enter); } however, can once. print "my friend's name0" , stop. java says: element not attached page document. i assuming because sent message, part of inspect element has changed? there way solve this? get friend's name excel sheet make method data excel file:- public static void fn_fetchexceldata(string filepath,string columnname) throws ioexception{ string wbookpath=filepath; workbook wbookobj=fn_getworkbook(filepath); sheet sheetobj=wbookobj.getsheetat(0); row fstrowobj=sheetobj.getrow(0); int cellcount=fstrowobj.getlastcellnum(); int columnnumb...

Conditions combined with logic OR - Swift (error) -

i`m following tutorial ray wenderlich ( http://www.raywenderlich.com/81952/intro-object-oriented-design-swift-part-1 ) this function gives error. problem line logic or operator ( || ). can`t find cause of issue. the function: func turn (degrees: int) -> string { var normaldegrees = degrees let degreesinacircle = 360 if (normaldegrees > degreesinacircle || normaldegrees < -degreesinacircle) { normaldegrees = normaldegrees % degreesinacircle } return "turn \(normaldegrees) degrees" } the error get, says: expected "," separator the function part of class, don´t see why should problem. i´ll upload code if necessary. i´m working code in playground file. the rest of class: class vehicle { var brandname = "" var modelname = "" let modelyear = 0 var powersource = "" var numberofwheels = 0 func goforward() -> string { return "" } f...

c# - Setting individual values in ASPxGridView -

i have aspxgridview gets populated database. in code works correctly (about 95% sure of this) , want call e.setvalue("meantime") = meantimecell; unfortunately not exist. have searched cannot find answer. protected void rtmonitoringgrid_htmlrowcreated(object sender, devexpress.web.aspxgridviewtableroweventargs e) if (e.rowtype == devexpress.web.gridviewrowtype.data) { //this gets value in gridview string meantimecell = e.getvalue("meantime").tostring(); try { double result; if (double.tryparse(meantimecell, out result)) { //this string want overwrite old cell data meantimecell = string.format("{0}s", math.round(result, 1)); //setvalue called here } } catch (exception ex) { } } } does know easy fix this? have thought of trying format data before gets put in aspxgridview think...

html5 - Download image with Javascript and convert it to a Blob -

with html5 , filereader/blob can convert from/to blobs/datauris, i'm wondering if can download image remote url , convert blob (or datauri). if possible, how it? i managed myself: var xhr = new xmlhttprequest(); xhr.open('get', attr.ngfdefaultsrc, true); xhr.responsetype = 'blob'; xhr.onload = function(e) { if (this.status !== 200) return; var blob = new blob([this.response], {type: this.response.type}); //rest of code uses blob goes here }; xhr.send();

web component - Polymer 1.0: How to make paper-button change color on hover? -

this example shows paper-button examples (in last [4th] column [labeled colors]) change color when user hovers mouse on it. i can not find anywhere in polymer 1.0 documentation how make happen. also, copying , pasting source code element on this page doesn't work. can please provide working code example of how make polymer 1.0 paper-button change color when user hovers mouse on it? in document's css: paper-button:hover { background: green; }

ruby - VoltRB rspec testing a method can't convert Promise into Array -

i trying rspec unit tests on method in model. method returns promise, , when resolved, name of person. method not problem know works correctly. here test code: it 'should return correct name' report = report.new(first_name: 'testy', last_name: 'testerson') report.save! expect(report.name).to eql('testy testerson') end when test it, following error: failure/error: expect(report.name).to eql('testy testerson') typeerror: can't convert promise array (promise#to_ary gives promise) while debugging, used following line inspect returned value of method: puts report.name.inspect and got following response: #<promise(70319926955580): "testy testerson"> the error seems happening because tests promise against expected value. why getting error? using report.name.value fixes issue

Library for deep learning on Amazon EC2 with CPU and GPU support for convolutional neural network -

i want train cnn on bunch of images. want run on amazon ec2 cpu or gpu clusters. running deep learning on cluster, figured of options are: h2o (with spark) caffee theano i not sure of these options suit needs. read through h2o documentation on deep learning , not seem support cnns. ideas on how should proceed? another side question: how upload images cluster training cnn? new cluster computing. if follow instructions here https://github.com/deeplearningparis/dl-machine can set ami image theano , torch. there pr on config have caffe default (if need it, checkout branch , run install script instance up).

How can I access the API static via basic auth to a Kubernetes cluster on GCE -

i know it's possible access static views of api, can't find out basic auth details need login via browser. can find these? i'm on gce , created cluster. run kubectl config view . it'll dump out auth information used access cluster, including basic auth username , password.

Partially completed circle (with text) in CSS -

i'm trying create following effect on design: http://i.imgur.com/riasa3n.png i can create bordered circle fine - matter of partially completing circle proving difficult. there myriad of different ways javascript , canvas, can't find solid way achieve in css. don't mind having number of different classes different values, there elegant solution available? updated : possible using pure css3. (you should able open below demo , customize result) use @keyframes animate between numbers. you'll need add this. below using @keyframes 'rotate' { circular motion. body { background: #222; } .circle { width: 100px; height: 100px; position: absolute; top: 0; left: 0; bottom: 0; right: 0; margin: auto; background: #333; border-radius: 50%; } .inner-circle { width: 92%; height: 92%; background: #222; border-radius: 50%; margin: auto; vertical-align: middle; position: absolute; top: 0; ...

ruby on rails - How to replace tag with some value in XML using Nokogiri -

i have predefine xml template tags need replaced. tag values come dynamically front-end. <?xml version="1.0"?> <catalog> <book id="bk101"> <author>author1</author> <title>title1</title> <genre>computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>an in-depth @ creating applications xml.</description> </book> <book id="bk102"> <author>author2</author> <title>title2</title> <genre>fantasy</genre> <price>5.95</price> <publish_date>2000-12-16</publish_date> <description>a former architect battles corporate zombies, evil sorceress, , own childhood become queen of world.</description> </book> </catalog> in above example need replac...

download - Java NIO downloaded file is different than web browser -

i trying download .torrent file url using java nio. downloading file web browser results in proper torrent file can used. downloading in java results in different/corrupted file. this code using perform download: url url = new url("http://torcache.net/torrent/e4b5326aa31d1ae0c30e05129193e87aa086f5f8.torrent"); readablebytechannel rbc = channels.newchannel(url.openstream()); fileoutputstream fos = new fileoutputstream("test.torrent"); fos.getchannel().transferfrom(rbc, 0, long.max_value); fos.close();

Does Python gurantee the traversal order of a list iterator? -

as far can see in python 2.7, iterator of list traverse list in increasing-index order. know if order guaranteed python 2/3, or order defined behavior of list iterator. in other words, if want traverse list in increasing-index order (and require in such order), , use iterator purpose, possible in later version of python behavior changed? iterating order guaranteed lists, not dictionaries or sets. holds both python 2 , 3, , unlikely ever changed.

Adding Data to Table with Foreign Key -

i trying add 1 row of data table (employee) has foreign key (ob_num). job_num referenced in job table. however, when go add row below error: msg 547, level 16, state 0, line 1 insert statement conflicted foreign key constraint "fk__employee__job_nu__5d60db10". conflict occurred in database "team04", table "dbo.job", column 'job_num'. statement has been terminated. my code is: insert employee values (001, 'celie', 'davis', 457-457-4511, 002, '01-05-2012', null); 002 job_num

oledb - ExcelLibrary throwing Unauthorized Access Exception when attempting to create -

as title describes, program throwing unauthorizedaccessexception when attempting create excel file excellibrary library, strange given computer hasn't got restrictions regarding that. code: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.data.common; using system.drawing; using system.linq; using system.data; using system.data.oledb; using system.text; using system.threading.tasks; using system.windows.forms; using excellibrary; namespace exceltest { public partial class form1 : form { public form1() { initializecomponent(); } private dataset ds; private void form1_load(object sender, eventargs e) { string cs = "provider=microsoft.jet.oledb.4.0;data source=test1.mdb;"; ds = new dataset("new_dataset"); datatable dt = new datatable("new_datatable"); string[] x = new string...

java - null pointer exception error in http POST request JSON object -

i doing android coding , sending http post request using httpclient. , giving me null point expception error @ line httpentity = httpresponse.getentity(); i used log cat , found code stopping @ line mentioned above. please me out it. in advance. my code establishment of http client in file servicehandler: package com.example.manumaheshwari.vigo; /** * created manumaheshwari on 30/06/15. */ import android.util.log; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.io.unsupportedencodingexception; import java.util.arraylist; import java.util.list; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.client.utils.urlencodedutils; i...