Posts

Showing posts from May, 2011

html - how do you add a class and change css in javascript code -

i need change css rgba , reload class fadeinupbig ....., using javascript ... <script> $('.tile.bg-darkblue').on('click', function () { $(".tile").addclass("flipoutx"); settimeout(function(){ $("#colorscreen").css('background-color', 'rgba(255, 255, 255, 0.6)'); $("fadeinupbig").replacewith("fadeinupbig"); $(".tile-group.one").css({ marginleft:"-40px", width: "1080px"}).load("musability-musictherapy-company-overview.html"); }, 1000); }); </script> the replacewith poor attempt @ reloading fadeinupbig once color has been changed. usefull. i have re-edited latest version doesn't work .... putting dots before class not requried understanding here latest <script> $('.tile.bg-darkblue').on('click', function () { $(".tile").addclass("flipoutx"

javascript - JS: remove lastChild only works every second button click -

i use code delete last item of <ul> list, on second, fourth, sixth, ... every second click on button item gets removed, every click message appears. can element gets deleted on every click. document.getelementsbytagname('input')[0].onclick = function () { 'use strict'; var list = document.getelementbyid('list'), item = list.lastchild; list.removechild(item); window.alert("removed"); }; <ul id="list"> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> <li id="child">list item 4</li> <li>list item 5</li> </ul> <input type="button" value="delete last"> this because .lastchild returns nodes, including empty text nodes exist in <ul> . use .lastelementchild instead target <li> nodes the difference between property , lastelementchi

javafx - Convert an IntegerBinding to a DoubleBinding -

this may seem simple question, turns out it's not easy (or can't find info on how this). i want convert integerbinding have, namely bindings.size(families); doublebinding if bindings.divide(bindings.size(families),bindings.size(familiesall)) don't result of integerdivision. maybe there otherways achieve want, converting bindings essential must possible. a couple of options: bindings.createdoublebinding(() -> 1.0 * families.size() / familiesall.size, bindings.size(families), bindings.size(familiesall)); or: bindings.divide(bindings.size(families).add(0.0), bindings.size(familiesall)); or: bindings.size(families).add(0.0).divide(bindings.size(familiesall)); or: doubleproperty familiessize = new simpledoubleproperty(); familiessize.bind(bindings.size(families)); bindings.divide(familiessize, bindings.size(familiesall));

postgresql - Table names are encoded incorrectly -

i'm using grails 2.4.3 on tomcat 7.0 postgresql 9.4. have domain object called iteration . if run grails without tomcat, iteration table created. when try run war inside tomcat, ıteration table created instead of iteration . i did not set in tomcat configuration files or tomcat service enable utf-8 encoding. what may cause problem occur? edit: here production settings in datasource.groovy: production { datasource { dbcreate = "" url = "jdbc:postgresql://localhost:5432/db" driverclassname = "org.postgresql.driver" username = "postgres" password = "password" dialect = "net.kaleidos.hibernate.postgresqlextensionsdialect" logsql = false properties { jmxenabled = true initialsize = 5 maxactive = 50 minidle = 5 maxidle = 25 maxwait = 10000 maxage = 10 * 60000 timebetweenevictionrunsmillis = 1800000 minevictableidletimemillis = 1800000 validationquery = &quo

erp - Is it possible to make input as password in Acumatica -

in configuration screen need have storage of passwords. want make invisible others ( displayed stars ). how should mark dac class text field and/or modify pxtextedit control in order functionality? i found answer on question: <px:pxtextedit id="edpassword" runat="server" datafield="password" textmode="password" />

File Upload in Firefox JSF1.2 -

file upload shows file name. there way can full path of uploaded file? **jsp** <h:outputtext> <input name="uploadfile" title="upload file" type="file" size="50" accept="*.csv;*.txt" /> </h:outputtext> **pagenbean** string filepath = (string)super.getrequestmap().get("uploadfile"); when upload file, file name in pagebean. need complete path of uploaded file. no, due security reasons. not able full path. end user directory structure not shown.

java - Private variable cannot reference to another method in the same class -

im new java , today have problem code when trying actionlistener java class here: public class exam{ private void createform(){ ... jbutton jbtn = new jbutton("ok"); jbtn.addactionlistener((actionlistener) this); ... } public static void main(string[] args){ exam ex = new exam(); ex.createform(); } public void actionperformed(actionevent ae){ //ide show no variable name "jbtn" if (ae.getsource() == jbtn){ ... } } } your jbtn variable declared within createform method. java uses called "scoping rules" make sure don't accidentally use variables don't mean to. declaring jbtn in createform , telling java compiler want use in method, , else. called "local" variable (as in, local method). you want use "member variable" (it member of class). declared inside class, outside of method. in case, looks this:

wpf - Does message exchange between View and ViewModel break MVVM pattern -

i have complex view usercontrols need updated. easiest way of doing so, see far, using message mediation service mvvm light messenger. in case need have handling code in view, isn't ideal in mvvm. does message exchange between view , viewmodel break mvvm pattern? edit: clear things little, example, if need programatically add new usercontrol view signalled viewmodel. how can achieved?

javascript - AngularJS - Filter list by object property that has filter applied to it -

i want filter list of objects properties , used filter filter. problem object properties have filters applied them change format in displayed (see formatdate filter in code below) , filter filter use unformatted object properties. e.g.: there video .duration = 150 (seconds) displayed 00:02:30 (because of formatdate filter). if user searches "02", video not found because .duration property of video searched , "02" doesn't match 150. what easiest way filter displayed value instead of "raw" value? thought adding getdurationformatted() function every object in list , displaying , filtering property, severely decrease expressiveness of html. <input ng-model="query"> <tr ng-repeat="video in videos | filter:query"> <td> {{ video.name }} </td> <td> <!-- formatdate filter used format amount of seconds --> {{ video.duration | formatdate:'hh:mm:ss' }

c# - How to make async with linq -

i'm trying make first web application asp.net mvc including remote database linq. i'm using default template mvc, i've remade code in accountcontroller implement register users using linq, , i'm interesting async. possible handle linq async? , if yes, show me please example how that, helpful me. here's example of registration via linq: [allowanonymous] public actionresult register() { return view(); } // // post: /account/register [httppost] [allowanonymous] [validateantiforgerytoken] public actionresult register(registerviewmodel model) { if (modelstate.isvalid) { using (databaseclassdatacontext dc = new databaseclassdatacontext()) { users tbusers = new users(); tbusers.login = model.login; tbusers.name = model.name; tbusers.surname = model.surname; tbusers.password = model.password; tbusers.e_mail = model.email; tbusers.knowledge = model.knowledge

scala - Spray rejections is not converted to status code? -

i following spray manual here . put gather pretty simple test class atoimportserviceapitest extends wordspeclike mustmatchers scalatestroutetest { "atoimportservice" must { "return http status 401 unauhorized when accessing withou basic auth" in { post("/ato/v1/orders/updatestatus") ~>new atoimportserviceapi().route ~> check { handled must be(false) rejections must have size 1 status === statuscodes.unauthorized } } } } i calling route contains authorized directive. expect rejection transformed http status code. not happening here , test failing. request rejected list(authenticationfailedrejection(credentialsmissing,list(www-authenticate: basic realm="bd ato import api"))) scalatestfailurelocation: spray.testkit.routetest$class @ (routetest.scala:74) org.scalatest.exceptions.testfailedexception: request rejected list(authenticationfailedrejection(credentialsmissing,list(www-authenti

android - Goto particular path when push notification arrives (Angular, Ionic, ngcordova) -

consider scenario. have ionic / angular app , using the ngcordova plugin push notifications. let push notification arrives when app in background. user, views notification in app drawer , clicks notification further information. user navigate particular path using $location.path(). how can tap notification click event? ok. turns out there no need tap notification click event. check if app in foreground using: notification.foreground so, if if(notification.foreground) { //do case user using app. $popup('a notification arrived'); } else { //do case user not using app. $location.path('/tab/somepage'); }

Magento Fatal error: Call to a member function getBillingAddress() on a non-object in /Abstract.php on line 689 -

i'm getting following error: fatal error: call member function getbillingaddress() on non-object in /data/web/public/app/code/core/mage/payment/model/method/abstract.php on line 689 i'm on magento 1.9.1.1. have problem different magento installation on different server. both same versions 1.9.1.1. this error happens, when manage customers page, you'll want create order specific customer. happens registerd customer. could core magento bug? , how fix it? all appreciated! abstract.php /** * payment method abstract model * * @author magento core team <core@magentocommerce.com> */ abstract class mage_payment_model_method_abstract extends varien_object { const action_order = 'order'; const action_authorize = 'authorize'; const action_authorize_capture = 'authorize_capture'; const status_unknown = 'unknown'; const status_approved = 'approved'; const status_error = 'error'; con

scala - Skip/Take with Spark SQL -

how 1 go implementing skip/take query (typical server side grid paging) using spark sql. have scoured net , can find basic examples such these here: https://databricks-training.s3.amazonaws.com/data-exploration-using-spark-sql.html i don't see concept of row_number() or offset/fetch t-sql. know how accomplish this? something like: scala > csc.sql("select * users skip 10 limit 10").collect() try this: val rdd = csc.sql("select * <keyspace>.<table>") val rdd2 = rdd.view.zipwithindex() rdd2.filter(x => { x._2 > 5 && x._2 < 10;}).collect() rdd2.filter(x => { x._2 > 9 && x._2 < 12;}).collect()

jquery - Append clone() elements with other clone() elements -

i trying append clone() elements between new elements has created javascript so: var $user_dp = $(this).parent().parent().find('.dp').clone() var $user_name = $(this).parent().parent().find('.alias').clone() var $feed_added = $(this).parent().parent().find('.timeago').clone() var $feed_status =$(this).parent().parent().find('.feed_status').clone() $('#pop_up_cont #wrap').html('<div>' + $user_dp + $feed_added + '</div><div>' + $feed_status + '</div>') im getting [object object][object object][object object] rather elements. link (click on car image) thank you! the issue because appending objects string, hence implicitly coerced, resulting in string of [object object] . instead need append() objects individually. try this: var $container = $(this).parent().parent(); // change closest() var $user_dp = $container.find('.dp').clone() var $user_name = $container.find(

c++ - Opencv Array of strings? -

i want classify images using svm , need give labels, in matlab do: labels = {'ball';'plane';'person'}; how make in opencv? following code failed: mat_<string> m (3,1); m.at<string>(0) = "ball"; m.at<string>(1) = "plane"; m.at<string>(2) = "person";

Google not showing image link -

Image
when searching 'medieval engineers' in google page not showing image link. please see below screen shot works other keywords. can me same need call images java api. search in images.google.com : https://www.google.com/search?site=&tbm=isch&source=hp&biw=1368&bih=675&q=medieval+engineers&oq=medieval+engineers&gs_l=img.3...364.364.0.1062.0.0.0.0.0.0.0.0..0.0.msedr...0...1ac.1.64.img..0.0.0.tdkhij8qkgk

java - Is skipping "accept" where type is known, a valid optimization for the Visitor pattern? -

consider following visitor simple language interpreter. public interface visitor{ void visit( varstat vs); void visit( ident i); void visit( intliteral a); void visit( sum s); } for completeness add code gives necessary implementation details (you can skip , read directly question). public interface visitable{ void accept( visitor v); } public class varstat implements visitable{ ident i; exp e; public varstat(ident id, exp ex){ = id; e = ex; } public ident getident() { return i; } public exp getexp() { return e; } @override public void accept( visitor v){ v.visit( this); } } public interface exp extends visitable{ } public class ident implements exp{ @override public void accept( visitor v){ v.visit( this); } } a var statement defined that: varstat ::== var ident = exp; exp ::== exp + exp | intliteral | ident intliteral ::== [0-9]{0,8} ident ::== [a-za-z]+ a vali

javascript - Column Chart: Click event to only trigger on drilldown series -

i working on 2 level column chart. want perform task showing alert on clicking each bar on chart on drilldown series only. have found this: plotoptions: { series: { cursor: 'pointer', point: { events: { click: function () { alert('category: ' + this.category + ', value: ' + this.y); } } } } } it works fine, fires parent series too. can force click event work on 2nd level series (that appears after drilldown)? because this value of click event object no values if click parent, check x value (or similar) see if destroyed parent or clicking available point. make sure it's value know point have. for example ( jsfiddle ): var undefined; $('#container').highcharts({ plotoptions: { series: { point: { events: { click: function() { if(this.x !=

unit testing - Converting datatypes for failing test function in Perl? -

minimum code use strict; use warnings; use v5.16; use test::more tests => 2; is_deeply( [ [0, 0], [1, 0] ], [ [0, 0], [1, 0] ], 'intersects x-axis @ (0, 0) , (1, 0)' ); is_deeply( ( [0, 0], [1, 0] ), ( [0, 0], [1, 0] ), 'intersects x-axis @ (0, 0) , (1, 0)' ); which returns ok 1 - intersects x-axis @ (0, 0) , (1, 0) is_deeply() takes 2 or 3 args, gave 5. means passed array or hash instead of reference @ test44.pl line 14 not ok 2 # failed test @ test44.pl line 14. # looks failed 1 test of 2 run. the first code succeeds [[-,-],[-,-]] entries second fails ([-,-],[-,-]) entries. function returns ([-,-], [-,-]) want test if on x-axis. there many args test, reason why test fails. conversion may needed. however, data chunks big no duplication of data not idea because of speed. how can proceed testing such data ([-,-],[-,-]) fit expected result efficiently? use anonymous arrays, each 1 of them interpreted 1 argument: is_deeply(

Python class attributes and their initialization -

i'm quite new in python , during these days i'm exploring classes. have question concerning attributes , variables inside classes: difference between defining attribute via q=1 in body of class , via defining self.q=1 inside __init__ ? example, difference between following 2 possibilities? class myclass1: q=1 def __init__(self,p): self.p=p def addsomething(self,x): self.q = self.q+x and class myclass2: def __init__(self,p): self.q=1 self.p=p def addsomething(self,x): self.q = self.q+x the output of example: >>> my=myclass1(2) >>> my.p 2 >>> my.q 1 >>> my.addsomething(7) >>> my.q 8 does not depend on whether myclass1 or myclass2 used. neither in myclass1 nor in myclass2 error occur. classes instances in python uses dictionary data structure store information. so each class definition, dictionary allocated class level information (class variabl

javascript - Bootstrap Typeahead not showing suggestion which have the valueKey starting with same value -

i'm using typeahead v0.11.1 show result not showing result have result starting same result. the result getting database : object { id: 4, title: "project manager", description: "project manager", companyid: 1 } object { id: 6, title: "software developer", description: "software developer", companyid: 1 } object { id: 7, title: ".net developer", description: ".net developer", companyid: 1 } object { id: 10, title: "android developer", description: "android developer", companyid: 1 } object { id: 11, title: "ios developer", description: "ios developer", companyid: 1 } object { id: 13, title: "sr. android developer", description: "sr. android developer", companyid: 1 } object { id: 14, title: "sr. ios developer", description: "sr. ios developer", companyid: 1 } problem typeahead

java - Encoding warning in Maven Selenium WebDriver project executing in IntelliJ IDEA -

this question has answer here: how configure encoding in maven? 4 answers i have maven selenium webdriver project in intellij idea 14.0.2. pom.xml file below: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>masteringseleniumtestingtools</groupid> <artifactid>chapter3</artifactid> <version>1.0-snapshot</version> <dependencies> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-java</artifactid>

Can't access exe symlinks in centos 6.6 on docker -

i'm trying access /proc/< pid >/exe symlink on centos 6.6 i'm geting ls: cannot access /proc/57/exe: permission denied my dockerfile from centos:6 # install base packages run yum -y update run yum -y groupinstall "development tools" run yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite- devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel run yum -y install wget run wget http://python.org/ftp/python/2.7.6/python-2.7.6.tar.xz run yum -y install tar run tar -xf python-2.7.6.tar.xz run cd python-2.7.6 && ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared ldflags="-wl,-rpath /usr/local/lib" run cd python-2.7.6 && make run cd python-2.7.6 && make altinstall # first setup script setuptools: run wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py # install python 2.7 and/or python 3.3: run python2.7 ez_setup.py # install pip using newly ins

private - Accessing parameters of the same name of different classes in Scala -

i have specific scenario, in have different abstract classes have child case classes can have different parameters, example: abstract class ball() {} case class football(_name: string, _shape: string) extends ball case class basketball(_name: string, _size: int) extends ball and different abstract class: abstract class food() {} case class vegetarian(_name: string, calories: int) extends food case class meat(_name: string, proteincount: int) extends food now, problem i'm facing need somehow extract name of of without knowing class is, know always, each class has parameters named _name . supposing have object of of above classes, i'm trying this: object.getclass.getdeclaredfield("_name").get(this) but i'm getting error: can not access member of class package.food modifiers "private" i tried putting val , var before parameters in class doesnt help. tried doing "setaccessible(true)" in line before get(this), doesn't

jquery - Finding parent class using .parent and .hasClass -

how can find parent class of clicked element? currently running on . click event of element called .cross i want find parent classnames: var status = $(this).parent(this).hasclass(); console.log(status); the code above outputs false in console rather classname. how can find parent class of clicked element? $(this).parent().attr("class")

compilation - How to access a PRIVATE PUBLIC interface in Fortran? -

i have following code: subroutine test use mp, only: mp_bcast integer :: b = 0 logical :: ... call mp_bcast (a, b) end subroutine test the problem module mp goes follow: module mp implicit none private public :: mp_bcast ! interface mp_bcast module procedure mp_bcast_i1, mp_bcast_r1, mp_bcast_c1, mp_bcast_l ! etc end interface subroutine mp_bcast_l(msg,source,gid) implicit none logical :: msg integer, intent(in) :: source integer, intent(in) :: gid end subroutine mp_bcast_l it private interface public. cannot modify module mp (belong software want interface to). i use following makefile: mods = ../../modules_mp/libmod.a prog : prog.o test.o $(ld) $(ldflags) -o prog.x $(mods) this way though access public interface in module libmod.a contains module 'mp'. not work , error: test.f90(38): error #6285: there no matching specific subroutine generic subroutine call. [mp_bcast] call mp_bcast (a,b) -------^ what correct way proceed? thank you,

I want to Click , Drag and Move a button on the pygtk window -

i managed find sample code images described in following link . how drag images pygtk however when use button doesn't seem work . what original link does: it moves (pans) image inside 'scrolled window' widget. widget doesn't change places, image respect widget. if want move button itself, more complicated! easier if use 'fixed' layout manager, buttons located in absolute coordinates (as opposed 'normal' layout manager widgets 'packed' alongside each other. there should use drag , drop. have prepare entire application 'receiving' button, , when gets there. involves many steps! ). have @ gtk.fixed widget's documentation .

RegEx javascript not matching correctly -

i have small javascript funtcion : function getfilteredlistlimited(event) { var $source = $(event.target); var $pattern = event.data.pattern; var re = new regexp($pattern, 'i'); if (re.test($source.val())) { console.log('regex match'); } }; the pattern used is: ^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$ which should match email-addresses. using http://regexpal.com/ can see pattern correct. weird reason script matches @ 4th character after @ abc@abcd should not give match, does. suggestions ? you need aware of regexp constructor escaped characters must double-escaped. so, regex string passed regexp constructor should like: ^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$ the fix can introduced this: var re = new regexp($pattern.replace(/\\/g, '\\\\'), 'i'); it work if escape symbols used consistently.

excel - QueryTable not being created -

Image
i trying call information yahoo finance keep on getting error saying url trying use not giving information. when manually put url in data , when use url in .iqy file works. got following vba code when recorded macro, macro doesn't run. sub getandarrangedata() ' ' getandarrangedata macro ' ' keyboard shortcut: option+cmd+b ' activesheet.querytables.add(connection:= _ "url;http://real-chart.finance.yahoo.com/table.csv?s=1112.hk&d=4&e=15&f=2015&g=d&a=5&b=27&c=2000&ignore=.csv" _ , destination:=range("c3")) .posttext = "msn moneycentral stock quotes_1" .name = false .fieldnames = false .refreshstyle = xlinsertdeletecells .rownumbers = false .filladjacentformulas = false .hasautoformat = true .refreshonfileopen = 1 .backgroundquery = false .tablesonlyfromhtml = true .savedata = true .re

sqlite3 "OperationalError: near "(": syntax error" python -

simply put trying make sql database table , input data it. have working in simpler way, when put script results in error. i'm hoping simple missed. help/advice appreciated. conn = sqlite3.connect('data1.db') c = conn.cursor() # create table c.execute('''create table data_output6 (date text, output6mv real)''') averages_norm = [] i, x in enumerate(averages): averages_norm.append(x*output_factor) c.execute("insert data_output6 values (%r,%r)" %(xdates[i],averages_norm[-1])) conn.commit() results in error: 57 i, x in enumerate(averages): 58 averages_norm.append(x*output_factor) ---> 59 c.execute("insert data_output6 values (%r,%r)"%(xdates[i],averages_norm[-1])) 60 conn.commit() 61 operationalerror: near "(": syntax error simply put, let db api formatting: c.execute("insert data_output6 values (?, ?)", (xdates[i], averages_norm[-1])) and

javascript - Validate date so that the date cannot be in future or in past -

i have form has date input. best way in javascript can ensure value selected neither future date or past date. have implemented jquery date picker select date see code below <html> <!--maina--> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <link href="main.css" rel="stylesheet" type="text/css"/> <script> $(function() { var date = $('#datepicker').datepicker({ dateformat: 'yy-mm-dd' }).val(); }); function validateform(){ var date_of_circulation = document.forms["myform"]["date_of_circulation"].value; if (date_of_circulation == null || date_of_circulation ==""){ alert ("you have select date manuscript circulat

javascript - Displaying a nice message box in ASP.NET -

does knows nice , simple message box can used in asp.net display user handle possible errors, , stuff that... i've tried following code: else{ string csname1 = "popupscript"; string cstext1 = "<script type=\"text/javascript\">" + "alert('error adding product');</" + "script>"; registerstartupscript(csname1, cstext1); } it want design poor , terrible. there other ways display little bit more fancy message box, maybe smooth transition ?? all appreciated! you should @ john papa's toastr . it's lightweight client-side notification plugin... toastr.error('error adding product', 'error!') you have toastr.info , toastr.success , toastr.warn , styled appropriate colours. there's configurable demo here worth checking out, along demo in comments.

Replacing Matlab title name with process Id does not work with startup.m -

i want start matlab , replace title of matlab window process id. created following startup.m file: cd e:\matlab_files\ jdesktop = com.mathworks.mde.desk.mldesktop.getinstance; jdesktop.getmainframe.settitle(['pid:' num2str(feature('getpid'))]); now, matlab changes folder e:\matlab_files process id not replaced. once matlab has started , execute 2nd , 3rd line of startup.m, title of matlab window replaced process id. please explain cause of behaviour. i using matlab 2009b. all of graphics haven't finished initialising -> not able replace title (i assume hasn't yet been created). you can check trying disp jdesktop.getmainframe.gettitle startup.m , see that empty. thats explanation why - haven't asked fix - assume want one!! ;) you can fix using timer - note put 60 seconds in timer below - lot less. function startup if ~isdeployed % agood practice use incase ever compile codes. cd e:\matlab_files\ timerfcn = @updatet

php - Add custom tab to Magento product detail pages depending on category -

Image
in our magento store offer 2 kinds of products, each own root categories. want add cms static blocks custom tabs on product detail pages dependent on category product under. i know how create tabs in view.phtml template, how can make that: block 1 appears on product detail pages under root category 1 block 2 appears on product detail pages under root category 2 i think possible xml layout updates remove , append tabs, how append blocks layout? overview if understanding question correctly, want add custom tab on product detail page when viewing product under 2 special categories (category1 , category2). the tabs on product detail page of type catalog/product_view_tabs maps class mage_catalog_block_product_view_tabs . block provide way add new tabs through addtab() method, seems method assumes template used, unfortunately prevents using cms static block method. a possible solution if able put content 2 static blocks 2 template files instead, using layou

c# - Displaying an Image on a WPF page -

i trying display image on wpf page. code shown below: <grid> <textblock margin="32,332,395,74" cursor="none"> click <hyperlink navigateuri="testwindow.xaml">sign document</hyperlink> </textblock> <image horizontalalignment="left" height="151" margin="32,96,0,0" verticalalignment="top" width="179" source="signature.png" visibility="visible" name="signimage"/> the problem image shows in wpf designer when run program, image not display on page. note image displayed on page not window another option use resource, e.g. in app.xaml: <application.resources> <bitmapimage x:key="signaturesrc" urisource="/myproject;component/imagefolderifthereisone/signature.png" /> </application.resources> and use this <image height="100" verticalalignment="top&

javascript - Creating duration inputs (mm:ss:ms) in an AngularJS directive -

i have form need users input time duration, in resource saved minutes (or milliseconds, easy change). need directive take second/millisecond value create 3 separate inputs minutes, seconds & milliseconds. users can modify each of components , directive update model seconds/millisecond value of 3 components. i seem able take model value, create 3 inputs , using moment.js create separate components of time. directive angular.module('myexampleapp') .directive('laptimeinput', function () { var tpl = '<div class="lap_time_input"> \ <input ng-model="lap_time.minutes" type="number" class="minutes" placeholder="00" min="0" max="15" step="1"> \ <span class="lap-time-sep">:</span> \ <input ng-model="lap_time.seconds" type="number" class="seconds" placeholder="00"

java - Using a timer to auto click a button when it runs out? -

i have 2 buttons, 1 ignore , 1 fight crime. want give user 10 seconds make choice. if fail in 10 seconds, want ignore autoclick , execute code. how go doing this? have struggled timers working. there javax.swing.timer class in java. execute events after time given when creating object of timer class.. in milliseconds. and have provide actionlistener event. // javax.swing.timer(timeafterwhichexecutetheeventinmilliseconds, listenerfortheevent) javax.swing.timer timer = new javax.swing.timer(10000, new actionlistener() { @override public void actionperformed(actionevent e) { your_button.doclick(); } });

c++ - Declare C function friend of class and return C enumerator -

this very simliar this question , however, function trying make friend returns c enumerator. cannot figure out correct syntax: #include <iostream> extern "c" { enum x {one}; int foo(); x bar(); } namespace { class { public: a(int a): a(a) {} private: friend int ::foo(); friend x ::bar(); // doesn't work int a; }; } extern "c" { int foo() { a::a a(1); std::cout << a.a << std::endl; return one; } x bar() { a::a a(2); std::cout << a.a << std::endl; return one; } } int main() { foo(); // outputs: 1 bar(); // doesn't compile } the friend x ::bar(); doesn't work. correct syntax that. online demo main.cpp:20:18: error: 'enum x' not class or namespace friend x ::bar(); ^ main.cpp:20:18: error: iso c++ forbids declaration of 'bar' no type [-fpermissive] main.cpp: in function 'x bar()': main.cpp:22:7: error: 'int a::a::a' priv

javascript - How to dynamically adjust page height to its content? -

i'm working on website iframe. iframe doesn't have scrollbars. in iframe there elements, slide open when click them. problem if slide 1 open, bigger iframe height, stuck there, can't scroll. so want height of iframe synchronises height of content. this jquery code slide 1 element open, fits content: $( "#effect1" ).animate({ height: $( "#effect2" ).prop( "scrollheight" ) }, 1000 ); $( "#effect2" ).animate({ height: $( "#effect2" ).prop( "scrollheight" ) - parseint( $( "#effect2" ).css( "padding-top" ), 10 ) - parseint( $( "#effect2" ).css( "padding-bottom" ), 10 ) }, 1000 ); so guess add changing of iframe's height after that. what i've tried far: i took code this website dealing same problem. function getdocheight(doc) { doc = doc || document; // stackoverflow.com/questions/1145850/ var body = doc.body, html = doc.documentelem

java - mediaPlayer CompletionListener playing next song before Completion of song -

i have written mediaplayer application , in mediaplayer.setoncompletionlistener called before completion of song , goes on every song...it's keep on going next song until reaches last song in playlist... please help here code: trackslistviewforspeakers.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> adapterview, view view, int position, long l) { track track = playlistcontents.get(position); string filepath = track.getfilepath(); if (mediaplayer.isplaying()) { mediaplayer.stop(); } mediaplayer.reset(); try { mediaplayer.setdatasource(filepath); mediaplayer.start(); // mediaplayer.setvolume(0, 0); } catch (ioexception e) { e.printstacktrace(); for(int i