Posts

Showing posts from June, 2012

jpa - EntityManager.createNamedQuery(...) doesn't work -

i have defined namednativequery next lot of namedqueries . namedqueries entitymanager.createnamedquery(queryname) works when using namednativequery exception: java.lang.illegalargumentexception: namedquery of name: mynamednativequeryname not found. the query works executed in mysql workbench defining namednativequery: @namednativequeries(value = { @namednativequery(name = findvehicletracksbyuuidandtimerange, query="...", resultclass=mytype.class) }) the exception occurs. try run query way: try { list<e> resultlist = new arraylist<e>(); javax.persistence.query query = getentitymanager().createnamedquery(queryname, type); } catch(...) what can reason? stated: code above runs dozens of namedqueries...but not namednativequery.

ruby - How to test protect_from_forgery with: :exception rails -

i using protect_from_forgery with: :exception in application. seems work fine want test it. i have form. understand every form has authenticity token related while using protect_from_forgery , want create situation when authenticity token not pass , throws exception. want see how browser respond exception. how able that? several ways this: the authenticity token part of form data: edit page alter / remove these , form submission should result in exception. ajax submitted forms can csrf meta tags in head portion of page - may wish alter these to. create standalone html page (outside of app) contains form posting action want test the authenticity token stored in session, after form has been displayed hit url in browser tab / session calls reset_session . submit form - should fail.

d3.js - D3 Tree Brushing -

i trying brush vertical tree layout. selections not working. please me respect selection of classed node. new d3 , not able understand this. here style sheet .node { stroke: black; stroke-width: 1px; } .node .selected { stroke: red; } .node text { font: 10px sans-serif; } .link { fill: none; stroke: #ccc; stroke-width: 1px; } .brush .extent { fill-opacity: .1; stroke: #fff; shape-rendering: crispedges; here code var margin = {top: 140, right: 120, bottom: 20, left: 120}, width = 960 - margin.right - margin.left, height = 500 - margin.top - margin.bottom; var = 0; var tree = d3.layout.tree() .size([height, width]); var diagonal = d3.svg.diagonal() .projection(function(d) { return [d.x, d.y]; }); var svg = d3.select("body").append("svg") .attr("width", width + margin.right + margin.left) .attr("heig...

Add animation to default marker on setOnMarkerClickListener maps api v2 android -

i developing android app, have fragment containing mapview... mapview containing markers according locations in local database.. there way animate or change colour of clicked marker? mean have done in setonmarkerclicklistener, but, when click on marker, previous marker still in same color/animation... adding main part of code below... string mypath = db_path + db_name; mydatabase = sqlitedatabase.opendatabase(mypath, null, sqlitedatabase.open_readwrite); cursor c = mydatabase.rawquery("select * location", null); if (c != null) { if (c.movetofirst()) { { id = c.getint(0); if (userprefs.getstring("locale",null)==null || userprefs.getstring("locale",null).equals("en")) { storename = c.getstring(1); } else { storename = c.getstring(7); } stlatitude = c.getdouble...

php - Laravel eager loading sort by relationship -

i have relationships (that can explain correctly) , need sort output distant relation. i have pivot table contains details many of relations, including that want sort by. --user.php public function players() { return $this->belongstomany('app\models\player', 'league_player_user')->withpivot('position_id'); } --player.php public function position() { return $this->belongstomany('app\models\position', 'league_player_user'); } i eager loading relationship so; $user = user::with('players')->where('id', auth::user()->id)->first(); so, think want (does not work). $user = user::with(['players' => function($q){ $q->orderby('position.sort_id', 'asc'); }])->where('id', auth::user()->id)->first(); the pivotal table structure looks little this; league_player_user. ...league_id ...player_id ...user_id ...position_id the positions table cont...

http headers - Make MP3 seekable in php -

i using below code mp3 file via php. problem mp3 code produces not seeking. @$filename = $_get['q'].'.mp3'; if(file_exists($filename)){ header("content-type: audio/mpeg"); header('content-length: ' . filesize($filename)); header('content-disposition: filename="' . $filename); header('x-pad: avoid browser bug'); header('cache-control: no-cache'); header('accept-ranges: bytes'); readfile($filename); }else{ header("http/1.0 404 not found"); } it becomes headache find proper header or solution make possible seek mp3. thanks in advance. try this: header('content-disposition:inline; filename="' . $filename . '"');

css for checkbox while hover -

i wanna change color each checkbox while hover.i have 4 checkbox.i wanna change color, if hover 'all' checkbox shows red,blue color 'cold',orange 'warm' , green 'active'. #ck-button { margin: 0px; background-color: #efefef; border-radius: 4px; border: 1px solid #d0d0d0; overflow: auto; float: left; } #ck-button label { float: left; width: 4.0em; } #ck-button label span { text-align: center; padding: 3px 0px; display: block; border-radius: 4px; } #ck-button label input { position: absolute; top: -20px; } input:checked +span { background-color: #911; color: #fff; } #ck-button input:hover #all + span { background-color: #efe0e0; } #ck-button input:hover #o1 + span { background-color: blue; } #ck-button input:hover #o2 + span { background-color: orange; } #ck-button input:hover #o3 + span { background-color: green; } <div id="ck-button"> <label>...

Access file parameter in jenkins -

i'm working on multiconfiguration job( regression_l1 ) in jenkins task run 2 kinds of tests( test1 , test2 ). in multiconfiguration job, triggers executor job( regression_executor ) run script selected test. regression_l1 job restricted run in matrix_service_jobs node, while matrix jobs run in slave node custom_matrix_service_jobs node. regression_executor job restricted run in remote machines specific label(rl1_test_machine). my goal test custom build developers. , added file parameter(config - file location: custombuild/mybuild.zip ) job. question how can access uploaded file? some important info: regression_executor's workspace: /home/regressionexec/ regression_l1's workspace: /var/work/matrix_service_jobs/regression_l1 regression_l1 matrix workspaces: /var/work/workspace_user_matrix/workspace/regression_l1/test_phase/test1/label/custom_matrix_service_jobs/ , /var/work/workspace_user_matrix/workspace/regression_l1/test_phase/test2/label/custom_matrix_s...

c# - Using tuespechkin with MVC project in Azure -

i can't manage pechkin or tuespechkin work on azure site. whenever try access site hangs no error message (even customerrors off). there further setup i'm missing? works locally. for 64 bit app i'm completing following steps: create new empty mvc app azure, make sure host in cloud selected change app 64 bit log onto azure portal , upgrade app basic hosting , change 64 bit install tuespechkin.wkhtmltox.win64 , tuespechkin nuget packages add singleton class return iconverter public class tuespechkinconverter { private static iconverter converter; public static iconverter converter { { if (converter == null) { converter = new threadsafeconverter( new pdftoolset( new win64embeddeddeployment( new tempfolderdeployment()))); } return converter; } } } add home controller following code in index action: var document = new htmltopdfdocument { ...

clojure - Leiningen is missing its dependencies. (On Windows) -

i'm trying install leiningen on windows 7. here steps: step 1. download: cd c:\application_bin\ git clone git@github.com:technomancy/leiningen.git step 2. add c:\application_bin\leiningen\bin system path. step 3. run: ps c:\users\nick> lein repl leiningen missing dependencies. please run "lein bootstrap" in leiningen-core/ directory stable release of leiningen. see contributing.md details. i don't know missing, follow instruction error message: cd c:\application_bin\leiningen\leiningen-core lein bootstrap leiningen missing dependencies. please run "lein bootstrap" in leiningen-core/ directory stable release of leiningen. see contributing.md details. the error comes again. what's wrong installation steps? dependencies missing? i've found solution here: http://onoffswit...

Issues in Merging local and remote files using WinMerge command in WinSCP -

i using winscp , added win-merge command "c:\program files\winmerge\winmergeu.exe" /dr "!@:!/" "!^!" "!" to merge both local , remote files easily. but, once merged , saved changes using feature, first time shows 2 files identical. later, when try open these 2 files again, seems saved changes didn't affect remote files. can suggest why can't save changes remote files once merge them? you should upgrade winscp latest versions preferably newer 5.7 solve problem files mean if comparing files , change in remote file take effect problem facing older winscp versions still having similar problem folder compare mean if compare 2 folders , make change in remote file next time change gone works if comparing files only

swift - How can I call this function in viewDidLoad() in iOS8 -

i want call function in viewdidload don't know how 1 this. can please me? func loginwithfacebook(withcompletionhandler: (success:bool) ->()){ var permissions : array = [ "user_location","public_profile"] pffacebookutils.logininbackgroundwithreadpermissions(permissions, { (user: pfuser?, error: nserror?) -> void in if let user = user { if user.isnew { println("user signed , logged in through facebook!") self.fetchuserinforfromfacebook(withcompletionhandler) println("user logged in through facebook!") withcompletionhandler(success: true) } } else { println("uh oh. user cancelled facebook login.") self.showerrormessage(error!) withcompletionhandler(success: false) } }) } override...

javascript - how to toggle the same object for different object? -

actually dont know how express problem. you can see fiddle come know problem. as can see in fiddle when clicking on first image pop appears when clicking on other image popup hides ..i know togggling effect to if want when click on second image first toggle should on other should start? my code <div id='player-back'> <img src='http://s6.postimg.org/su0e7812l/player1.png' data-playerid="1" id='p1'/> <img src='http://s6.postimg.org/afpv38orx/player2.png' data-playerid="2" id='p2'/> <img src='http://s6.postimg.org/h7ga63drh/player3.png' data-playerid="3" id='p3'/> <div id='player-popup' style="display:none"> <span>player1</span> </div> </div> $("img").click(function(){ var top = $(this).offset().top + $(this).width() + 2; var left = $(this).offset().left - $(this...

Facebook page id assignment -

how page id of facebook page assigned? different across different apps? trying build app requires pages liked user. purpose , page ids stored in database.we not want same page in database twice only user ids app scoped, page ids same. @ least @ moment, of course it´s possible facebook changes in future.

What's the meaning of the "Stages" on Spark UI for Streaming Scenarios -

Image
i'm working on spark streaming , trying monitor , improve performance streaming apps. i'm confusing following questions. what's meaning each stages on spark portal "spark streaming" apps. not "transformation" mapped tasks. , how target "transformation" mapped tasks. streaming code snapshot : val transformed = input.flatmap(i => processinput(i)) val aggregated = transformed.reducebykeyandwindow(reduce(_, _), seconds(aggregatewindowsizeinseconds), seconds(slidingintervalinseconds)) val finalized = aggregated.mapvalues(finalize(_)) finalized (only flatmap stages occurred on portal.) spark streaming portal thanks, tao spark takes individual commands source , optimizes plan of tasks executed on cluster. 1 example of 1 such optimization map-fusion : 2 calls map come in, 1 single map task comes out. stage higher-level boundary between groups of tasks, defined such cross boundary have perform shuffle. so: ea...

user interface - How can I align items in menu bar from right to left with using python 3 and tkinter module? -

i'm using python 3 , tkinter module creating gui. need create menu bar , align items on right left (i want use persian language need align menu items right left), have used code didn't aligned file , edit items right left , still align left right in menubar. how can deal it? from tkinter import * tkinter import ttk root = tk() root.title('create menu bar , items') root.geometry('300x300+100+50') root.option_add('*tearoff', false) menubar = menu(root) root.config(menu = menubar) file = menu(menubar) edit = menu(menubar) menubar.add_cascade(menu = file, label = 'فایل',compound = right) menubar.add_cascade(menu = edit, label = 'ویرایش',compound = right) use simple trick, create blank menu between itens ;-) blankmenu = menu(menubar, tearoff=0) menubar.add_cascade(label="".ljust(130), menu=blankmenu)

Converting image datatype from Sql Server to php -

i'm trying show image saved sql server database php page creating. i've done far necessary data database, image , , image type(if jpg). this did: $idata = base64_decode($imageresult); imagejpeg($idata); but showing error of following: imagejpeg() expects parameter 1 resource, string given [app\controller\maincontroller.php, line 226] how make image show inside php? need decode data i'm getting database before convert it? i want give example data have sensitive, why don't know how give example. use imagecreatefromstring function: http://www.php.net/manual/en/function.imagecreatefromstring.php $idata = base64_decode($imageresult); $image = imagecreatefromstring($idata) imagejpeg($image);

How to transfer the server logins from SQL Server 2000 to SQL Server 2012 -

i have migrate database sql server 2000 sql server 2012. how transfer server logins sql server 2000 sql server 2012? server logins below server security. run following script on 2000 sql server: use master go if object_id ('sp_hexadecimal') not null drop procedure sp_hexadecimal go create procedure sp_hexadecimal @binvalue varbinary(256), @hexvalue varchar(256) output declare @charvalue varchar(256) declare @i int declare @length int declare @hexstring char(16) select @charvalue = '0x' select @i = 1 select @length = datalength (@binvalue) select @hexstring = '0123456789abcdef' while (@i <= @length) begin declare @tempint int declare @firstint int declare @secondint int select @tempint = convert(int, substring(@binvalue,@i,1)) select @firstint = floor(@tempint/16) select @secondint = @tempint - (@firstint*16) select @charvalue = @charvalue + substring(@hexstring, @firstint+1, 1) + substring(@hexstring, @secondint+1, 1)...

batch processing - Take extremely long time in kettle pentaho job -

Image
good day, i have kettle pentaho file run batch job. basically, files contain of 2 main steps, first step, read input file ( txt file) , store inside table1 . second step, same first step, read same input file , store inside table2 . this batch working fine until put in 20mb input file.it require more 7hours finish job. below test case have done: 15360 records, 1.4mb, 2 minutes , 20 seconds (140 seconds total). 30720 records, 2.8mb , 7 minutes , 30 seconds (450 seconds total) 61440 records, 5.5mb, 26 minutes , 55 seconds (1615 seconds total). 250000 records, 20mb, 7 hours , 30 minutes in log, found there steps occupied of time consuming. follow: 1. text file input. 2. select values. 3. modified java script value. both main steps contain 3 kettle pentaho function. 20mb input file, first step take around 7 minutes, second step take more 7 hours. try @ in quite long time, still cant find out problem. kindly advise. there might multiple reasons (i assume...

c# - Searching database with Linq -

i trying search data in datagrid using code sample below. have had working code looking bit different, going use async in coding , have tried sample below, have no idea how change code work correctly. private async task btnsearchsysprostock_click(object sender, routedeventargs e) { using (dataentities de = new dataentities()) { list<ssdata> stocksearch = await (from in de.tblsysprostocks (a => txtsearchsysprostock.text == string.empty || a.stockcode.contains(txtsearchsysprostock.text)) //the error in line select new ssdata { sid = a.stockid, scode = a.stockcode, sdescription = a.stockdescription, sconvfactaltuom = (float)a.convfactaltuom, ... }).tolistasync(); dgsysprostock.itemssource = stocksearch; } } i getting following error: cannot co...

entity framework 6 - Inserting or adding a string to a database table using linq to SQL and EF6? -

i'm trying learn linq sql , entity framework 6. trying add strings database table. here i've got now: static void main(string[] args) { using (responsesentities db = new responsesentities()) { try { respons res = new respons(); res.extserial = "asdf1234"; res.date = "2015-05-01"; res.filename = @"c:\tae.xml"; res.responsedescription = "ok"; db.responses.add(res); console.writeline("inserted!"); console.readline(); } catch (exception) { console.writeline("tae! error"); } } it runs won't add strings table. you're adding object in-memory store - need persist changes database! db.responses.add(res); db.savechanges(); // write chang...

Oracle trigger updating table in another server -

let's suppose i'm using 2 oracle servers, server , b server, located different nations. have same schema, called a-bay, , table, called user_data. finally, have same table rows because want customers able use both site. so, want use "trigger" updating data in server when customers change personal information in b server, vice versa. what should do? if using mysql, use federated engine can't use in case. moreover, servers don't support golden gate!

python - How to enable path on user environment in eclipse-PyDev -

if ideas how enable pydev(eclipse) enables path or symbolic link call foreign program(programs in /usr/local/bin/) in macos(/linux), please tell me. i want use graphviz via pygraphviz on pydev in eclipse. however, error message occurred such "valueerror: program dot not found in path." or "valueerror: no prog dot in path." i guessed below similar problems of cause may ide(e.g. pydev) not enable paths call foreign command, example, /usr/local/bin/dot. the reason perform graphviz on eclipse in below environment expected. sample code want perform import pygraphviz g=pygraphviz.agraph() g.add_node('a') g.add_edge('b','c') g.layout() g.draw('sample01.png') successed cases in terminal.app, upper sample code perform expected. off course, python same used in eclipe. the same eclipse run in upper terminal.app command "open ~/application/eclipse.app" can performed upper sample code expected. off course, in ...

authentication - Pulling Github archive with Curl and Oauth token -

i want pull source files particular github repository , specific release (tag). i use following command: curl -v -l -o website.tar.gz -h "authorization: token mypersonaltoken" https://github.com/my_org/some_project/archive/0.1.tar.gz but result 406 not acceptable. the token i'm using personal token generated in private account. archive i'm pulling in account, have admin rights. if use: curl -v -l -o website.tar.gz -u myuser:mypassword https://github.com/my_org/some_project/archive/0.1.tar.gz the download succeed. how can download archive without using username , password i experimented way solution: curl -l -u myusername:mypersonaltoken ... the difference use 'personal token' instead of password.

jsf 2 - jsf giving method not found Exception though it is there, javax.el.MethodNotFoundException -

i m getting following exception when trying display h:datatable using backing bean javax.faces.el.methodnotfoundexception: javax.el.methodnotfoundexception: /table.xhtml @29,36 action="#{user.editemployee}": method not found: com.jason.jsf.user@1df228e.editemployee() javax.faces.component.methodbindingmethodexpressionadapter.invoke(methodbindingmethodexpressionadapter.java:88) com.sun.faces.application.actionlistenerimpl.processaction(actionlistenerimpl.java:98) javax.faces.component.uicommand.broadcast(uicommand.java:311) javax.faces.component.uidata.broadcast(uidata.java:912) javax.faces.component.uiviewroot.broadcastevents(uiviewroot.java:781) javax.faces.component.uiviewroot.processapplication(uiviewroot.java:1246) com.sun.faces.lifecycle.invokeapplicationphase.execute(invokeapplicationphase.java:77) com.sun.faces.lifecycle.phase.dophase(phase.java:97) com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:114) javax.faces.webapp.facesservlet.service(face...

cuda - How many cores/threads does cublas_sgemm uses? -

i new gpu , parallel programming . want execute function 'a' parallel-ly on different data x1,x2,x3.... 'a' calls function 'cublas_sgemm' . then whether or not have care implementation of cublas_sgemm ? you don't need concerned implementation of cublassgemm. use of device possible problem size. reasonably large matrices, utilize whole device. function utilizes whole device, you're not observe improvement in performance trying add additional parallelism (vs. issuing gemm functions in sequence, appropriate use of overlap of copy , compute). for small matrices, there batched gemm function should better trying manage parallelism yourself.

multithreading in python not working as expected -

import threading import time def test1(): print "hello" time.sleep(15) print "hello2" def test2(): print "hi" th1 =threading.thread(test1()) th2 =threading.thread(test2()) p=[th1,th2] in p: i.start() in p: i.join() i not sure if right, please correct me if not. expecting output printed in order hello hi , hello2. expecting 2 threads created run parallely . getting below output, hello hello2 , hi. thread2 running after completion of thread1. doing wrong? or understanding or threading wrong? you need pass function reference thread() class constructor takes "keyword argument" called target ( default: none ). passing result of function call ( such you've done ) have undesired behaviour since first argument thread() group=none . example: ( corrected ) import threading import time def test1(): print "hello" time.sleep(15) print "hello2" def test2(): print "hi" ...

how to display json data dynamically in my listview in intel xdk -

i developing hybrid application using intel xdk , jquery mobile framework ui. have json data, trying display json data in listview don't know how display json data in listview this json data { "nl_wu":[ { "id":"42", "year":"2015", "month":"jan", "title":"newsletter", "file":"http://school.com/sample.pdf" }, { "id":"39", "year":"2015", "month":"jan", "title":"imagetest", "file":"http://school.com/sampleimage.jpg" } ] } i trying above json data url using function function showsmsmessage(){ var i; var out =""; ...

qt - OnDemand images are missing (http://www.flipkart.com and www.cnn.com) -

Image
i trying convert below mentioned website pdf, ondemand images missing in converted pdf. can please let me know, tweaks or tricks acquire images in output pdf. tried giving javascript delay http://www.cnn.com http://www.flipkart.com command line - wkhtmltopdf.exe http://www.cnn.com/ g:/test/wkhtmlcnn.pdf wkhtml version - wkhtmltopdf 0.12.2.1 (with patched qt) os , version - windows 8.1 thanks in advance. achieved changing viewport values of wkhtml option

java - Buiding Hadoop with Eclipse / Maven - Missing artifact jdk.tools:jdk.tools:jar:1.6 -

i trying import cloudera's org.apache.hadoop:hadoop-client:2.0.0-cdh4.0.0 from cdh4 maven repo in maven project in eclipse 3.81, m2e plugin, oracle's jdk 1.7.0_05 on win7 using <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-client</artifactid> <version>2.0.0-cdh4.0.0</version> </dependency> however, following error: the container 'maven dependencies' references non existing library 'c:\users\myuserid\.m2\repository\jdk\tools\jdk.tools\1.6\jdk.tools-1.6.jar' more specific, maven states following artifact missing missing artifact jdk.tools:jdk.tools:jar:1.6 how solve this? jdk.tools:jdk.tools (or com.sun:tools , or whatever name it) jar file distributed jdk. add maven projects this: <dependency> <groupid>jdk.tools</groupid> <artifactid>jdk.tools</artifactid> <scope>system</scope> <systempath...

email - Kentico 8 SMTP Server Settings -

Image
currently have installation on kentico 8. i'm trying configure smtp server , can't seem find settings implicitly set port , encryption type. is possible? when hovering on helper tooltip keeps telling me can add more on advanced smtp server settings. so question is can implicitly set port , encryption type? where advanced smtp server settings located? port should entered part of smtp server name (or ip). doubt can set encryption type somewhere. advanced smtp settings can found in applications: check out documentation .

c# 4.0 - The name 'InitializeComponent()' does not exist in the current context (c#, emgucv) -

i trying run code using c# , emgucv draw histogram image keeps giving me error 'the name 'initializecomponent()' not exist in current context'. tried add references not working. using zedgraph; using system; using system.linq; using system.text; using system.drawing; using system.runtime.interopservices; using emgu.cv; using emgu.cv.cvenum; using emgu.cv.ui; using emgu.util; using emgu.cv.structure; using system.windows.forms; using system.componentmodel; using system.data; using system.io; using system.windows.markup; using system.windows; using system.windows.input; using system.windows.threading; using system.xaml; using system.xml; ; namespace my_emgu_program { public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { openfiledialog openfile = new openfiledialog(); if (openfile.showdialog() == dialogresult.ok) { image<...

Organizing pipeline in MIPS -

i'm unsure how following properties affect pipeline execution 5 stage mips design (if, id, ex, mem, wb). need clearing up. only 1 memory port no data fowarding. branch stalls until end of * stage does 1 memory port mean cannot fetch or write when read/write mem (i.e. mem stage on lw,sw can't enter if or mem)? no forwarding means instruction won't enter id stage until after or on wb stage previous instruction depends on? idk branch stall means a common assumption can write in first half of cycle, , read in second half of cycle. lets i1 first instruction , i2 second instruction, , i2 using register i1 modifying. only 1 memory port . means cannot read or write memory @ same time in 2 different stages of pipelines. instance, if i1 @ mem stage, instruction cannot @ if stage @ same time, because both require memory access. no data forwarding. data forwarding reflects fact @ end of ex stage i1 , forward data id cycle of i2 . consequently,...

How do you reset App Engine's appcfg authentication state? -

i want appengine's appcfg.py forget authentication state can login different account. how do this? remove .appcfg_oauth2_tokens , .appcfg_cookies files in home directory. i.e. rm ~/.appcfg_oauth2_tokens rm ~/.appcfg_cookies

video.js - Video JS - Change Play Icon in ControlBar with Replay Icon After Video End -

Image
i have videojs player. want chage play icon in controlbar replay icon when video has end. can see youtube player : this code : <script> videojs("my_video_1").ready(function(){ var vid = this; vid.on("ended", function(){ alert ("i want change play icon in cotrolbar replay icon"); // dont know chage play icon when video finish }); }); this full code. can run via jsbin: http://jsbin.com/fijefi/2/ thank you you don't need javascript this. can change play icon via css. in default less file there 2 states play button: .vjs-default-skin .vjs-play-control:before { content: @play-icon; } .vjs-default-skin.vjs-playing .vjs-play-control:before { content: @pause-icon; } you need add third state when video has ended. there css class that. you'll end looks like: .vjs-default-skin.vjs-ended .vjs-play-control:before { content: "your reply icon"; }

arrays - How to create sublists from a single list in JavaScript using a delimiter -

essentially want port solution for: python spliting list based on delimiter word javascript. given: var example = ['a', 'word', 'b' , 'c' , 'word' , 'd']; if delimiter of word provided generate: var result = [['a'], ['word','b','c'],['word','d']]; is there alternative looping through list this? the best approach here first write down algorithm , without getting specific code. called pseudo-code . have tried writing some? here's example: start off empty result of form [[]] . inner array call subarray . look @ next word in input. if it's 'word', add new subarray result , make current subarray. add word current subarray. repeat until input empty. this type of algorithm, looping on array, , building kind of result, reduce designed for. can transform pseudo-code above directly js follows: function split(array) { var subarray = []; ...

jquery - Javascript animation -

on webpage have members button animates dropdown when toggled. problem animates every time load page without clicking button cause action. open when button clicked , hidden rest of time. the javascript using is: $(document).ready(function() { $('#members').animate({ margintop: '-80px' }, 0); $('.mem').toggle( function() { $('#members').animate({ margintop: '0' }, 500); }, function() { $('#members').animate({ margintop: '-80px' }, 500); }); }); as can see first animates div -80px. want -80px without having animate every time load page. thanks! to #members css class, add that: display:none; i updated javascript: $(document).ready(function() { $('#members').css({ margintop: '-80px' }); $('.mem').toggle(function(){ $('#members').css({ display: 'block...

Avoiding diamond shapes in Java when using composition and inheritance -

Image
i've been building system has 5 classes, class containing main method initialize, show , modify various different objects aforementioned 5 classes. understand how use inheritance adopt fields in both therapist , patient classes person (e.g. name, address phonenumber fields) parent-class, , how use composition (at-least theoretically) build objects of consultation , bill patient class. however, i'm confused on how should go storing field called therapist name in therapist class , showing when call object of patient. i've included class diagram on how think should like, apparently forms diamond big no-no in java. what's in class diagram work? could show example of how store therapist name in therapist class , move data member on patient when create objects? here's diagram: the diamond problem doesn't exist java, because java support multiple inheritance of signature, not of implementation (though i'm not sure how works java 8 interface...

android - Toolbar DisplayHomeAsUp Btn id -

i have trivial problem homeasup button in activity, not being executing or more concise id i'm checking not correct one, have ask, id homeasup button on toolbar ? my code: public boolean onoptionsitemselected(menuitem item) { log.d("item "+item.getitemid()); log.d("home id "+android.support.v7.appcompat.r.id.home); log.d("home id r "+r.id.home); log.d("home id r "+r.id.homeasup); if (item.getitemid() == r.id.a_profile_menu_item_edit) { showprofileedit(); return true; } else if (item.getitemid() == android.support.v7.appcompat.r.id.home) { navutils.navigateupfromsametask(this); return true; } return super.onoptionsitemselected(item); } and logs im printing printed: d/profile[onoptionsitemselected] - 121﹕ item id 16908332 d/profile[onoptionsitemselected] - 122﹕ home id 2131492868 d/profile[onoptionsitemselected] - 123﹕ home id r 2131492868 d/profile[onoptionsitemselec...

mysql - SQL - Adding multiple values in 1 column -

i want add multiple values of join query in 1 single column. there way that? here fiddle: http://sqlfiddle.com/#!9/90540/1 here screen of how result should http://i60.tinypic.com/5pk7yg.png "result" ok here problem, (and many people here, believe) doesn't have clue what's point of query, goal want achieve this. to desired result can this... select case when p.id = 1 p.id end col1, case when p.id = 1 p.`value` end col2, case when p.id = 1 (select id site_gender id = 2) end col3, case when p.id = 1 (select `value` site_gender id = 2) end col4, a.id, a.email site_gender p join user_account on p.id = a.id but query doesn't have sense, you'll desired result don't know can else it. here fiddle see what's happend there... but if change little table site_gender , add column, let's call parent , have query this select p.id, p.value, x.id, x.value, a.id, a.email site_gender p inner join site_ge...

java - App stops unexpectedly when using OnTouchListener, MotionEvent.ACTION_UP -

so want create buttons play music long pressed, once released, music stops. in createlisteners() , have following: b1.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { if(event.getaction() == motionevent.action_down) { startbeat(1, m1); return true; } else if (event.getaction() == motionevent.action_up) { m1.stop(); } return false; } }); m1 mediaplayer , , in method startbeat , m1.start() has been called. when running app, music plays fine, long don't release button. however, moment release button, app says stopped unexpectedly. causing problem? is there way go implementing feature? maybe try play again mediaplayer ?? calling stop() stops playback , causes mediaplayer in started, paused, prepared or playbackcompleted state enter stopped state. once in stopped state, pl...

c# - Mysql WHERE LIKE with RadCombobox.Text -

i having trouble select due use of @. using string mysql = "select * sytransactioncategory transactioncategory '%' + @transactioncategory + '%'"; do not work. i found several interesting answers, this did not not manage adapt case. here current c# code: string mysql = "select * sytransactioncategory transactioncategory @transactioncategory"; mysqldataadapter adapter = new mysqldataadapter(mysql,configurationmanager.connectionstrings["defaultconnection"].connectionstring); adapter.selectcommand.parameters.addwithvalue("@transactioncategory", e.text); anyone give me track please? the + operator in mysql works on numbers. you want ... concat('%', transactioncategory, '%') if you're trying construct strings in query. the kicker this: 0 + 'somethingrandom' has result value of zero, because mysql tries convert 'somethingrandom' integer, , decides it's zero. 0 ...

Vb.Net 2D Dictionary - very slow -

Image
i need create 2d dictionary/keyvalue pair. tried this. dim twodimdata new dictionary(of string, dictionary(of string, string)) 'create empty table each aid in aidlist '(contains 15000 elements) twodimdata.add(aid, new dictionary(of string, string)) each bid in bidlist 'contains 30 elements twodimdata.item(aid).add(bid, "") next next 'later populate values. [some code here populate table] 'now access value 'the idea access info given below (access row name & col name) msgbox twodimdata.item("a004").item("b005") ' should give value of 2 msgbox twodimdata.item("a008").item("b002") ' should return empty string. no error issue: the issue in creating empty table. takes 70 seconds create twodimdata table empty values. else seems fine. there way improve performance - may instead of using dictionary? i suggest try dictionary(of tuple(of string, string), str...

javascript - How should I package plugin functions for use in a validation directive? -

i working on below validation directive, suggested me in this answer : mybigangularapp.directive("bkngvalidation", function ($compile) { return { priority: 10000, terminal: true, link: function (scope, element, attrs) { var validationtype = attrs.bkngvalidation; window["addvalidationfor_" + validationtype](element); // prevent infinite loop element.removeattr("bk-ng-validation"); $compile(element)(scope); } }; }); then, when apply directive html element, in form, bk-ng-validation="phonenumber" , directive invokes function: function addvalidationfor_phonenumber(element) { element.attr("ng-pattern", "/^[0-9]+$/"); element.attr("ng-minlength", 5); element.attr("ng-maxlength", 8); alert("yeah baby"); } this addvalidationfor_phonenumber in global namespace, proof of concept...

c++ - Qt state machine : How to set guard on initial state? -

from qt state machine documentation, can set, in main state, initial substate. qstatemachine machine; qstate *s1 = new qstate(); machine.addstate(s1); machine.setinitialstate(s1); i can add guard transition between different states. but how can add guard on initial state. qstate *s1 = new qstate(); qstate *s2 = new qstate(); machine.addstate(s1); machine.addstate(s2); machine.setinitialstate(s1, ifblabla_istrue); machine.setinitialstate(s2, ifblabla_isfalse);

swift - didBeginContact not called : this instance is unique to me -

so, still experimenting sprite kit first time ever, , test collision. so, searched around bit in apple's documentation, around stack overflow, online tutorials, , other forums. however, unable find tip or code makes doing work. so, here relevant pieces of code: this code obstacle: func createobstacle(){ var ball = skshapenode(circleofradius: 20) var width = uint32(self.frame.width) var random_number = arc4random_uniform(width) ball.position = cgpointmake(cgfloat(random_number), frame.height+20) ball.strokecolor = skcolor.blackcolor() ball.glowwidth = 1.0 ball.fillcolor = skcolor.darkgraycolor() ball.physicsbody = skphysicsbody(circleofradius: 20) ball.physicsbody!.affectedbygravity = true ball.physicsbody?.categorybitmask = 6 ball.physicsbody?.dynamic = true self.addchild(ball) } this relevant code thing collide with: let circle = skshapenode(circleofradius: 20) circle.physicsbody = skphysicsbody(circleofradius: ...