Posts

Showing posts from May, 2012

IE<= 10: I can type characters inside contenteditable=false element -

this dom structure: <div contentediatble="true"> <span contenteditable="false" class="my-block"> <span contenteditable="false">my block</span> <i contenteditable="false" class="icon-remove">x</i> </span> </div> root <div> looks textbox: in ie 9 , 10, when click root <div> , suppose caret after <span class="my-block"> element, , when typing, words should after whole block. but actually, when start typing, characters inside <span class="my-block"> element(rather after), followed <i contenteditable="false" class="icon-remove">x</i> , , can delete contents of <span class="my-block"> using backspace(but not delete whole span) this annoying , it's hard fix. ie makes tons of troubles developers :( however, expected result works in ff, chrome , ie11

javascript - jstree plugin & stopPropagation issue -

i using jstree 3.0.8 first time , have issue stoppropagation. when click on span.nodeinfo, despite stoppropagation, stills trigger event of parent link. you can see exemple on jsfiddle : http://jsfiddle.net/cloughylow/7p0xq698/29/ 1. wanna : i need put a button on parts of tree trigger action. here use alert tests (at least dialog). ( <span class="nodeinfo">?</span> in html below) i want disable select ( deselect_node(data.node) in js below) and trigger open/colse on parents nodes ( toggle_node(data.node) on js below) the last 2 points of list ok. can't make first 1 work without trigger third 1 caus stoppropagation doesn't seem work. have idea i'm doing wrong ? 2. i've done: html div id="mytreeview"> <ul> <li class="jstree-open" data-jstree='{"icon":"fa fa-folder"}'> title <span class="nodeinfo">?</span>

python - Stop SIGALRM when function returns -

i have problem can't seem solve myself. i'm writing small python script , know why signal.alarm still works after function it's located in returned. here code: class alarmexception(exception): pass def alarmhandler(signum, frame): raise alarmexception def startgame(): import signal signal.signal(signal.sigalrm, alarmhandler) signal.alarm(5) try: # some code... return 1 except alarmexception: # code... return -1 def main(): printheader() keepplaying = true while keepplaying: score = 0 level in range(1): score += startgame() answer = raw_input('would keep playing ? (y/n)\n') keepplaying = answer in ('y', 'y') so problem when startgame() function returns, sigalrm still counting down , shutdown program. here traceback: would keep playing ? (y/n) traceback (most recent call last): file "game.py", line 84, in <mo

c++ - Can I use OpenMP reduction when the variable is an array element? -

the openmp manual says a type name in declare reduction directive cannot function type, array type, reference type, or type qualified const , volatile or restrict . what can produce results array elements? started with: int main() { // create input array static const int snum = 5000; int input[snum]; for(int i=0; i<snum; ++i){ input[i] = i+1; } // shared output variables reduction int sum[2]; sum[0] = 0; sum[1] = 0; #pragma omp parallel #pragma omp declare reduction(+:sum[0]) #pragma omp declare reduction(+:sum[1]) for(int i=0; i<snum; ++i) { int* p = input+i; if(i%2==0) sum[0] += *p; else sum[1] += *p; } } this gives compiler error: 27013152.cpp:16:9: error: ‘#pragma’ not allowed here #pragma omp declare reduction(+:sum[0]) ^~~ 27013152.cpp:17:33: error: ‘sum’ not name type #pragma omp declare reduction(+:sum[1])

How to get a returned List of Objects object type from a Java method? -

i have getter method in class returns list of objects. looks this: public list <cars> getcars() { // code here } the class contains other getters one. in class, want getter methods contained in first class , display name of methods , returned data types. i'm able name of above method (getcars) , it's returned data type (list). however, can't seem "cars" type of object list contains. best can "objecttype". there way of getting "cars" displayed? i've read type erasure , how generics removed in bytecode it's used benefit of java compiler. problem related type erasure? is possible word "cars" displayed? when read type erasure there seems way generics list examples i've seen string , integer , not objects. get generic type of java.util.list thanks you can hold of (generic) information method using standard java reflection: class<?> yourclass = class.forname("a.b.c.classthathasthemet

swift - Cannot access "Parse.setApplicationId()" -

i'm trying make app swift/obj-c (bridging header) parse.com so here's question: saw on many sites can use parse.setapplicationid("appid","clientid") when try code says use of unresolved identifier 'parse' i imported framework , set bridging header in properties. imported frameworks required it's written on parse.com all other classes/objects parse can used swift in code. this problem because of bug in xcode... (i think compiler failed) after restarted xcode error gone.

multithreading - C++ - Passing data between threads -

i have thread pool consists of 4 threads: t1, t2, t3, , t4. running concurrently, input t3 , t4 depends on output t2. how should implement message queue after t2 completes, send output data t3 , t4 processing? have tried implement message queue using locking mechanism, seems locking quite expensive. there lock-free mechanism pass data between threads? using boost::thread in visual studio 2010. boost has lock-free queue: http://www.boost.org/doc/libs/1_56_0/doc/html/lockfree.html .

javascript - getElementById inside a div -

i'm using javascript change text on form submit button, code i'm using: <script type="text/javascript"> $(document).ready(function(){ document.getelementbyid("button").value="new button text"; }); </script> the code work perfectly, need change effects id #button within div id of #formwrap . need .getelementbyid("button") contained within div id of #formwrap if using jquery, why not do $('#formwrap #button').val('new button text'); ? it's css-like selector, similar you'd use in queryselectorall() . it match example button: <div id="formwrap"><input type="button" id="button"></div> but keep in mind 1 element can have same id. maybe wanted class? you'd use .button instead of #button .

php - Separating array rows into other arrays based on key name -

i have array this $rows = array( array( 'fruit.name' => 'apple', 'fruit.colour' => 'red', 'fruit.weight' => '0.1', 'vegetable.name' => 'carrot', 'vegetable.colour' => 'orange', 'vegetable.weight' => '0.05' ), array( 'fruit.name' => 'banana', 'fruit.colour' => 'yellow', 'fruit.weight' => '0.7', 'vegetable.name' => 'potato', 'vegetable.colour' => 'brown', 'vegetable.weight' => '0.6' ) ); and want able sort array 2 other arrays called 'fruits' , 'vegetables' based on first part of key name decimal point. array should have 2 rows in each of fruits , vegetable arrays. i have code doesn't work , can't see i'm doing wron

Adding guests to calendar event by script without invites being sent -

Image
what add guests google calendar events via script created without them being notified via invitation. tried addguest() function whenever added or getting invitation email. is possible? thank in advance. best, phil edit: thanks answer. yes i'm sure there ere invites being sent. here relevant part of code: for (i = 0; < events.length; ++i) { if (events[i].getlocation().match("xyz") || events[i].gettitle().match("abc")) {events[i].setlocation(addabc) && events[i].addguest(mailxyz)} } edit 2: verified again, invites indeed being sent out. here entire script, buti have no idea part might cause this: function modifyappointments() { var idabc = "idabc..." // abc var contactabc = contactsapp.getcontactbyid(idabc); var addressabc = contactabc.getaddresses(); var addabc = addressabc[0].getaddress(); var mailsabc = contactabc.getemails(); var mailabc = mailsabc[0].getaddress(); var today = new date();

javascript - Displaying updated address from the scope variable using the directive -

i have directive called displayaddress takes in address .i using isolalted scope , code performs checking if addres fields blank or not , builds object whihc displaying on view have put view in code problem arises when use 1 way binding code throws error parse string having error:syntax syntax error . return { templateurl: () => { return "/app/templates/common/displayaddress" }, restrict: "e", replace: true, scope: { address: '=' }, controller: "displayaddresscontroller", controlleras: "vm" } <div> <div class="m-space"> <i class="fa fa-map-marker"></i> <span data-ng-if="address.addresstype" data-ng-bind="address.addresstype"></span> <span>{{vm.addresstostring()|| ""}}</span> </div> <div class="row-m-box">

javascript - Error with ngDialog -

i'm using ngdialog project in order display popup on website. downloaded project zip github, comes examples data, works , when work external templates , controller doesn't work .. search solutions on seems forget include ngdialog not case (if dumbest person on earth) here code : in index.html : <html lang="en" ng-app="blackoutapp"> ... <div id="body" ng-view></div> in controllers.js file : var blackoutapp = angular.module('blackoutapp', ['ngroute', 'ngdialog']); blackoutapp.config(['$routeprovider', 'ngdialogprovider', function($routeprovider, ngdialogprovider) { $routeprovider.when('/', { templateurl: 'templates/body.tpl.html', controller: 'bodyctrl' }); ngdialogprovider.setdefaults({ classname: 'ngdialog-theme-default', plain: false, showclose: true, closebydocument: true, closebyescape: true, ap

jquery - Watch another elements classes with AngularJS -

i use bootstrap javascript components create toggleable panels. each panel class in set, if opened. i'd show font awesome icon depending on current panel state. fa fa-angle-up when it's open, , fa fa-angle-down when it's closed. however have difficulties achieving it, can't figure out proper angularjs way it. current approach using jquery hasclass() method check class , apply correct font awesome class arrow. as jquery doesn't support two-way-databinding has issues. i've figured is, method called once , proper class set arrow, when open/close panel ng-class doesn't re-evaluated switch it. what correct "angular-way" achieving this? <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headlineedit"> <h4 class="panel-title"> <a class="collapsed" data-toggle="collapse" data-target='#collapseed

php - IE randomly aborts request to Apache server -

i'm new apache configurations. found issue in our website while loading through ie10 & 11 browsers. while load website using https of requests & randomly aborted. after long search found below article. article 1 article 2 they asked remove below code ssl.conf setenvif user-agent ".*msie.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 as per post, removed lines , restarted server using below command. sudo apachectl restart but still ie issue https there. ssl.conf file under conf.d directory. should else change take effect? the ssl workaround ms internet explorer needs added ssl virtualhost section (it in ssl.conf caused keepalive disabled non-ssl connections): browsermatch "msie [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 browsermatch "msie [17-9]" ssl-unclean-shutdown [source: apache2 manual ]

mysql - My database don't show any values just 0 -

i have database xampp mysql , put values visual studio 2012. i have code insert into mytable, insert value, value appears 0. don't know reason because if i'm connected database , send value, table show value write. knows problem??? imports mysql.data.mysqlclient imports mysql.data imports system.data public class form1 dim posto_1 integer dim posto_2 integer dim posto_3 integer dim posto_4 integer dim ip_address integer dim myconnectionstring string = "server=127.0.0.1; database=base_de_dados; uid=root; password=123;" private sub inserir_click(sender object, e eventargs) handles inserir.click dim insert_bd string = "insert linha(endereco_ip, t_paragem_1, t_paragem_2, t_paragem_3, t_paragem_4) values ('@endereco_ip', '@t_paragem_1', '@t_paragem_2', '@t_paragem_3', '@t_paragem_4');" dim connection new mysqlconnection(myconnectionstring) dim command new mysq

php - Select list first passes others do not -

in www.mpoo.org/organizatori/drugi.php have 2 select list, first time work other no. similar this . second time debugger say: typeerror: $(...) null drugi.php:37 var country_id = $("select#drop1 option:selected").attr('value'); <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title>Списак организатора</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="style.css" type="text/css" /> <style type="text/css"> <!-- @import url("stil.css"); --> </style> </head> <body> <div id="body"> <div class="mhead"><h2>Списак организатора</h2></div> <div id="dropdowns"> <

c++ - How to implement a command line of ffmpeg with ffmpeg static lib? -

i need simple ffmpeg conversion task done inside application: ffmpeg -i input_file.m4v -vcodec copy -acodec copy -vbsf h264_mp4toannexb output_file.ts this works using terminal. i've compiled ffmpeg's static lib. examples work perfectly, means lib working. how implement behaviour of above command line library? i looked ffmpeg.c. there code inside took me hours idea on how works. still don't understand whole structure. i happy if me understanding how use library same example command line does. (at end want transmux mp4 files ts files without reencoding) thanks in advance jack

javascript - setInterval() is not working properly for inactive tab -

i developing 1 timer taking record of time. using setinterval method of java script problem it's not working if tab inactive. one solution got store old time , subtract new time 1 problem if after starting timer if user change system time affect on timer. please inform me if there other possible way or solution. timerinterval = setinterval(function() { seconds=seconds+1; if(seconds==60) { minutes=minutes+1; if(minutes==60) { minutes=0; hours=hours+1; } $("#task"+adata['taskid']).html(("0" + hours).slice(-2)+":"+("0" + minutes).slice(-2)); seconds=0; } },1000); try settimeout instead of setinterval setinterval not prioritize calling function depending on browser load. have gone through same problem , resolved using settimeout

javascript - How to check if at least one checkbox is checked from list of checkboxes with it name attribute as array -

i have div , inside div have check boxes name attribute array, want heck if @ least 1 check box checked. <div id="check_lists"> <input type="checkbox" name="usernames[]" value="1"> <input type="checkbox" name="usernames[]" value="2"> <input type="checkbox" name="usernames[]" value="3"> <input type="checkbox" name="usernames[]" value="3"> </div> you can use attribute equals selector .is() , :checked-selector if($('input[name="usernames[]"]').is(':checked')){ //at least 1 checked }

java - iterate through all combinations of cards -

i'm creating card game , iterate through possible combinations of card. for example (ace of hearts, 2 of hearts), (ace of hearts, 2 of spades), (ace of hearts, 2 of clubs).... etc i'm doing in java currently have this: to start have list<card> deckofcards = new arraylist<card>(); which deck containing cards. create queue<card> deckofcardswithoutduplicates = new linkedlist<card>(); deckofcardswithoutduplicates = deckofcards; now want iterate through of cards without duplicates. (card c : deckofcards) { deckofcardswithoutduplicates.remove(c); (card c1 : deckofcardswithoutduplicates) { //something here irrelevant } deckofcardswithoutduplicates.add(c); } however java.util.concurrentmodificationexception . can give me hints on how better? it's because you're trying remove list you're looping through. to remove list you're looping thro

Equivalent of perl diamond/python fileinput in groovy? -

i looking function or operator (maybe library) mimics perl's diamond operator or python's fileinput . of course check myself arguments, make sure each file , loop through, if none exists read stdin...but defeats purpose: create small unix command line scripts in seconds needs loop through files or stdin cat, grep, sed etc. not having write 30 lines boilerplate code...just 1 or 2 lines. as far know, there not such built-in function/library. anyway, if objective make scripts , loop through files or stdin, can create similar groovy lib. example: fileinput.groovy : class fileinput { static void input(string[] args, closure c) { if (args) { args.collect { new file(it) }.findall { it.isfile() }.each { it.eachline(c) } } else { system.in.eachline(c) } } } then compile above , place resulting classes under ~/.groovy/lib : $ groovyc -d ~/.groovy/lib fileinput.groovy and can use in scripts test.groov

how to get geometric mean for a measure in cube in ssas 2012 -

i have 1 measure called stayinhospital in cube . want calculate geometric mean measure . please see example day , accoutnumber , stayinhospital , visitcount 1 , a1 , 2 , 1 1 , a2 , 4 , 1 1 , a3 , 8 , 1 geometric mean above example day 1 stayinhospital measure = (2*4*8)^1/3 =4 i have done following calculation in calculated member measures.weightlog log(stayinhospital) measures.productofweights 10^measures.weightlog measures.gmlos (measures.productofweights)^(1/(measures.visitcount)) i not getting expected result. it summing stayinhospital value instead of multiplying please . calculated member formulas applied after aggregation. hence best solution calculate logarithm during data loading, e. g. named calculation in data source view, e. g. add calculation expression log(stayinhospital) / log(10.0)

ios - Adding size classes to an existing Xcode project -

i have universal application deployment target 6.1 , above. application in app store. need make changes per new requirements , update ios 8.1. have 2 storyboards auto-layout "main_iphone" , "main_ipad". question: want implement size classes now. necessary changes need make inside application or project settings ? can delete 2 storyboards , create new 1 , re-design or other better feasible ways there ? note: detailed bullet steps necessary changes helpful. know auto-layout(intermediate level). beginner in case of "size classes". thanks in advance. happy coding. there'a no need delete storyboards. project navigator select storyboard in file inspector in interface builder document section, check "use size classes". note project won't compatible xcode 5 after using size classes

canvas - Masking Using Kinetic.js -

Image
i draw 2 draggable bezier curve , circle using kinetic js.my problem want find mask area.is there way find intersection point of bezier , circle.or suggest me best way of masking canvas.i want draw image on masked(visible) region. compositing can , mask intersections, kineticjs not offer compositing built-in method. in particular, 'source-in' compositing reveal intersection of existing shapes , newly drawn shape. when draw new circle on existing curves, intersection of circle & curves remain. a workaround use in-memory html5 canvas compositing , use canvas source kinetic.image. here's outline of how it: create in-memory canvas: var compositingcanvas=document.createelement('canvas'); var context=compositingcanvas.getcontext('2d'); draw bezier curves using context.moveto , context.beziercurveto set compositing source-in: context.globalcompositeoperation='source-in'; draw circle using context.arc create kinetic.image

asp.net mvc 3 - Need to know how to pass a model for paypal transaction -

i have simple order form created in mvc , when hit submit button, have user redirected paypal payment , redirected original page. i'm trying find out how either pass model information or save somehow because after payment complete, program sends them email copy of receipt , successful purchase. how go doing this? please let me know if there else need see. i'm still brand new mvc , i'm trying figure out. model public class writingappmodel { [required(errormessage = "name required")] public string name { get; set; } [emailaddress(errormessage = "a valid email address required.")] [required(errormessage = "email address required.")] public string email { get; set; } [phone(errormessage = "a valid phone number required.")] [required(errormessage = "phone number required.")] public string phonenumber { get; set; } [required(errormessage = "subject required.")] public st

Django form - Calling is_valid() in a template -

i'm using django 1.5. have template multiple forms: 1 driver has many cars (inline forms). want display hint indicating section contains errors. the template: {% if driver_form.is_bound , not driver_form.is_valid %} please correct errors in driver data. {% endif %} {% if car_form.is_bound , not car_form.is_valid %} please correct errors in car data. {% endif %} the problem if first form invalid, second message pops well, though second form valid. noticed if put {{ car_form.is_valid }} 3 times in row, first time empty, next time (and following) true . the original view: if request.method == 'post': driver_form = drivermodelform(request.post) car_form_set = carinlineformset(request.post) # wrong: no instance passed if driver_form.is_valid(): driver = driver_form.save(commit=false) car_form_set = carinlineformset(request.post, instance=driver) if car_form_set.is_valid(): driver.save() car_form_

ios - Allow last UITableViewCell to scroll till first row -

generally in uitableview last uitableviewcell not allowed scroll up, want allow last uitableviewcell till reaches first row. one way know adding empty footer uitableview, can not figure out how space need give footer allowing last row scroll. edit : adding empty footerview uitableview did trick me i not sure think may depending on contentinset , if last cell height not known -(void)scrollviewdidenddecelerating:(uiscrollview *)scrollview { cgrect temrect=cgrectmake(0, scrollview.contentsize.height-3, scrollview.frame.size.width, 3); // here expecting height of last row atleast 3 , (uiview *temv in scrollview.subviews) { if (cgrectintersectsrect(temrect, temv.frame)) // check ing intersection { cgfloat bottominset = scrollview.frame.size.height - temv.frame.size.height; scrollview.contentinset = uiedgeinsetsmake(0, 0 , bottominset, 0); break; } } } note: not apply if tab

Error : IllegalComponentStateException when pressing JMenuItem in java swing (OSX) -

Image
during project stumbled upon confusing error message shows when clicking of projects' jmenuitems. program continue function error log gets messy. have found out same program not give error messages when running windows (via vm on macbook). tried building extremely simplified version showing jmenuitem error message still appears. this dumbed down jmenuitem test program wrote: import javax.swing.jframe; import javax.swing.jmenu; import javax.swing.jmenubar; import javax.swing.jmenuitem; public class testbug { public static jmenuitem menuitem; public static void main(string args[]){ jframe frame = new jframe("java praktikum"); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setlocation(100,100); frame.setsize(800, 600); jmenubar menubar = new jmenubar(); jmenu testmenu = new jmenu(); menuitem = new jmenuitem("testmenuitem"); testmenu.add(menuitem); menubar.add(testmenu); frame.setjmenubar(menubar);

list - Filter return results printed in text file python -

using code: from pysnap import snapchat pprint import pprint s = snapchat() username = raw_input('enter username: ') password = raw_input('enter password: ') s.login(username, password) friends = s.get_friends() newfile = open("newfile.txt", "a") pprint(friends, newfile) it prints return / results of get_friends() great, want. but. the results this: {u'can_see_custom_stories': true, u'direction': u'outgoing', u'display': u'', u'name': u'a7twini', #a7twini being username here u'type': 0}, the thing want display is: a7twini <nextusername> <nextusername> etc.. is there way "filter" these results? making sure name ends in text file? i hope can me, thanks! edit: asked get_friends() function def get_friends(self): """get friends returns list of friends. """ return self.get_updates().get(

C# Code Contracts userMessage Parameter -

i using code contracts in c# bit curious should typing in usermessage parameter. give short example. i have following assertion in code: contract.assert(isvalidreferencedata(refdata)); this message never displayed user, nice have english message description in exception myself , other developers/maintainers of software. initially thought contract.assert(isvalidreferencedata(refdata), "payment reference not valid"); but thought usermessage complete opposite boolean condition, rewrote as: contract.assert(isvalidreferencedata(refdata), "payment reference valid"); therefore message , condition same. confuse people when see exception report , think, "hang on, if reference valid, why exception thrown?". lastly, thought, why not make neutral statement, says what must true: contract.assert(isvalidreferencedata(refdata), "payment reference must valid"); which of above best practice? want get messages right because plan use

android - MPAndroidChart white Background -

i using mpandroidchart library. setting multi line chart data using mpandroidchart. it's working great background coming white. doing nhchart = new linechart(getactivity()); nhchart.setdescription("number of hits view"); nhchart = (linechart) hitsview.findviewbyid(r.id.line_chart_number_of_hits); //int color = color.parsecolor("#80101010"); nhchart.setbackgroundcolor(color.parsecolor("#80101010")); //nhchart.setbackgroundresource(r.drawable.background_portrate); //nhchart.setbackground(getresources().getdrawable(r.drawable.background_portrate)); nhchart.setstartatzero(true); nhchart.setdrawborder(true); nhchart.setnodatatextdescription("no data available charts"); nhchart.setdrawyvalues(false); nhchart.setdrawborder(true); nhchart.setscaleenabled(true); nhchart.sethighlightenabled(false); nhchart.settouchenab

linux - Lamp on ubuntu 14.04 .Only want localhost - how? -

i want setup lamp stack act testing area website. want open computer on localhost - not internet. there way ensure this? thanks well don't have worry this, there solution sure localhost. you need configure apache listen localhost address , port. the solution bit old, don't have lamp installed on computer have try , tell me if works. this can done editing file: /etc/apache2/ports.conf you can command: sudo nano /etc/apache2/ports.conf and replace listen 80 listen 127.0.0.1:80 reference

java - For a @GET operation which one to use @QueryParam or @FormParam -

i developing server side application (not client). have list operation using @get , passing parameters @queryparam . should use @formparam ? helpful while developing client? the @formparam annotation expect parameter in body of request sent html form submit. an http should not use request body. so, keep using @queryparam @get . see also: http request body

Android format locale to ANSI NISO-Z39 -

i need locale formatted ansi niso-z39 standard. (it means example "eng", "fre", "ger", etc.) here how locale : locale current = getresources().getconfiguration().locale; we can with getdefaultlocale() but how format please ? thanks use string langiso3 = locale.getdefault().getiso3language(); http://developer.android.com/reference/java/util/locale.html#getiso3language()

weka - how to run J48 with with different amount of attributes -

rank attributes based on oner performance – click on “select attributes” tab. select method “oner attribute evaluator”. list attributes in ranked order. run decision tree (j48 in weka) 1 attribute (the best attribute), first two, 3 , on… list accuracy (f-measure) corresponding each case. your question looks little homework, i'll try answer general parts can apply rest yourself. you need use attributeselectedclassifier classifier, in meta section of classifiers. allows filter out unwanted attributes before running classifier. from there, need set classifier type (j48), evaluator , search methods limit number of attributes.

angularjs - Access directive attribute value in the jasmine test -

i have example angularjs directive <div some-dir="5" /> how access directive attribute value of 5 inside test? describe("some-dir", function() { var element, scope; beforeeach(module('app')); beforeeach(inject(function($rootscope, $compile) { scope = $rootscope; element = angular.element('<div><div id="el1" some-dir="5" /></div>'); $compile(element)(scope); scope.$digest(); })); it('should able attribute value', function(){ // attr value of some-dir }); }); you can check scope values of element using isolatescope method. won't work when pass value right next directive attribute, values not copied isolated scope. in case, it's possible , test value using element.attributes method. first compile directive html: var element; beforeeach(inject(function (_$compile_, _$rootscope_) { var $compile =

kendo ui - KendoUI DatePicker Set Value culture dd/MM/yyyy only works fine es-AR and not es-CL -

Image
i have issue , lost 3 days... using globalization in kendo ui. i have read several times http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization , apply in web proyect. i use asp.net mvc . framework 4 . visual studio 2010 . kendo ui 2014.2.1008 my country chile. should use es-cl culture , es-es uiculture (spanish messages pageable, filterable, etc). i need whole app works dd/mm/yyyy independent of client pc windows culture set. i set kendo.culture.es-cl.min.js copy of kendo.culture.es-ar.min.js, copy & paste, thing think :( i have partial view in header load of culture , others, load first other views: @{ var culture = system.globalization.cultureinfo.currentculture.tostring(); //se obtiene del servidor (web.config) var cultureui = system.globalization.cultureinfo.currentuiculture.tostring(); //textos de mensajes kendo, paginación, filtros, etc, se obtiene del servidor (web.config) } <script src="@url.content("~/scripts/kendo/2014.2.1008/mess

html - box-shadow IE8 not working on IE8 -

i've relevant topics not find solution created question. im trying implement box-shadow on ie8 , not working.. works on ie9+? i have simple div: <span id="controls" class="box-shadow"> <input id="start" type="text" placeholder="get directions: enter address or postcode"/> <input id="end" type="hidden" value="text" /> </span> and css: #controls.box-shadow{ background-color: white; font-size: 13px; position: relative; padding: 5px; z-index: 10000; float: right; height: 35px; width: 96%; margin-left: 20px; } .box-shadow{ box-shadow: 0px 0px 15px 0px #232361; -moz-box-shadow: 0px 0px 15px 0px #232361; -webkit-box-shadow: 0px 0px 15px 0px #232361; -ms-filter: "progid:dximagetransform.microsoft.shadow(strength=4, direction=135, color='#232361')"; filter: progid:dximagetransform.microsoft.shadow(strength=4, direction=135, color='#232361'); } #s

javascript - JSON printing (treeview) -

i have complex json string looks this: { "id":"2016666", "dt":"2012", "object_extends":[ { "extend1":{ "id":"2016666", "dt":"2012", "active":"true", "object_extend":[ { "extend2": { "id":"2016666", "secondary":null }, "extend3": { "id":"2016666", "pet":"willy" } } ] } } ] } now want print tree, when searching days have modify jso

sql server - Show row from block of string without cursors or while loops -

i have variable containig numerous of lines string looking that: senteqweqence text sentence -1 text sendasdadadastence other text my goal extract first line variable cointaining string -1 regardless of text above or below line, without using cursors or while loops. expected result: sentence -1 text what have tried far: declare @sql nvarchar(max), @end int, @start int set @sql = 'senteqweqence text sentence -1 text sendasdadadastence other text' set @end = charindex(char(10),@sql,charindex('-1',@sql)) set @start = charindex(char(10),reverse(@sql),1) print substring(@sql,@start,@end-@start) something should going. might need add or subtract character @ either end of substring: set @end = charindex(char(10),@sql,charindex('-1',@sql)) set @start = @end - charindex(char(10),reverse(left(@sql,@end)),charindex('1-',reverse(left(@sql,@end))))+2 print substring(@sql,@start,@end-@start)

Signal Spectrum MATLAB Syntax -

i have little problem regarding matlab , syntaxes. i'm trying plot spectrum regarding am-modulated signal. in case am-modulation defined as: y(t)=[1+m*x(t)]*cos(2*pi*fc*t) , fc=100 khz , m=0.5 breaking y(t) in parts: y(t)=cos(2*pi*fc*t)+m*x(t)*cos(2*pi*fc*t) and x(t) cosine wave amplitude of 1 , frequency range fx=[0-5000hz]. y(t) can written as: y(t)=cos(2*pi*fc*t)+m*cos(2*pi*fx*t)*cos(2*pi*fc*t) using trigonometric identity, can write y(t) as: cos(x)cos(y)=1/2(cos(x-y)+cos(x+y)) y(t)=cos(2*pi*fc*t)+m/2*cos(2*pi*t(fc-fx))+m/2*cos(2*pi*t(fc+fx)) now when fx=[0,5000hz], y(t) can written sum of these harmonic waves: y(t)=cos(2*pi*fc*t)+m/2*cos(2*pi*t(fc-0))+m/2*cos(2*pi*t(fc+0))+m/2*cos(2*pi*t(fc-1))+m/2*cos(2*pi*t(fc+1))... + m/2*cos(2*pi*t(fc-5000))+m/2*cos(2*pi*t(fc+5000)) now when writing down in matlab: clear all; fc=100000; //base frequency fs=250000; //sampling rate should fs>2fc according nyquist criterion ts=1/fs; m=0.5; t = 0:ts:1-ts; fx= 0:1

linux - Compare fraction values present in a text file and outputting it based on a criteria -

i have temp.txt file having contents shown when cat temp.txt used 0.3 1.3 5.3 7.3 they in string format need compare using arithmetic operators is possible read every line txt file , compare fixed number (lets 5.7). if criteria met need echo out terminal saying "well number bigger thresold " , output txt file. edit: hope clarifies awk '{ if ($1 > 5.7) print "number " $1 " larger 5.7" }' temp.txt | tee output_file.txt if need threshold determined dynamically can pass argument awk (google how this). edit: new format specified op sed 's/.*>\(.*\)<.*/\1/' temp.txt | sed '/^<[^>]*>/d' $awk '{ if ($1 > 5.7) print "number " $1 " larger 5.7" }' | tee output_file.txt

css - jQuery - find out :hover-styles -

i have div grows on hover. but: applied css-transition 200ms. now, if use jquery width()-function on hover() wrong value because of animation. need hover-width in endstate at exact hover-time, not @ end (that's why settimeout() doesn't solve problem). is possible :hover-style is? html <div id="parent"> <div id="grows"></div> </div><br><br><br><br> <span id="width"></span> css div#parent { width: 100px; height: 100px; } div#grows { width: 100%; height: 100%; background-color: black; -webkit-transition: 0.2s ease; -moz-transition: 0.2s ease; -ms-transition: 0.2s ease; -o-transition: 0.2s ease; transition: 0.2s ease; } div#grows:hover { width: 150%; height: 150%; } and js: $(document).ready(function() { $('div#grows').hover(function() { var width = $(this).css('width')); // 100px should 15

php - WordPress wp_enqueue_ scripts not working -

i have problem enqueing superfish script website. i've been hours around , have no idea what's causing problem. i'm using theme based on underscroes (this second time using it) , enqueue script in functions.php using the wp_enqueue_script( 'kornelije-stankovic-superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'), '20140711', true ); i load website using chrome, check resources , script doesn't load. of course script in /js folder exact name superfish.js. the funny thing is, tried loading on other website in exact same manner , works fine! any idea causing issue? the wp_enqueue_script() should called inside wp_enqueue_scripts callback, this: /** * proper way enqueue scripts , styles */ function theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', ar

oracleforms - Where does Oracle Forms look for ActiveX dll and its dependencies? -

i've written dll activex , which, in turn, has other dll dependencies. activex has used client oracle forms 6i , they're having trouble integration. error oracle forms runtime : xxxx - unable locate component referring edsdk.dll , use in activex dll .

listview - Firemonkey TListview Behavour -

when using tlistview in delphi, if click below last list item selected item becomes nil (itemindex = -1). when using tlistview in firemonkey, if click below last list item selected item last item on list. not want happen. if click below last item, want no item selected. i @ loss. there way or have missed here or off-base? thanks. the problem @ fmx.listview.pas unit @ finditemabsoluteat procedure, line 4060. this code: if viewat >= heightsums[heightsums.count - 1] exit(heightsums.count - 1); replace code: if viewat >= heightsums[heightsums.count - 1]+getitemheight(heightsums.count-1) exit(-1); and system start work logically. source: https://pjstrnad.com/another-fix-delphi-code-click-listview/

sql - db2 specific query for count of distinct rows -

i using db2. have query: select distinct order_number, trdm trademark, cmdnsm customer_name db1.ordfa join db2.ccadf on sford# = wdrso join db2.dada06 on wd3adf = wd3fla join db1.cmp1 on c1lk2 = sf2lk year = '14' , part = '5484' order customer_name, trademark and result set above query order_number trademark customer_name 2220824. air epr products inc 2254614. avalon epr products inc 2214146. avalon epr products inc 2338002. avalon epr products inc 2102733. boss epr products inc 2286148. cdc epr products inc 2116148. cdc epr products inc 2032105. hc summlc 2014046. hc summlc 2232312. sdexo summlc 2267369. sdexo summlc 2085280. sdexo summlc 2170433. sdexo summlc 2179283. sdexo summlc 2378745. sdexo summlc

javascript - How to filter images of specific size with jQuery? -

i'm trying find images larger specific size in html page, following code not work correctly: function findimages(url) { $.ajax({ url: url, datatype: "html", success: function (data) { var html = $.parsehtml( data ), imgs = $(html).find("img").filter(function() { return ($(this).width() > 50) && ($(this).height() > 50) }); len = imgs.length; if( len > 0 ){ $.each(imgs, function(index, img) { console.log(img.width); }); } else { console.log("image not found"); } }, }); }; i expect filter part return images width , height larger 50, not seem work me. doing wrong here? suppose html response var imageshtml = [ '<img src="http://" width="100" height="500">',

How to populate a table with 5 million rows in MS SQL Server? -

i'm working on app should find 26-letter code in char(26) column out of 5,760,000 rows. need know how long it's going take. i'm using ms sql server 2012 express. i have database has 1 table, mytable : idcolumn integer codecolumn char(26) dateandtimecolumn datetime column 'codecolumn' has index. idcolumn integer id. codecolumn has "00592098715648275649283746" format (this example). dateandtimecolumn timestamp. i populate table data tests , find out how long going take answer database. don't know how write proper tsql statement populate table 5,760,000 rows. second column long. how can populate table table populated? let's data should when use statement select idcolumn, codecolumn, dateandtimecolumn mytable; output: 1 00000000000000000000000001 2014-11-19 15:46:50.843 2 00000000000000000000000002 2014-11-19 15:46:54.310 3 00000000000000000000000003 2014-11-19 15:46:56.060 and on ... till 5,760,000 rows.

jsf - 'TypeError: b is undefined' after upgrading to PrimeFaces 5.1 -

i'm having webapplication primefaces 4.0. want upgrade primefaces 5.1. changed jar , updated myfaces version 2.2.5. i'm deploying on apache tomcat 7.0.42. unfortunately i'm running error now: typeerror: b undefined (found firebug) occurs when selecting value selectonemenu updates selectonemenu on form within tabview component. doesn't appear if roll version 4. here's code: the selectonemenu selection made <p:selectonemenu id="customersmenu" value="#{customerview.selectedcustomer}" style="float:right" converter="customerconverter" filter="true" filtermatchmode="contains"> <p:ajax event="change" update=":tabview" process="customersmenu"/> <f:selectitem itemlabel=" kunde auswählen" itemvalue="" /> <f:selectitems value="#{customerview.customers}" var=