Posts

Showing posts from January, 2015

jquery - MVC Controller returning JSON to populate Select list but value needs to have a colon -

we have mvc controller returns json want. populate select list options values have colon in them. json: {result: {["valueone": "option 1: option", "valuetwo" : "option 2: other option"]} we populating list jquery $.ajax $("#eventnamedropdownlist").change(function () { geteventdatesandtimes(); }) function geteventdatesandtimes() { var eventname = $('#eventnamedropdownlist').val();// on eventnamedropdownlist value coming "option 1:" instead of whole value. var url = '@url.action("geteventdatetimebyname", "product")'; $("#eventidanddatedropdownlist").find('option').remove().end(); // clear before appending new list $.ajax({ url: url, type: "get", cache: false, datatype: "j

VB.NET 'Outlining' bugs/features in Visual Studio 2015 Update 2 -

fresh install of visual studio 2015 update 2. have visual studio 2010 sp2 installed. running windows 8.1 pro x64. i'm having 2 problems outlining in vb.net vs 2015 in right-click context menu, when click "collapse definitions", regions in file not collapsed. in vs 2010 in same project, regions collapsed. has there been change in how "collapse definitions" behaves @ point between vs 2010 , vs 2015? (see screenshot) - #region "public methods" (and every other region) not collapse, far collapses. for sub or function has xml doc comments attached it: if collapse sub , xml comments, collapsed method description (i.e. line directly above public sub... ) displays '''<summary> in front of actual typed description. in vs 2010, when xml comments collapsed, '''<summary> disappears , see start of actual method description. refer again above screenshot i installed vs 2015 yesterday , installed update 2

python - Why does running the Flask dev server run itself twice? -

i'm using flask developing website , while in development run flask using following file: #!/usr/bin/env python datetime import datetime app import app import config if __name__ == '__main__': print '################### restarting @', datetime.utcnow(), '###################' app.run(port=4004, debug=config.debug, host='0.0.0.0') when start server, or when auto-restarts because files have been updated, shows print line twice: ################### restarting @ 2014-08-26 10:51:49.167062 ################### ################### restarting @ 2014-08-26 10:51:49.607096 ################### although not problem (everything rest works expected), wonder why behaves this? ideas? the werkzeug reloader spawns child process can restart process each time code changes. werkzeug library supplies flask development server when call app.run() . see restart_with_reloader() function code ; script run again subprocess.call() . if set use

hadoop - Install spark on yarn cluster -

i looking guide regarding how install spark on existing virtual yarn cluster. i have yarn cluster consisting of 2 nodes, ran map-reduce job worked perfect. looked results in log , working fine. now need add spark installation commands , configurations files in vagrantfile. can't find guide, give me link ? i used guide yarn cluster http://www.alexjf.net/blog/distributed-systems/hadoop-yarn-installation-definitive-guide/#single-node-installation thanks in advance! i don't know vagrant, have installed spark on top of hadoop 2.6 (in guide referred post-yarn) , hope helps. installing spark on existing hadoop easy, need install only on one machine. have download 1 pre-built hadoop version it's official website (i guess can use without hadoop version need point direction of hadoop binaries in system). decompress it: tar -xvf spark-2.0.0-bin-hadoop2.x.tgz -c /opt now need set environment variables. first in ~/.bashrc (or ~/.zshrc ) can set spark

xml - How move Child Nodes along with values to grand parent node -

i tried few different ways transfer child nodes grand parent, pattern match happening 1 child node not recursively. appreciate here. <grandparent1> <parent1> <child1>1</child1> <child2>2</child2> </parent2> </grandparent1> should become <grandparent1> <child1>1</child1> <child2>2</child2> </grandparent1> size of child nodes varies. appreciate here this easy using xslt's recursive processing model . first, use identity transform template recursively copy as is . add exception parent nodes , make them continue recursion without copying themselves. xslt 1.0 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:strip-space elements="*"/> <!-- identity t

ios - How to fit UIImageView around UIImage in UIStackView -

Image
i trying uiimageview fit around uiimage. should but happening how can fix this?

How to get unlock metadata in Android e.g. fingerprint vs passcode? -

i have application implements deviceadminreceiver . when user attempts unlock device, able determine method (e.g., pin or fingerprint reader) used. the reason because possible fingerprint reader errors exceed threshold failed unlocks specified user's policy, , when happens, user's data wiped device manager. poor user experience lose data because hand brushed against phone in bag while looking else. able smarter how fingerprint scanner failures counted against policy threshold vs. how pins or password attempts counted. as far can tell, android not give me information, thought might ask wider community on chance i'm missing something.

git - How do you apply patch file downloaded from gerrit? -

Image
in gerrit under download section change there section allows download patch-file: using git apply results in: $ git apply 441eb56b.diff.base64 fatal: unrecognized input what command should use apply patch? this base64 encode file (see here ). need decode file first (see here ). think it's easier use cherry pick method instead.

javascript if statement syntax (need help) -

i've looked through prior questions not see answer can understand (they more complicated mine). i'm bootstrapping javascript using old manuals , experiences using scripting language 15 years ago. by modifying tutorial file have code , works fine var oemdc1 = parseint(document.getelementbyid("vehicle_oem_draw").value); var oemdc2 = parseint(document.getelementbyid("vehicle_added_draw").value); var oemdc3 = parseint(document.getelementbyid("new_vehicle_draw").value); var oemdc4 = parseint(document.getelementbyid("include_prism_draw").value); var total_current_draw = document.getelementbyid("total_hourly_current_draw"); total_current_draw.value = oemdc1 + oemdc2 + oemdc3 but need add code if user clicks radio button (include_prism_draw) different total. if (oemdc4 == 1) total_current_draw.value = oemdc1 + oemdc2 + oemdc3 + prism_cd; else total_current_draw.value = oemdc1 + oemdc2 + oemdc3; but added value (p

Replace some numeric value after a pattern in a string of txt in R (grep?) -

i have several txt files input file model, need change of model parameters in order conduct experiments. however, there many parameters , changing them hand time consuming. thought using readlines() , {grep} in r search , replace parameter values not successful, hope me. thank you. the file has lines this: bubbling pressure 1 = 0.3389 .4423 .4118 field capacity 1 = 0.35 0.38 0.37 wilting point 1 = 0.13 0.14 0.13 bulk density 1 = 750. 1400. 1500. vertical conductivity 1 = 2.904e-06 3.63e-05 3.63e-05 ..... bubbling pressure 3 = 0.2044 0.2876 0.2876 field capacity 3 = 0.31 0.33 0.33 wilting point 3 = 0.13 0.14 0.14 bulk density 3 = 750. 1400. 1500. vertical conductivity 3 = 3.16e-06 3.95e-05 3.95e-05 ... i want double vertical conductivity parameters...but not sure how isolate numbers in scientific notation (such "3.16e-06"). is there way isolate e

functional programming - Scala throws no type parameters error on valid lambda definition -

the following method definition: def validclasses(datatype: datatype) = { examples .flatmap { v: => try { val canon = tocanonicaltype(v, datatype) canon.getclass } .tooption .toset } } yield following error: error:(94, 8) no type parameters method flatmap: (f: => scala.collection.gentraversableonce[b])(implicit bf: scala.collection.generic.canbuildfrom[scala.collection.immutable.set[any],b,that])that exist can applied arguments (any => scala.collection.immutable.set[class[?0]] forsome { type ?0 }) --- because --- argument expression's type not compatible formal parameter type; found : => scala.collection.immutable.set[class[?0]] forsome { type ?0 } required: => scala.collection.gentraversableonce[?b] .flatmap { ^ which strange. result of toset not a set[class[?0]] forsome { type ?0 }. there way fix problem? as result of toset not a set

class - Python: Bind an Unbound Method? -

in python, there way bind unbound method without calling it? i writing wxpython program, , class decided it'd nice group data of of buttons class-level list of tuples, so: class mywidget(wx.window): buttons = [("ok", onok), ("cancel", oncancel)] # ... def setup(self): text, handler in mywidget.buttons: # following line problem line. b = wx.button(parent, label=text).bind(wx.evt_button, handler) the problem is, since of values of handler unbound methods, program explodes in spectacular blaze , weep. i looking around online solution seems should relatively straightforward, solvable problem. unfortunately couldn't find anything. right now, i'm using functools.partial work around this, know if there's clean-feeling, healthy, pythonic way bind unbound method instance , continue passing around without calling it? all functions descriptors , can bind them calling __get__ m

ruby - Chef: should I be checking "syntaxcache" files into version control? -

i'm learning chef , keeping chef-repo in version control. when use knife cookbook upload , run git status see bunch of new files in .chef/syntaxcache . this: .chef/syntaxcache/8ab66bdf1ceb07273f7b3d71f483fbd84be595e845e90ffcbeb0ba6d22f684b0 should adding these version control or put pattern in .gitignore leave them out? no, stuff under .chef temp files. (i think) rendered versions of erb templates can run ruby syntax checker on them. i'm kind of surprised don't delete them afterwards though, that's bug.

SQL recursive query (Oracle) -

i'm having problem recursive query in oracle. i'm able result using cte in sql server, have adapt code oracle. the code i'm using is with n(portefeuille, client, level, opcvm, ca, iter) ( select portefeuille, client, 0 level, opcvm, ca, cast(',' + cast(portefeuille varchar) + ',' varchar) iter dbo.chiffres opcvm null union select m.portefeuille, n.client, n.level+1, m.opcvm, m.ca + n.ca, cast(iter + cast(m.portefeuille varchar) + ',' varchar) iter dbo.chiffres m inner join n on n.portefeuille = m.opcvm ) select distinct n.level, n.client, n.portefeuille, n.ca , n.opcvm, iter, (select count(*) n t1 t1.iter '%,' + cast(n.portefeuille varchar) + ',%') - 1 subordinates n, dbo.chiffres c ((select count(*) n t1 t1.iter '%,' + cast(n.portefeuille varchar) + ',%') - 1)

java - When using Google Billing in my app, do all of the necessary methods have to be used in the class that contains the paid content? -

this may little difficult explain bare me... i'm following google in-app purchases tutorial very vague in of instructions. have class (let's sound.java) contains sound files can played after user purchases them, considering how many lines of code required google connect billing services, need in 1 class, sound.java or can preload of methods in startup class?

android - how to check if webview URL contains a string? -

i trying make app share valid url only, else show toast. checking if url contains particular string. if yes, share link, however, getting exception- public void sharevideo() { string url = webview.geturl(); if (url.contains("play;_ylt=")) { // video_is_being_played intent shareintent = new intent(intent.action_send); shareintent.settype("text/plain"); shareintent.putextra(intent.extra_text, url); startactivity(intent.createchooser(shareintent, "share...")); } else { toast.maketext(getbasecontext(), "cannot share this", toast.length_long).show(); } } logs included- 06-11 06:54:08.120: e/inputeventreceiver(9116): exception dispatching in

php - Blocking google adsense code in theme: Why isn't this working? -

i've added header.php in wordpress... <?php // block google adsense on these post id's?> <?php global $ad_flg; $ad_flg=1; ?> <?php $adsense_blck_post = array(7130, 7151); ?> <?php if (in_array($post->id,$adsense_blck_post,true)) $ad_flg=0; ?> <?php // stop blocking google adsense on these post id's?> then, block individual ad spots, i've implemented code around ad code. global $ad_flag; if($ad_flag!=0) { echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'post_style_12')); } however, when add in example, it's not working. can tell me i'm doing wrong? //add top ad global $ad_flag; if (td_util::is_ad_spot_enabled('content_top') , is_single() , $ad_flag!=0) { $content = td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_top')) . $content; }

javascript - Get index of jquery object within another jquery object -

suppose <div class='foo' id='a'></div> <div class='foo' id='b'></div> <div class='foo' id='c'></div> var foos = $('.foo'); we can first foo if want var myfoo = $(foos.get(0)); now have myfoo , how can opposite index? var index = foos.getindexof(myfoo); use .index( element ) if .index() called on collection of elements , dom element or jquery object passed in, .index() returns integer indicating position of passed element relative original collection. var foos = $('.foo'); var myfoo = $(foos.get(0)); console.log(foos.index(myfoo)); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <div class='foo' id='a'></div> <div class='foo' id='b'></div> <div class='foo' id='c'></div>

php - How to turn variable feed to array? -

i want turn variable array can store more 1 feed? <?php error_reporting(0); $feed_lifehacker_full = simplexml_load_file('http://feeds.gawker.com/lifehacker/full'); $xml = $feed_lifehacker_full; //print_r($xml); foreach ($xml->channel->item $node){ $title = $node->title; $link = $node->link; $link = explode('/', $link); $link = $link[8]; $url = $node->url; $description = $node->description; $pubdate = $node->pubdate; preg_match_all('#(http://img[^\s]+(?=\.(jpe?g|png|gif)))#i', $description[0], $images); $images = $images[0][1] . '.jpg'; if($images == '.jpg'){ //uncomment show youtube articles //$images = "http://placehold.it/640x360"; //echo "<a href='page2.php?a=$link' title='$title'><img src='$images' /></a><br>"; } else { //article image $images . '<br>'; echo "<a href='page2.php?a=$link

python - naming of Django Foreign Keys in order to request correct column -

i'm using django (i'm new it). want define foreign key, , i'm not sure how go it. i have table called stat_types: class stattypes(models.model): stat_type = models.charfield(max_length=20) now want define foreign key in overall_stats table stat_type id automatically generated django. following? stat_types_id = models.foreignkey('beta.stattypes') what if wanted instead have stat_type column of stat_types table foreign key. be: stat_type = models.foreignkey('beta.stattypes') i guess confusion arises in not knowing name column in second model, in order know column of first model use foreign key. thanks! it not matter name give fk column name. django figures out foreignkey , appends _id field. not need _id here. think enough stat_type = models.foreignkey('beta.stattypes') doc says : it’s suggested, not required, name of foreignkey field (manufacturer in example above) name of model, lowercase. can, of c

osx - Docker for Mac Beta: Unable to link containers properly -

i have tried linking 2 containers , executing commands valid on 1 other works in docker toolbox version of tool. copy of yml file: version: '2' services: nginx: image: nginx:latest hostname: nginx links: - php ports: - "8000:80" privileged: true php: image: php:5-fpm hostname: php privileged: true i expect able log onto nginx container , able execute php i.e. php -version. docker exec -it test2_nginx_1 bash root@nginx:/# ping php ping php (172.19.0.2): 56 data bytes 64 bytes 172.19.0.2: icmp_seq=0 ttl=64 time=0.103 ms 64 bytes 172.19.0.2: icmp_seq=1 ttl=64 time=0.089 ms ping works! root@nginx:/# php -version bash: php: command not found this not work. logging on php container: docker exec -it test2_php_1 bash root@php:/var/www/html# php -version php 5.6.22 (cli) (built: jun 8 2016 17:49:08) copyright (c) 1997-2016 php group zend engine v2.6.0, copyright (c) 1998-2016 zend technologies why not a

c# - Comparison time- Single Threads vs Multiple Threads differing in results -

Image
i wrote code in purpose test multi , single threading speeds. feedback! rewrote of based on great comments received. functions (maybe has bug here or there), tests multi threads first, , takes average find more accurate speed: (scroll bottom cont.) main method class using system; namespace singleandmultithreading { internal class threads { private static void main(string[] args) { long numofobjcreated; int numberoftests; while (true) { try { console.write("number of objects create: "); numofobjcreated = convert.toint64(console.readline()); break; } catch (exception) { console.writeline("invalid input."); } } while (true) { try { console.write("number of tests run: "); numberoftests = convert.

hadoop - 50-60 gb of data in spark standalone mode -

i trying analyze around 50-60 gb of data. thought of using spark that, not have access multiple nodes in cluster. can level of processing done using spark standalone mode ? if yes, know estimated time required process data.thanks! short answer: yes. spark partition file in many smaller chunks. in case few chunks executed @ time. these few chunks should fit in memory (you need play configurations right) to summarize, able it, faster if had more memory/cores can processes more things in parallel.

ios - NSInternalInconsistencyException : must register a nib or a class for the identifier or connect a prototype cell in a storyboard -

Image
i know question being asked many times i've gone through questions not able figure out whats wrong in case my error message : terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'unable dequeue cell identifier postcell - must register nib or class identifier or connect prototype cell in storyboard' *** first throw call stack: (0x1823f6db0 0x181a5bf80 0x1823f6c80 0x182d7c154 0x1876ddbf0 0x193b51ccc 0x10009b474 0x10009b50c 0x1878ab030 0x1878ab198 0x18789a298 0x1878afc64 0x1876408c4 0x1875501e4 0x184ee2994 0x184edd5d0 0x184edd490 0x184edcac0 0x184edc820 0x187552ff4 0x1823ad09c 0x1823acb30 0x1823aa830 0x1822d4c50 0x183bbc088 0x1875be088 0x10009aefc 0x181e728b8) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb) here's tableview 5 static cells can see cell's identifier set postcell , assigned class tableviewcell tableviewcell class : class tableviewcell: uitableviewcell { overr

driver - Unable to create hotspot -

i using software mhotspot on windows 10,so can create hotspot laptop,and working nicely. few days back,my windows got updated , whenever try create hotspot ,it shows me "driver problem found !" . may reson suspect went wrong after updation of windows. have tried every action retrieve hotspot,but no use. surely missing crucial delicated fact. me please? know topic bit odd. needed badly , believe can best site. you can create hotspot using cmd. give try. source: create hotspot in windows 10 using cmd

matlab - Execute 3 functions in parallel on 3 workers -

i've got 3 functions ( qrcalc , zcalc , pcalc ) 3 unique set of inputs want run in parallel. attempt doesn't work: function [outall]=parallelfunc(in1,in2,in3) if parpool('size') == 0 % checking see if pool open a=feature('numcores'); parpool('local',a); else parpool close a=feature('numcores'); parpool('local',a); end spmd if labindex==2 out1=qrcalc(in1); elseif labindex==3 out2=zcalc(in2); elseif labindex==4 out3=pcalc(in3); end outall=[out1;out2;out3]; end error: error using parallelattempt>(spmd body) (line 20) error detected on worker 3. undefinedfunction error thrown on workers 'out1'. may because file containing 'out1' not accessible on workers. specify required files parallel pool using command: addattachedfiles(pool, ...). see documentation parpool more details. error in parallelattempt>(spmd) (line 11) spmd

javascript - How can I change playBackrate? -

i've read this document controlling playback rate. coded in order to implement. however, seems not working. what's wrong code? <script type="text/javascript"> var params = { allowscriptaccess: "always" }; var atts = { id: "myytplayer" }; swfobject.embedswf("http://www.youtube.com/e/nqd6wx3hxzy?enablejsapi=1&playerapiid=ytplayer", "ytapiplayer", "480", "270", "8", null, null, params, atts); function onyoutubeplayerready(playerid) { ytplayer = document.getelementbyid("myytplayer"); timerid = setinterval("getstatus()", 1); } </script> <div id="ytapiplayer">...loading</div> the button change playbackrate <button onclick="ytplayer.setplaybackrate(2)">playbackrate+=0.1</button> <button onclick="ytplayer.setplaybackrate(0.25)">playb

sql - PHP script returns no result -

i have script try date database. the script needs show: date in database (date). click here continue. when run sql query in phpmyadmin, sql query returns date. when run in script no result. here script: <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "db"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "set lc_time_names = 'nl_nl';"; $sql = "select date_format(date, '%e %m %y') date table id='1'"; $result = $conn->multi_query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "the date in database is:"; echo " " . $row['date'] . ". "; echo "click here continue

Django: Using Class Based Views How Do I create a form that uses two models? -

i'm using class based generic views because presented in django official tutorial. have 2 related models: class client(models.model): first_name = models.charfield(max_length=40) last_name = models.charfield(max_length=40) email = models.emailfield phone_regex = regexvalidator(regex=r'^\+?1?\d{9,15}$', message="phone number must entered in format: '+999999999'. 15 digits allowed.") phone_number = models.charfield(validators=[phone_regex], blank=true, max_length=15) # validators should list def __str__(self): return self.first_name + self.last_name class clientaddress(models.model): client = models.foreignkey(client, on_delete=models.cascade) street = models.textfield() city = models.textfield() state = models.textfield() zip_code = models.textfield() i have 1 view creating new client object: class clientcreateview(generic.createview): model = client form_class = clientform s

python - Writing a file after a string -

i want read , write grades(numbers) after subject tag(string). have can't figure out how find tag , write after without replacing numbers after it. so, example, valid input be: mat54324524342211 and have tried far: save = open("grades.txt", "w") def add(x, y): z = x / y * 100 return z def calc_grade(perc): if perc < 50: return "1" if perc < 60: return "2" if perc < 75: return "3" if perc < 90: return "4" if perc >= 90: return "5" def calc_command(): num1 = input("input points: ") num2 = input("input maximum points: ") num3 = add(float(num1), float(num2)) grade = calc_grade(num3) print("this result:", str(num3) + "%") print("your grade:", grade) save.write(grade) while true: command = input("input command: ") if command

ios - Swift - How dynamically fixed UITableViewHeaderFooterView height size? -

i have tried below lines of code, doesn't work correctly. wonder how can provide case header or footer programmatically, may using autolayout don't know 1 solved problem. i'm using xib file both of uitableviewheaderfooterview. if explain great. override func viewdidlayoutsubviews() { super.viewdidlayoutsubviews() // dynamic sizing footer view if let footerview = tableview.tablefooterview { let height = footerview.systemlayoutsizefittingsize(uilayoutfittingcompressedsize).height var footerframe = footerview.frame if height != footerframe.size.height { footerframe.size.height = height footerview.frame = footerframe tableview.tablefooterview = footerview } } } the uitableview calculates headerfooter before displayed, can't update height without calling reloaddata() again. have tried use autolayout on headerfooterviews? set view xib right constraint, , then: self.tabl

how to i print session on view page in zend framework -

i new zend framework, , going add session in small application dont know how print session variable header.phtml page. userstable.php public function fetchbywhere($where) { $rowset = $this->tablegateway->select($where); $row = $rowset->current(); if (!$row) { return; } return $row; } indexcontroller.php <?php namespace application\controller; use zend\mvc\controller\abstractactioncontroller; use zend\view\model\viewmodel; use application\model\users; // <-- add import use zend\session\container; // need when using sessions class indexcontroller extends abstractactioncontroller { protected $userstable; public function getuserstable() { if (!$this->userstable) { $sm = $this->getservicelocator(); $this->userstable = $sm->get('application\model\userstable'); } return $this->userstable; } public function

Recursion - if there is continuity of numbers in java -

i have exercise error , love on error , how fix exercise. write recursive function receives set of numbers , number between 9-1. function returns true if there continuity of numbers 1 number, otherwise returns false. it brings me true, there no error. examples: for array 3,1,2,3,4,6,3 , number 4 returned true for array 3,1,2,1,2,3,5 , number 4 returned false the code: public static boolean continuityofnumbers(int[] arr, int n) { int counter = 0; int index = arr.length - 1; if (n == 0) return true; if (arr[index] - 1 == arr[index - 1]) counter += 1; index--; return continuityofnumbers(arr, n - 1); } here o(n) runtime , storage complexity solution. makes boolean continuity array , checks , end of recursion. don't copy-paste it, make sure read comments in code see logic is, , make sure understand it. it additionally pre-validation checks make sure n contained , reachable in array

Visual Studio 2015, cordova project, apk build cannot be installed on Android Device -

strange issue! visual studio comunity 2015 update 2 no longer builds installable apk's. when try install apk (for testing purposes) on android device (and i've tested on 3 different phones) error: there error parsing package. when building project ok, apk file apears in release folder. name of file android-release-unsigned.apk i think it's setting in environment wich prevents apk's installed on device. i tried new, empty cordova project , have same issue. in emulators apps running well. any ideas? i guess cant install unsigned apk's in release folder. if release must sign apk 1st. , other thing is, if testing purpose may go debug apk. should work. luck

html - Fade out of a Mp3 song using javascript -

i'm trying create html file javascript embedded allows me press button , begin fade out of song. i've managed working play song (which start). i've been playing around second function try , reduce volume , setting delay on function can please ?! <audio id="myaudio" <source src="1.mp3" type='audio/mp4'> </audio> <button type="button" onclick="aud_play()">play</button> <button type="button" onclick="aud_fade()">fade</button> <script> var vol = myaudio.volume; var timer; function aud_play() { var myaudio = document.getelementbyid("myaudio"); myaudio.play(); } function aud_fade(){ var myaudio = document.getelementbyid("myaudio"); if (vol > 0) { vol = vol - 0.2 ; } timer = settimeout(aud_fade,2); } </script> a couple things seem need addressing ;) first off, in example provided, have not closed aud

string - Python: is isalnum() the same as isalpha with isdigit? -

is there way concretely verify this? tried solve coding question seems 1 of test cases (not revealed me) takes wrong. in kinds of cases fail true? there cases when both isalpha , isdigit returns false , isalnum returns true . isalnum not combination of other two. >>> 'a1'.isalpha(), 'a1'.isdigit(), 'a1'.isalnum() (false, false, true)

javascript - parsley.js validation with jquery.inputmask plugin -

stuck bit 1 sort of problem. can't validate fields of form using parsleyjs , jquery.inputmask i have several fields input mask , want validate when mask filled in , have group of fields should validated when each group of fields filled in either. , pay attention phone field works need (the error disappeared when digits inside mask) not sure, think single fields simplest decision add minlength fields doesn't work, don't know why. groups of fields have no idea how handle it. i've put code below , link jsfiddle. and here jsfiddle demonstate code https://jsfiddle.net/su3f74cc/32/ html: <form action="" class="form form-style1 create-account"> <fieldset class="form__step"> <p class="form__wrap"> <label for="">phone</label> <input type="text" class="form__input" data-type="phone" data-parsley-pattern="^[\d\+\-

jquery - I am trying to create pie chart using highcharts in SharePoint 2010 Visual Web Part.Not working with default document model of IE 11 -

this link has code: http://jsfiddle.net/agc0fuyk/18/ works fine when : run in jsfiddle (chrome ie 11.0.96). run in visual studio asp.net html page (chrome ie 11.0.96). fails when : run in sharepoint 2010 visual web part(visual studio 2010) now when open f12 developer tool's emulation tab ie window, document mode set 5 default, when change document mode 10, can see page/chart loaded properly. at sharepoint page have added meta tag : <meta http-equiv="content-type" content="text/html; charset=utf-8"> also added javascript remove indexof error in ie reference indexof not function in firefox, opera works in ie, indexof alternative in javascript test string contains? please me run in ie. got solution problem adding following lines in "page_load" of web-part: htmlmeta metaedgeie = new htmlmeta(); metaedgeie.httpequiv = "x-ua-compatible"; metaedgeie.content = "ie=edge"; page.header.con

infinite scroll - gtkmm Gtk::Layout negative child position not setting its absolute position -

Image
the description of gtk::layout says infinite scrollable area containing child widgets and/or custom drawing i put gtk::layout inside gtk::scrolledwindow , gave gtk::layout size of 400x400 , placed gtk::button @ (450, 450), scrollbars appeared until scrolled window resized 400x400, not (450+button-width x 450+button-height). had move bottom-right corner of layout connecting handler button's signal_size_allocate() signal , manually call gtk::layout::set_size() function resize button's boundary. scrolled window shows scrollbars reach button. ok. class layoutwindowtest : public applicationwindow { scrolledwindow sw; layout l; button b; public: layoutwindowtest() : l(), b("test") { set_title("layout test"); set_size_request(400, 400); sw.set_hadjustment(l.get_hadjustment()); sw.set_vadjustment(l.get_vadjustment()); l.set_size(400, 400); sw.add(l); add(sw); /

string - Insert text in the middle of column names in R -

i insert string "_2010_" after . in colnames of data.frame data("iris") > names(iris) [1] "sepal.length" "sepal.width" "petal.length" "petal.width" "species" desired output : [1] "sepal._2010_length" "sepal._2010_width" "petal._2010_length" "petal._2010_width" "species" help ? edit: related question: how insert string "_2010_" before . ? [1] "sepal_2010_.length" "sepal_2010_.width" "petal_2010_.length" "petal_2010_.width" "species" we can use sub , on names of 'iris' has . (by subsetting grep ). here, use capture groups ( (...) ) , replace backreferences ( \\1 ) along newly added substrings ( _2010_ ). i1 <- grep("[.]", names(iris)) name(iris)[i1] <- sub("([^.]+.)(.*)", "\\1_2010_\\2", names(iris)[i1]) or usi